Changeset 28113 for trunk/tests/phpunit/tests/admin/includesPost.php
- Timestamp:
- 04/14/2014 07:47:10 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesPost.php
r27405 r28113 5 5 */ 6 6 class Tests_Admin_includesPost extends WP_UnitTestCase { 7 8 function tearDown() { 9 wp_set_current_user( 0 ); 10 parent::tearDown(); 11 } 7 12 8 13 function test__wp_translate_postdata_cap_checks_contributor() { … … 57 62 $this->assertEquals( 'edit_others_posts', $_results->get_error_code() ); 58 63 $this->assertEquals( 'You are not allowed to edit posts as this user.', $_results->get_error_message() ); 59 60 wp_set_current_user( 0 );61 64 } 62 65 … … 112 115 $this->assertEquals( $_post_data['post_author'], $_results['post_author'] ); 113 116 $this->assertEquals( 'draft', $_results['post_status'] ); 114 115 wp_set_current_user( 0 );116 117 } 117 118 … … 134 135 edit_post( $post_data ); 135 136 $this->assertEquals( 'draft', get_post( $post->ID )->post_status ); 136 wp_set_current_user( 0 ); 137 } 138 139 /** 140 * @ticket 27792 141 */ 142 function test_bulk_edit_posts_stomping() { 143 $admin = $this->factory->user->create( array( 'role' => 'administrator' ) ); 144 $users = $this->factory->user->create_many( 2, array( 'role' => 'author' ) ); 145 wp_set_current_user( $admin ); 146 147 $post1 = $this->factory->post->create( array( 148 'post_author' => $users[0], 149 'comment_status' => 'open', 150 'ping_status' => 'open', 151 'post_status' => 'publish', 152 ) ); 153 154 $post2 = $this->factory->post->create( array( 155 'post_author' => $users[1], 156 'comment_status' => 'closed', 157 'ping_status' => 'closed', 158 'post_status' => 'draft', 159 ) ); 160 161 $request = array( 162 'post_type' => 'post', 163 'post_author' => -1, 164 'ping_status' => -1, 165 'comment_status' => -1, 166 '_status' => -1, 167 'post' => array( $post1, $post2 ), 168 ); 169 170 $done = bulk_edit_posts( $request ); 171 172 $post = get_post( $post2 ); 173 174 // Check that the first post's values don't stomp the second post. 175 $this->assertEquals( 'draft', $post->post_status ); 176 $this->assertEquals( $users[1], $post->post_author ); 177 $this->assertEquals( 'closed', $post->comment_status ); 178 $this->assertEquals( 'closed', $post->ping_status ); 137 179 } 138 180
Note: See TracChangeset
for help on using the changeset viewer.