Changeset 47878 for trunk/tests/phpunit/tests/canonical.php
- Timestamp:
- 06/01/2020 06:47:41 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/canonical.php
r47781 r47878 232 232 233 233 /** 234 * @ticket 16557 235 */ 236 public function test_do_redirect_guess_404_permalink() { 237 // Test disable do_redirect_guess_404_permalink(). 238 add_filter( 'do_redirect_guess_404_permalink', '__return_false' ); 239 $this->go_to( '/child-page-1' ); 240 $this->assertFalse( redirect_guess_404_permalink() ); 241 } 242 243 /** 244 * @ticket 16557 245 */ 246 public function test_pre_redirect_guess_404_permalink() { 247 // Test short-circuit filter. 248 add_filter( 249 'pre_redirect_guess_404_permalink', 250 function() { 251 return 'wp'; 252 } 253 ); 254 $this->go_to( '/child-page-1' ); 255 $this->assertEquals( 'wp', redirect_guess_404_permalink() ); 256 } 257 258 /** 259 * @ticket 16557 260 */ 261 public function test_strict_redirect_guess_404_permalink() { 262 $post = self::factory()->post->create( 263 array( 264 'post_title' => 'strict-redirect-guess-404-permalink', 265 ) 266 ); 267 268 $this->go_to( 'strict-redirect' ); 269 270 // Test default 'non-strict' redirect guess. 271 $this->assertEquals( get_permalink( $post ), redirect_guess_404_permalink() ); 272 273 // Test 'strict' redirect guess. 274 add_filter( 'strict_redirect_guess_404_permalink', '__return_true' ); 275 $this->assertFalse( redirect_guess_404_permalink() ); 276 } 277 278 /** 234 279 * @ticket 43745 235 280 */
Note: See TracChangeset
for help on using the changeset viewer.