| | 685 | function test_attachment_and_child_page_name_conflict() { |
| | 686 | // Bug - http://core.trac.wordpress.org/ticket/15665 |
| | 687 | // Page name won't work if the parent page has an attachment with the same name |
| | 688 | $this->_insert_quick_posts(1, 'page'); |
| | 689 | |
| | 690 | $parent_page_id = $this->post_ids[-1]; |
| | 691 | // Give it an attachment |
| | 692 | $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' ); |
| | 693 | $contents = file_get_contents($filename); |
| | 694 | |
| | 695 | $upload = wp_upload_bits(basename($filename), null, $contents); |
| | 696 | $this->assertTrue( empty($upload['error']) ); |
| | 697 | |
| | 698 | $attachment_id = $this->_make_attachment($upload, $parent_page_id); |
| | 699 | |
| | 700 | $child_page_id = $this->post_ids[] = wp_insert_post(array( |
| | 701 | 'post_author' => $this->author->ID, |
| | 702 | 'post_status' => 'publish', |
| | 703 | 'post_title' => basename($filename), |
| | 704 | 'post_content' => 'child page content', |
| | 705 | 'post_excerpt' => 'child page excerpt', |
| | 706 | 'post_type' => 'page' |
| | 707 | )); |
| | 708 | $this->http(get_permalink($child_page_id)); |
| | 709 | $this->assertTrue(is_page(), 'failed is_page'); |
| | 710 | $this->assertTrue(have_posts(), 'no posts found querying child page id permalink'); |
| | 711 | $this->assertNull(the_post(), 'error loading queried post'); |
| | 712 | $this->assertEquals($child_page_id, get_the_ID(), 'child page id does not equal found post id'); |
| | 713 | $this->assertEquals('child page excerpt', strip_tags(strip_ws(get_echo('the_excerpt'))), 'the child page excerpt and the queried page excerpt do not match'); |
| | 714 | } |