- Timestamp:
- 01/09/2019 05:43:14 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-post.php
r42343 r44497 24 24 } 25 25 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 */ 26 33 function create_object( $args ) { 27 34 return wp_insert_post( $args ); 28 35 } 29 36 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 */ 30 45 function update_object( $post_id, $fields ) { 31 46 $fields['ID'] = $post_id; … … 33 48 } 34 49 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 */ 35 57 function get_object_by_id( $post_id ) { 36 58 return get_post( $post_id );
Note: See TracChangeset
for help on using the changeset viewer.