Changeset 45013 for branches/4.0/tests/phpunit/tests/post.php
- Timestamp:
- 03/26/2019 12:45:57 AM (6 years ago)
- Location:
- branches/4.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.0
- Property svn:mergeinfo changed
/trunk merged: 29860,29869,29954,30160,30530
- Property svn:mergeinfo changed
-
branches/4.0/tests/phpunit/tests/post.php
r40456 r45013 741 741 742 742 /** 743 * @ticket 19373744 */745 function test_insert_programmatic_without_current_user_success() {746 $this->_unset_current_user();747 748 register_taxonomy( 'test_tax', 'post' );749 750 $title = rand_str();751 $post_data = array(752 'post_author' => $this->author_id,753 'post_status' => 'public',754 'post_content' => rand_str(),755 'post_title' => $title,756 'tax_input' => array(757 'test_tax' => array( 'term', 'term2', 'term3' )758 )759 );760 // with sanitize set to false761 $insert_post_id = wp_insert_post( $post_data, true, false );762 763 $post = get_post( $insert_post_id );764 $this->assertEquals( $post->post_author, $this->author_id );765 $this->assertEquals( $post->post_title, $title );766 767 $terms = wp_get_object_terms( $insert_post_id, 'test_tax' );768 $this->assertTrue( ( is_array( $terms ) && count( $terms ) == 3 ) );769 }770 771 /**772 * @ticket 19373773 */774 function test_insert_programmatic_without_current_user_fail() {775 $this->_unset_current_user();776 777 register_taxonomy( 'test_tax', 'post' );778 779 $title = rand_str();780 $post_data = array(781 // post_author not set782 'post_status' => 'public',783 'post_content' => rand_str(),784 'post_title' => $title,785 'tax_input' => array(786 'test_tax' => array( 'term', 'term2', 'term3' )787 )788 );789 // with sanitize set to false790 $insert_post_id = wp_insert_post( $post_data, true, false );791 792 // should error because no default user exists and no post author is passed in793 $this->assertInstanceOf( 'WP_Error', $insert_post_id );794 $this->assertEquals( 'empty_author', $insert_post_id->get_error_code() );795 }796 797 /**798 743 * @ticket 24803 799 744 */
Note: See TracChangeset
for help on using the changeset viewer.