Make WordPress Core

Changeset 46985


Ignore:
Timestamp:
12/18/2019 12:17:54 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Various documentation fixes for unit test factories.

See #48303.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r46973 r46985  
    41514151 *                               objects are not. Default array.
    41524152 * @param bool         $wp_error Optional. Allow return of WP_Error on failure. Default false.
    4153  * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success.
     4153 * @return int|WP_Error The post ID on success. The value 0 or WP_Error on failure.
    41544154 */
    41554155function wp_update_post( $postarr = array(), $wp_error = false ) {
  • trunk/src/wp-includes/taxonomy.php

    r46823 r46985  
    810810 *                             a WP_Term object, an associative array, or a numeric array, respectively. Default OBJECT.
    811811 * @param string     $filter   Optional, default is raw or no WordPress defined filter will applied.
    812  * @return array|WP_Term|WP_Error|null Object of the type specified by `$output` on success. When `$output` is 'OBJECT',
     812 * @return WP_Term|array|WP_Error|null Object of the type specified by `$output` on success. When `$output` is 'OBJECT',
    813813 *                                     a WP_Term instance is returned. If taxonomy does not exist, a WP_Error is
    814814 *                                     returned. Returns null for miscellaneous failure.
  • trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-attachment.php

    r46586 r46985  
    1515     * @param array $legacy_args   Deprecated.
    1616     *
    17      * @return  int|WP_Error The attachment ID on success. The value 0 or WP_Error on failure.
     17     * @return int|WP_Error The attachment ID on success. The value 0 or WP_Error on failure.
    1818     */
    1919    public function create_object( $args, $legacy_parent = 0, $legacy_args = array() ) {
     
    4141     *
    4242     * @param string $file   The file name to create attachment object for.
    43      * @param int    $parent The post id to attach the file to.
     43     * @param int    $parent ID of the post to attach the file to.
    4444     *
    4545     * @return int|WP_Error The attachment ID on success. The value 0 or WP_Error on failure.
  • trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-blog.php

    r46586 r46985  
    2525
    2626    /**
    27      * Creates a blog object.
     27     * Creates a site object.
    2828     *
    2929     * @param array $args Arguments for the site object.
    3030     *
    31      * @return int|WP_Error Returns WP_Error object on failure, the site ID on success.
     31     * @return int|WP_Error The site ID on success, WP_Error object on failure.
    3232     */
    3333    public function create_object( $args ) {
     
    4747
    4848    /**
    49      * Updates a blog object. Not implemented.
     49     * Updates a site object. Not implemented.
    5050     *
    51      * @param int   $blog_id The blog id to update.
     51     * @param int   $blog_id ID of the site to update.
    5252     * @param array $fields  The fields to update.
    5353     *
     
    5757
    5858    /**
    59      * Retrieves a site by given blog id.
     59     * Retrieves a site by a given ID.
    6060     *
    61      * @param int $blog_id The blog id to retrieve.
     61     * @param int $blog_id ID of the site to retrieve.
    6262     *
    63      * @return null|WP_Site The site object or null if not found.
     63     * @return WP_Site|null The site object on success, null on failure.
    6464     */
    6565    public function get_object_by_id( $blog_id ) {
  • trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-comment.php

    r46586 r46985  
    3737     * Updates a comment.
    3838     *
    39      * @param int   $comment_id The comment id.
     39     * @param int   $comment_id The comment ID.
    4040     * @param array $fields     The comment details.
    4141     *
     
    4848
    4949    /**
    50      * Creates multiple comments on given post.
     50     * Creates multiple comments on a given post.
    5151     *
    52      * @param int   $post_id                The post id to create comments for.
     52     * @param int   $post_id                ID of the post to create comments for.
    5353     * @param int   $count                  Total amount of comments to create.
    5454     * @param array $args                   The comment details.
    5555     * @param null  $generation_definitions Default values.
    5656     *
    57      * @return int[] Array with the comment ids.
     57     * @return int[] Array with the comment IDs.
    5858     */
    5959    public function create_post_comments( $post_id, $count = 1, $args = array(), $generation_definitions = null ) {
     
    6363
    6464    /**
    65      * Returns a comment.
     65     * Retrieves a comment by a given ID.
    6666     *
    67      * @param int $comment_id The comment id.
     67     * @param int $comment_id ID of the comment to retrieve.
    6868     *
    69      * @return null|WP_Comment WP_Comment when found, null when not found.
     69     * @return WP_Comment|null WP_Comment object on success, null on failure.
    7070     */
    7171    public function get_object_by_id( $comment_id ) {
  • trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-post.php

    r46586 r46985  
    3838     * Updates an existing post object.
    3939     *
    40      * @param int   $post_id The post id to update.
     40     * @param int   $post_id ID of the post to update.
    4141     * @param array $fields  Post data.
    4242     *
    43      * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success.
     43     * @return int|WP_Error The post ID on success. The value 0 or WP_Error on failure.
    4444     */
    4545    public function update_object( $post_id, $fields ) {
     
    4949
    5050    /**
    51      * Retrieves a object by an id.
     51     * Retrieves a post by a given ID.
    5252     *
    53      * @param int   $post_id The post id to update.
     53     * @param int $post_id ID of the post to retrieve.
    5454     *
    55      * @return null|WP_Post WP_Post on success or null on failure.
     55     * @return WP_Post|null WP_Post object on success, null on failure.
    5656     */
    5757    public function get_object_by_id( $post_id ) {
  • trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-term.php

    r46586 r46985  
    4747     * @param array|string $fields The context in which to relate the term to the object.
    4848     *
    49      * @return int The term id.
     49     * @return int The term ID.
    5050     */
    5151    public function update_object( $term, $fields ) {
     
    5959
    6060    /**
    61      * Attach terms on the given post.
     61     * Attach terms to the given post.
    6262     *
    63      * @param int          $post_id  The Post ID.
     63     * @param int          $post_id  The post ID.
    6464     * @param string|array $terms    An array of terms to set for the post, or a string of terms
    6565     *                               separated by commas. Hierarchical taxonomies must always pass IDs rather
     
    7777
    7878    /**
    79      * Create a term and returns it as a object.
     79     * Create a term and returns it as an object.
    8080     *
    8181     * @param array $args                   Array or string of arguments for inserting a term.
    8282     * @param null  $generation_definitions The default values.
    8383     *
    84      * @return null|WP_Error|WP_Term WP_Term on success. WP_error if taxonomy does not exist. Null for miscellaneous failure.
     84     * @return WP_Term|WP_Error|null WP_Term on success. WP_error if taxonomy does not exist. Null for miscellaneous failure.
    8585     */
    8686    public function create_and_get( $args = array(), $generation_definitions = null ) {
     
    9696
    9797    /**
    98      * Retrieves the term by given term id.
     98     * Retrieves the term by a given ID.
    9999     *
    100      * @param int $term_id The term id to retrieve.
     100     * @param int $term_id ID of the term to retrieve.
    101101     *
    102      * @return null|WP_Error|WP_Term WP_Term on success. WP_error if taxonomy does not exist. Null for miscellaneous failure.
     102     * @return WP_Term|WP_Error|null WP_Term on success. WP_error if taxonomy does not exist. Null for miscellaneous failure.
    103103     */
    104104    public function get_object_by_id( $term_id ) {
  • trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-thing.php

    r46830 r46985  
    3434     * Updates an existing object.
    3535     *
    36      * @param int   $object The object id.
     36     * @param int   $object The object ID.
    3737     * @param array $fields The values to update.
    3838     *
     
    9191     * Retrieves an object by ID.
    9292     *
    93      * @param int $object_id The object id.
     93     * @param int $object_id The object ID.
    9494     *
    9595     * @return mixed The object. Can be anything.
     
    115115
    116116    /**
    117      * Combines the given argument with the generation_definitions (defaults) and applies
     117     * Combines the given arguments with the generation_definitions (defaults) and applies
    118118     * possibly set callbacks on it.
    119119     *
  • trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-user.php

    r46586 r46985  
    2727     * @param array $args The user data to insert.
    2828     *
    29      * @return int|WP_Error
     29     * @return int|WP_Error The user ID on success, WP_Error object on failure.
    3030     */
    3131    public function create_object( $args ) {
     
    3636     * Updates the user data.
    3737     *
    38      * @param int   $user_id The user id to update.
     38     * @param int   $user_id ID of the user to update.
    3939     * @param array $fields  The user data to update.
    4040     *
    41      * @return int|WP_Error User id on success. WP_Error on failure.
     41     * @return int|WP_Error The user ID on success, WP_Error object on failure.
    4242     */
    4343    public function update_object( $user_id, $fields ) {
     
    4747
    4848    /**
    49      * Retrieves the user for given user id.
     49     * Retrieves the user for a given ID.
    5050     *
    51      * @param int $user_id The user id to get.
     51     * @param int $user_id ID of the user ID to retrieve.
    5252     *
    53      * @return WP_User The user.
     53     * @return WP_User The user object.
    5454     */
    5555    public function get_object_by_id( $user_id ) {
Note: See TracChangeset for help on using the changeset viewer.