Changeset 53549 for trunk/tests/phpunit/tests/rewrite/oldDateRedirect.php
- Timestamp:
- 06/21/2022 01:32:48 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rewrite/oldDateRedirect.php
r51568 r53549 3 3 /** 4 4 * @group rewrite 5 * @covers wp_old_slug_redirect 5 6 */ 6 7 class Tests_Rewrite_OldDateRedirect extends WP_UnitTestCase { … … 87 88 } 88 89 90 /** 91 * @ticket 36723 92 */ 93 public function test_old_date_slug_redirect_cache() { 94 $old_permalink = user_trailingslashit( get_permalink( self::$post_id ) ); 95 96 $time = '2004-01-03 00:00:00'; 97 wp_update_post( 98 array( 99 'ID' => self::$post_id, 100 'post_date' => $time, 101 'post_date_gmt' => get_gmt_from_date( $time ), 102 'post_name' => 'bar-baz', 103 ) 104 ); 105 106 $permalink = user_trailingslashit( get_permalink( self::$post_id ) ); 107 108 $this->go_to( $old_permalink ); 109 wp_old_slug_redirect(); 110 $num_queries = get_num_queries(); 111 $this->assertSame( $permalink, $this->old_date_redirect_url ); 112 wp_old_slug_redirect(); 113 $this->assertSame( $permalink, $this->old_date_redirect_url ); 114 $this->assertSame( $num_queries, get_num_queries() ); 115 } 116 117 /** 118 * @ticket 36723 119 */ 120 public function test_old_date_redirect_cache_invalidation() { 121 global $wpdb; 122 $old_permalink = user_trailingslashit( get_permalink( self::$post_id ) ); 123 124 $time = '2004-01-03 00:00:00'; 125 wp_update_post( 126 array( 127 'ID' => self::$post_id, 128 'post_date' => $time, 129 'post_date_gmt' => get_gmt_from_date( $time ), 130 'post_name' => 'bar-baz', 131 ) 132 ); 133 134 $permalink = user_trailingslashit( get_permalink( self::$post_id ) ); 135 136 $this->go_to( $old_permalink ); 137 wp_old_slug_redirect(); 138 $this->assertSame( $permalink, $this->old_date_redirect_url ); 139 140 $time = '2014-02-01 00:00:00'; 141 wp_update_post( 142 array( 143 'ID' => $this->post_id, 144 'post_date' => $time, 145 'post_date_gmt' => get_gmt_from_date( $time ), 146 'post_name' => 'bar-baz', 147 ) 148 ); 149 150 $num_queries = get_num_queries(); 151 $this->go_to( $permalink ); 152 wp_old_slug_redirect(); 153 $this->assertSame( $permalink, $this->old_date_redirect_url ); 154 $this->assertGreaterThan( $num_queries, get_num_queries() ); 155 } 156 89 157 public function test_old_date_redirect_attachment() { 90 158 $old_permalink = get_attachment_link( self::$attachment_id );
Note: See TracChangeset
for help on using the changeset viewer.