diff --git a/tests/phpunit/tests/rewrite/oldDateRedirect.php b/tests/phpunit/tests/rewrite/oldDateRedirect.php index cdbab81c51..963f103a4f 100644 --- a/tests/phpunit/tests/rewrite/oldDateRedirect.php +++ b/tests/phpunit/tests/rewrite/oldDateRedirect.php @@ -106,9 +106,11 @@ class Tests_Rewrite_OldDateRedirect extends WP_UnitTestCase { $permalink = user_trailingslashit( get_permalink( self::$post_id ) ); $this->go_to( $old_permalink ); + wp_old_slug_redirect(); $num_queries = get_num_queries(); $this->assertSame( $permalink, $this->old_date_redirect_url ); + wp_old_slug_redirect(); $this->assertSame( $permalink, $this->old_date_redirect_url ); $this->assertSame( $num_queries, get_num_queries() ); @@ -118,7 +120,6 @@ class Tests_Rewrite_OldDateRedirect extends WP_UnitTestCase { * @ticket 36723 */ public function test_old_date_redirect_cache_invalidation() { - global $wpdb; $old_permalink = user_trailingslashit( get_permalink( self::$post_id ) ); $time = '2004-01-03 00:00:00'; @@ -140,15 +141,16 @@ class Tests_Rewrite_OldDateRedirect extends WP_UnitTestCase { $time = '2014-02-01 00:00:00'; wp_update_post( array( - 'ID' => $this->post_id, + 'ID' => self::$post_id, 'post_date' => $time, 'post_date_gmt' => get_gmt_from_date( $time ), - 'post_name' => 'bar-baz', + 'post_name' => 'foo-bar-baz', ) ); + $permalink = user_trailingslashit( get_permalink( self::$post_id ) ); + $num_queries = get_num_queries(); - $this->go_to( $permalink ); wp_old_slug_redirect(); $this->assertSame( $permalink, $this->old_date_redirect_url ); $this->assertGreaterThan( $num_queries, get_num_queries() ); diff --git a/tests/phpunit/tests/rewrite/oldSlugRedirect.php b/tests/phpunit/tests/rewrite/oldSlugRedirect.php index f455235948..754ad996ff 100644 --- a/tests/phpunit/tests/rewrite/oldSlugRedirect.php +++ b/tests/phpunit/tests/rewrite/oldSlugRedirect.php @@ -73,6 +73,7 @@ class Tests_Rewrite_OldSlugRedirect extends WP_UnitTestCase { wp_old_slug_redirect(); $num_queries = get_num_queries(); $this->assertSame( $permalink, $this->old_slug_redirect_url ); + wp_old_slug_redirect(); $this->assertSame( $permalink, $this->old_slug_redirect_url ); $this->assertSame( $num_queries, get_num_queries() ); @@ -101,9 +102,12 @@ class Tests_Rewrite_OldSlugRedirect extends WP_UnitTestCase { wp_update_post( array( 'ID' => $this->post_id, - 'post_name' => 'foo-bar', + 'post_name' => 'foo-bar-baz', ) ); + + $permalink = user_trailingslashit( get_permalink( $this->post_id ) ); + $num_queries = get_num_queries(); wp_old_slug_redirect(); $this->assertSame( $permalink, $this->old_slug_redirect_url );