WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/09/2019 05:43:14 AM (6 months ago)
Author:
pento
Message:

Docs: Add docblocks for the PHPUnit factory objects.

Props andizer.
Fixes #44521.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-post.php

    r42343 r44497  
    2424    }
    2525
     26    /**
     27     * Creates a post object.
     28     *
     29     * @param array $args Array with elements for the post.
     30     *
     31     * @return int|WP_Error The post ID on success. The value 0 or WP_Error on failure.
     32     */
    2633    function create_object( $args ) {
    2734        return wp_insert_post( $args );
    2835    }
    2936
     37    /**
     38     * Updates an existing post object.
     39     *
     40     * @param int   $post_id The post id to update.
     41     * @param array $fields  Post data.
     42     *
     43     * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success.
     44     */
    3045    function update_object( $post_id, $fields ) {
    3146        $fields['ID'] = $post_id;
     
    3348    }
    3449
     50    /**
     51     * Retrieves a object by an id.
     52     *
     53     * @param int   $post_id The post id to update.
     54     *
     55     * @return null|WP_Post WP_Post on success or null on failure.
     56     */
    3557    function get_object_by_id( $post_id ) {
    3658        return get_post( $post_id );
Note: See TracChangeset for help on using the changeset viewer.