| | 289 | |
| | 290 | /** |
| | 291 | * @ticket 28026 |
| | 292 | */ |
| | 293 | function test_same_date_posts_sort_by_id() { |
| | 294 | // Need some sample posts to test adjacency |
| | 295 | $post_one = $this->factory->post->create_and_get( array( |
| | 296 | 'post_title' => 'First', |
| | 297 | 'post_date' => '2012-01-01 12:00:00' |
| | 298 | ) ); |
| | 299 | |
| | 300 | $post_two = $this->factory->post->create_and_get( array( |
| | 301 | 'post_title' => 'Second', |
| | 302 | 'post_date' => '2012-02-01 12:00:00' |
| | 303 | ) ); |
| | 304 | |
| | 305 | $post_three = $this->factory->post->create_and_get( array( |
| | 306 | 'post_title' => 'Third', |
| | 307 | 'post_date' => '2012-02-01 12:00:00' |
| | 308 | ) ); |
| | 309 | |
| | 310 | // Assign some terms |
| | 311 | wp_set_object_terms( $post_one->ID, 'wordpress', 'category', false ); |
| | 312 | wp_set_object_terms( $post_two->ID, 'wordpress', 'category', false ); |
| | 313 | wp_set_object_terms( $post_three->ID, 'wordpress', 'category', false ); |
| | 314 | |
| | 315 | // Test equal date post adjacency |
| | 316 | $this->go_to( get_permalink( $post_two->ID ) ); |
| | 317 | |
| | 318 | $this->assertEquals( $post_one, get_adjacent_post( false, '', true ) ); |
| | 319 | |
| | 320 | $this->go_to( get_permalink( $post_three->ID ) ); |
| | 321 | |
| | 322 | $this->assertEquals( $post_two, get_adjacent_post( false, '', true ) ); |
| | 323 | |
| | 324 | } |