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-comment.php

    r42343 r44497  
    2323    }
    2424
     25    /**
     26     * Inserts a comment.
     27     *
     28     * @param array $args The comment details.
     29     *
     30     * @return false|int The comment's ID on success, false on failure.
     31     */
    2532    function create_object( $args ) {
    2633        return wp_insert_comment( $this->addslashes_deep( $args ) );
    2734    }
    2835
     36    /**
     37     * Updates a comment.
     38     *
     39     * @param int   $comment_id The comment id.
     40     * @param array $fields     The comment details.
     41     *
     42     * @return int When updated 1, not update 0.
     43     */
    2944    function update_object( $comment_id, $fields ) {
    3045        $fields['comment_ID'] = $comment_id;
     
    3247    }
    3348
     49    /**
     50     * Creates multiple comments on given post.
     51     *
     52     * @param int   $post_id                The post id to create comments for.
     53     * @param int   $count                  Total amount of comments to create.
     54     * @param array $args                   The comment details.
     55     * @param null  $generation_definitions Default values.
     56     *
     57     * @return int[] Array with the comment ids.
     58     */
    3459    function create_post_comments( $post_id, $count = 1, $args = array(), $generation_definitions = null ) {
    3560        $args['comment_post_ID'] = $post_id;
     
    3762    }
    3863
     64    /**
     65     * Returns a comment.
     66     *
     67     * @param int $comment_id The comment id.
     68     *
     69     * @return null|WP_Comment WP_Comment when found, null when not found.
     70     */
    3971    function get_object_by_id( $comment_id ) {
    4072        return get_comment( $comment_id );
Note: See TracChangeset for help on using the changeset viewer.