Changeset 53043 for trunk/tests/phpunit/tests/canonical.php
- Timestamp:
- 04/01/2022 03:23:07 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/canonical.php
r52010 r53043 277 277 278 278 /** 279 * Ensure public posts with custom public statuses are guessed. 280 * 281 * @ticket 47911 282 * @dataProvider data_redirect_guess_404_permalink_with_custom_statuses 283 * 284 * @covers ::redirect_guess_404_permalink 285 */ 286 public function test_redirect_guess_404_permalink_with_custom_statuses( $status_args, $redirects ) { 287 register_post_status( 'custom', $status_args ); 288 289 $post = self::factory()->post->create( 290 array( 291 'post_title' => 'custom-status-public-guess-404-permalink', 292 'post_status' => 'custom', 293 ) 294 ); 295 296 $this->go_to( 'custom-status-public-guess-404-permalink' ); 297 298 $expected = $redirects ? get_permalink( $post ) : false; 299 300 $this->assertSame( $expected, redirect_guess_404_permalink() ); 301 } 302 303 /** 304 * Data provider for test_redirect_guess_404_permalink_with_custom_statuses(). 305 * 306 * return array[] { 307 * array Arguments used to register custom status 308 * bool Whether the 404 link is expected to redirect 309 * } 310 */ 311 public function data_redirect_guess_404_permalink_with_custom_statuses() { 312 return array( 313 'public status' => array( 314 'status_args' => array( 'public' => true ), 315 'redirects' => true, 316 ), 317 'private status' => array( 318 'status_args' => array( 'public' => false ), 319 'redirects' => false, 320 ), 321 'internal status' => array( 322 'status_args' => array( 'internal' => true ), 323 'redirects' => false, 324 ), 325 'protected status' => array( 326 'status_args' => array( 'protected' => true ), 327 'redirects' => false, 328 ), 329 'protected status flagged as public' => array( 330 'status_args' => array( 331 'protected' => true, 332 'public' => true, 333 ), 334 'redirects' => false, 335 ), 336 ); 337 } 338 339 /** 279 340 * Ensure multiple post types do not throw a notice. 280 341 *
Note: See TracChangeset
for help on using the changeset viewer.