| 180 | * @ticket 27094 |
| 181 | */ |
| 182 | function test_get_adjacent_post_page() { |
| 183 | // Need some sample pages to test adjacency |
| 184 | $page_one = $this->factory->post->create_and_get( array( |
| 185 | 'post_type' => 'page', |
| 186 | 'post_date' => '2012-01-01 12:00:00' |
| 187 | ) ); |
| 188 | |
| 189 | $page_two = $this->factory->post->create_and_get( array( |
| 190 | 'post_type' => 'page', |
| 191 | 'post_date' => '2012-02-01 12:00:00' |
| 192 | ) ); |
| 193 | |
| 194 | $page_three = $this->factory->post->create_and_get( array( |
| 195 | 'post_type' => 'page', |
| 196 | 'post_date' => '2012-03-01 12:00:00' |
| 197 | ) ); |
| 198 | |
| 199 | $page_four = $this->factory->post->create_and_get( array( |
| 200 | 'post_type' => 'page', |
| 201 | 'post_date' => '2012-04-01 12:00:00' |
| 202 | ) ); |
| 203 | |
| 204 | // Test normal boundary post with pages |
| 205 | $this->go_to( get_permalink( $page_two->ID ) ); |
| 206 | |
| 207 | $this->assertEquals( array( $page_one ), get_boundary_post( false, '', true ) ); |
| 208 | $this->assertEquals( array( $page_four ), get_boundary_post( false, '', false ) ); |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * @ticket 27094 |
| 213 | */ |
| 214 | function test_get_adjacent_post_custom_post_type() { |
| 215 | // Register a sample custom post type |
| 216 | register_post_type( 'wptests_pt', array( 'public' => true ) ); |
| 217 | |
| 218 | // Need some sample pages to test adjacency |
| 219 | $post_one = $this->factory->post->create_and_get( array( |
| 220 | 'post_type' => 'wptests_pt', |
| 221 | 'post_date' => '2012-01-01 12:00:00' |
| 222 | ) ); |
| 223 | |
| 224 | $post_two = $this->factory->post->create_and_get( array( |
| 225 | 'post_type' => 'wptests_pt', |
| 226 | 'post_date' => '2012-02-01 12:00:00' |
| 227 | ) ); |
| 228 | |
| 229 | $post_three = $this->factory->post->create_and_get( array( |
| 230 | 'post_type' => 'wptests_pt', |
| 231 | 'post_date' => '2012-03-01 12:00:00' |
| 232 | ) ); |
| 233 | |
| 234 | $post_four = $this->factory->post->create_and_get( array( |
| 235 | 'post_type' => 'wptests_pt', |
| 236 | 'post_date' => '2012-04-01 12:00:00' |
| 237 | ) ); |
| 238 | |
| 239 | // Test normal boundary post with pages |
| 240 | $this->go_to( get_permalink( $post_two->ID ) ); |
| 241 | |
| 242 | $this->assertEquals( array( $post_one ), get_boundary_post( false, '', true ) ); |
| 243 | $this->assertEquals( array( $post_four ), get_boundary_post( false, '', false ) ); |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * @ticket 27094 |
| 248 | */ |
| 249 | function test_get_adjacent_post_attachment() { |
| 250 | |
| 251 | // Need some sample pages to test adjacency |
| 252 | $attachment_one = $this->factory->attachment->create_and_get( array( |
| 253 | 'post_date' => '2012-01-01 12:00:00' |
| 254 | ) ); |
| 255 | |
| 256 | $attachment_two = $this->factory->attachment->create_and_get( array( |
| 257 | 'post_date' => '2012-02-01 12:00:00' |
| 258 | ) ); |
| 259 | |
| 260 | $attachment_three = $this->factory->attachment->create_and_get( array( |
| 261 | 'post_date' => '2012-03-01 12:00:00' |
| 262 | ) ); |
| 263 | |
| 264 | // Test normal boundary post with pages |
| 265 | $this->go_to( get_permalink( $attachment_two->ID ) ); |
| 266 | |
| 267 | $this->assertNull( get_boundary_post( false, '', true ) ); |
| 268 | $this->assertNull( get_boundary_post( false, '', false ) ); |
| 269 | } |
| 270 | |
| 271 | /** |