Changeset 991 in tests for trunk/tests/url.php
- Timestamp:
- 08/27/2012 01:14:21 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/tests/url.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/url.php
r951 r991 157 157 force_ssl_login( $forced_login ); 158 158 } 159 160 function test_get_adjacent_post() { 161 $post_id = $this->factory->post->create(); 162 sleep( 1 ); // get_adjacent_post() doesn't handle posts created in the same second. 163 $post_id2 = $this->factory->post->create(); 164 165 $orig_post = $GLOBALS['post']; 166 $GLOBALS['post'] = get_post( $post_id2 ); 167 168 $p = get_adjacent_post(); 169 $this->assertInstanceOf( 'WP_Post', $p ); 170 $this->assertEquals( $post_id, $p->ID ); 171 172 // The same again to make sure a cached query returns the same result 173 $p = get_adjacent_post(); 174 $this->assertInstanceOf( 'WP_Post', $p ); 175 $this->assertEquals( $post_id, $p->ID ); 176 177 // Test next 178 $p = get_adjacent_post( false, '', false ); 179 $this->assertEquals( '', $p ); 180 181 unset( $GLOBALS['post'] ); 182 $this->assertNull( get_adjacent_post() ); 183 184 $GLOBALS['post'] = $orig_post; 185 186 // Tests requiring creating more posts can't be run since the query 187 // cache in get_adjacent_post() requires a fresh page load to invalidate. 188 } 159 189 }
Note: See TracChangeset
for help on using the changeset viewer.