Changeset 49125 for trunk/tests/phpunit/tests/post/wpInsertPost.php
- Timestamp:
- 10/11/2020 01:37:04 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/post/wpInsertPost.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/wpInsertPost.php
r48937 r49125 160 160 161 161 wp_untrash_post( $about_page_id ); 162 wp_update_post( 163 array( 164 'ID' => $about_page_id, 165 'post_status' => 'publish', 166 ) 167 ); 162 168 163 169 $this->assertSame( 'about', get_post( $another_about_page_id )->post_name ); … … 166 172 167 173 /** 174 * @ticket 23022 175 * @dataProvider data_various_post_statuses 176 */ 177 function test_untrashing_a_post_should_always_restore_it_to_draft_status( $post_status ) { 178 $page_id = self::factory()->post->create( 179 array( 180 'post_type' => 'page', 181 'post_status' => $post_status, 182 ) 183 ); 184 185 wp_trash_post( $page_id ); 186 wp_untrash_post( $page_id ); 187 188 $this->assertSame( 'draft', get_post( $page_id )->post_status ); 189 } 190 191 /** 192 * @ticket 23022 193 * @dataProvider data_various_post_statuses 194 */ 195 function test_wp_untrash_post_status_filter_restores_post_to_correct_status( $post_status ) { 196 add_filter( 'wp_untrash_post_status', 'wp_untrash_post_set_previous_status', 10, 3 ); 197 198 $page_id = self::factory()->post->create( 199 array( 200 'post_type' => 'page', 201 'post_status' => $post_status, 202 ) 203 ); 204 205 wp_trash_post( $page_id ); 206 wp_untrash_post( $page_id ); 207 208 remove_filter( 'wp_untrash_post_status', 'wp_untrash_post_set_previous_status', 10, 3 ); 209 210 $this->assertSame( $post_status, get_post( $page_id )->post_status ); 211 } 212 213 /** 168 214 * Data for testing the ability for users to set the post slug. 169 215 * … … 180 226 array( 181 227 'post', 228 ), 229 ); 230 } 231 232 /** 233 * Data for testing post statuses. 234 * 235 * @return array Array of test arguments. 236 */ 237 function data_various_post_statuses() { 238 return array( 239 array( 240 'draft', 241 ), 242 array( 243 'pending', 244 ), 245 array( 246 'private', 247 ), 248 array( 249 'publish', 182 250 ), 183 251 );
Note: See TracChangeset
for help on using the changeset viewer.