- Timestamp:
- 01/09/2019 05:43:14 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-comment.php
r42343 r44497 23 23 } 24 24 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 */ 25 32 function create_object( $args ) { 26 33 return wp_insert_comment( $this->addslashes_deep( $args ) ); 27 34 } 28 35 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 */ 29 44 function update_object( $comment_id, $fields ) { 30 45 $fields['comment_ID'] = $comment_id; … … 32 47 } 33 48 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 */ 34 59 function create_post_comments( $post_id, $count = 1, $args = array(), $generation_definitions = null ) { 35 60 $args['comment_post_ID'] = $post_id; … … 37 62 } 38 63 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 */ 39 71 function get_object_by_id( $comment_id ) { 40 72 return get_comment( $comment_id );
Note: See TracChangeset
for help on using the changeset viewer.