mirror of
git://develop.git.wordpress.org/
synced 2025-05-02 18:07:51 +02:00
Tests: Add @method
notations to factor class DocBlocks as a way to indicate expected return types from factory methods for the benefit of IDEs.
Props jdgrimes. Fixes #37867. git-svn-id: https://develop.svn.wordpress.org/trunk@40968 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
63739c5c3d
commit
626f78750b
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Unit test factory for sites on a multisite network.
|
||||
*
|
||||
* Note: The below @method notations are defined solely for the benefit of IDEs,
|
||||
* as a way to indicate expected return values from the given factory methods.
|
||||
*
|
||||
* @method int create( $args = array(), $generation_definitions = null )
|
||||
* @method WP_Site create_and_get( $args = array(), $generation_definitions = null )
|
||||
* @method int[] create_many( $count, $args = array(), $generation_definitions = null )
|
||||
*/
|
||||
class WP_UnitTest_Factory_For_Blog extends WP_UnitTest_Factory_For_Thing {
|
||||
|
||||
function __construct( $factory = null ) {
|
||||
|
@ -3,7 +3,14 @@
|
||||
/**
|
||||
* Factory for creating fixtures for the deprecated Links/Bookmarks API.
|
||||
*
|
||||
* Note: The below @method notations are defined solely for the benefit of IDEs,
|
||||
* as a way to indicate expected return values from the given factory methods.
|
||||
*
|
||||
* @since 4.6.0
|
||||
*
|
||||
* @method int create( $args = array(), $generation_definitions = null )
|
||||
* @method object create_and_get( $args = array(), $generation_definitions = null )
|
||||
* @method int[] create_many( $count, $args = array(), $generation_definitions = null )
|
||||
*/
|
||||
class WP_UnitTest_Factory_For_Bookmark extends WP_UnitTest_Factory_For_Thing {
|
||||
|
||||
|
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Unit test factory for comments.
|
||||
*
|
||||
* Note: The below @method notations are defined solely for the benefit of IDEs,
|
||||
* as a way to indicate expected return values from the given factory methods.
|
||||
*
|
||||
* @method int create( $args = array(), $generation_definitions = null )
|
||||
* @method WP_Comment create_and_get( $args = array(), $generation_definitions = null )
|
||||
* @method int[] create_many( $count, $args = array(), $generation_definitions = null )
|
||||
*/
|
||||
class WP_UnitTest_Factory_For_Comment extends WP_UnitTest_Factory_For_Thing {
|
||||
|
||||
function __construct( $factory = null ) {
|
||||
|
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Unit test factory for networks.
|
||||
*
|
||||
* Note: The below @method notations are defined solely for the benefit of IDEs,
|
||||
* as a way to indicate expected return values from the given factory methods.
|
||||
*
|
||||
* @method int create( $args = array(), $generation_definitions = null )
|
||||
* @method WP_Network create_and_get( $args = array(), $generation_definitions = null )
|
||||
* @method int[] create_many( $count, $args = array(), $generation_definitions = null )
|
||||
*/
|
||||
class WP_UnitTest_Factory_For_Network extends WP_UnitTest_Factory_For_Thing {
|
||||
|
||||
function __construct( $factory = null ) {
|
||||
|
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Unit test factory for posts.
|
||||
*
|
||||
* Note: The below @method notations are defined solely for the benefit of IDEs,
|
||||
* as a way to indicate expected return values from the given factory methods.
|
||||
*
|
||||
* @method int create( $args = array(), $generation_definitions = null )
|
||||
* @method WP_Post create_and_get( $args = array(), $generation_definitions = null )
|
||||
* @method int[] create_many( $count, $args = array(), $generation_definitions = null )
|
||||
*/
|
||||
class WP_UnitTest_Factory_For_Post extends WP_UnitTest_Factory_For_Thing {
|
||||
|
||||
function __construct( $factory = null ) {
|
||||
|
@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Unit test factory for terms.
|
||||
*
|
||||
* Note: The below @method notations are defined solely for the benefit of IDEs,
|
||||
* as a way to indicate expected return values from the given factory methods.
|
||||
*
|
||||
* @method int create( $args = array(), $generation_definitions = null )
|
||||
* @method int[] create_many( $count, $args = array(), $generation_definitions = null )
|
||||
*/
|
||||
class WP_UnitTest_Factory_For_Term extends WP_UnitTest_Factory_For_Thing {
|
||||
|
||||
private $taxonomy;
|
||||
@ -35,6 +44,9 @@ class WP_UnitTest_Factory_For_Term extends WP_UnitTest_Factory_For_Thing {
|
||||
return wp_set_post_terms( $post_id, $terms, $taxonomy, $append );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null|WP_Error|WP_Term
|
||||
*/
|
||||
function create_and_get( $args = array(), $generation_definitions = null ) {
|
||||
$term_id = $this->create( $args, $generation_definitions );
|
||||
$taxonomy = isset( $args['taxonomy'] ) ? $args['taxonomy'] : $this->taxonomy;
|
||||
|
@ -1,5 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Unit test factory for users.
|
||||
*
|
||||
* Note: The below @method notations are defined solely for the benefit of IDEs,
|
||||
* as a way to indicate expected return values from the given factory methods.
|
||||
*
|
||||
* @method int create( $args = array(), $generation_definitions = null )
|
||||
* @method WP_User create_and_get( $args = array(), $generation_definitions = null )
|
||||
* @method int[] create_many( $count, $args = array(), $generation_definitions = null )
|
||||
*/
|
||||
class WP_UnitTest_Factory_For_User extends WP_UnitTest_Factory_For_Thing {
|
||||
|
||||
function __construct( $factory = null ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user