| 180 | * @ticket 27094 |
| 181 | */ |
| 182 | function test_get_adjacent_post_custom_post_type() { |
| 183 | // Register a sample custom post type |
| 184 | register_post_type( 'wptests_pt', array( 'public' => true ) ); |
| 185 | |
| 186 | // Need some sample pages to test adjacency |
| 187 | $post_one = $this->factory->post->create_and_get( array( |
| 188 | 'post_type' => 'wptests_pt', |
| 189 | 'post_date' => '2012-01-01 12:00:00' |
| 190 | ) ); |
| 191 | |
| 192 | $post_two = $this->factory->post->create_and_get( array( |
| 193 | 'post_type' => 'wptests_pt', |
| 194 | 'post_date' => '2012-02-01 12:00:00' |
| 195 | ) ); |
| 196 | |
| 197 | $post_three = $this->factory->post->create_and_get( array( |
| 198 | 'post_type' => 'wptests_pt', |
| 199 | 'post_date' => '2012-03-01 12:00:00' |
| 200 | ) ); |
| 201 | |
| 202 | $post_four = $this->factory->post->create_and_get( array( |
| 203 | 'post_type' => 'wptests_pt', |
| 204 | 'post_date' => '2012-04-01 12:00:00' |
| 205 | ) ); |
| 206 | |
| 207 | // Test normal boundary post with pages |
| 208 | $this->go_to( get_permalink( $post_two->ID ) ); |
| 209 | |
| 210 | $this->assertEquals( array( $post_one ), get_boundary_post( false, '', true ) ); |
| 211 | $this->assertEquals( array( $post_four ), get_boundary_post( false, '', false ) ); |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * @ticket 27094 |
| 216 | */ |
| 217 | function test_get_adjacent_post_attachment() { |
| 218 | |
| 219 | // Need some sample pages to test adjacency |
| 220 | $attachment_one = $this->factory->attachment->create_and_get( array( |
| 221 | 'post_date' => '2012-01-01 12:00:00' |
| 222 | ) ); |
| 223 | |
| 224 | $attachment_two = $this->factory->attachment->create_and_get( array( |
| 225 | 'post_date' => '2012-02-01 12:00:00' |
| 226 | ) ); |
| 227 | |
| 228 | $attachment_three = $this->factory->attachment->create_and_get( array( |
| 229 | 'post_date' => '2012-03-01 12:00:00' |
| 230 | ) ); |
| 231 | |
| 232 | // Test normal boundary post with pages |
| 233 | $this->go_to( get_permalink( $attachment_two->ID ) ); |
| 234 | |
| 235 | $this->assertNull( get_boundary_post( false, '', true ) ); |
| 236 | $this->assertNull( get_boundary_post( false, '', false ) ); |
| 237 | } |
| 238 | |
| 239 | /** |