|
@@ 1006-1023 (lines=18) @@
|
| 1003 |
|
/** |
| 1004 |
|
* @ticket 24674 |
| 1005 |
|
*/ |
| 1006 |
|
public function test_is_attachment_with_slug_that_begins_with_a_number_that_clashes_with_a_page_ID() |
| 1007 |
|
{ |
| 1008 |
|
$p1 = self::factory()->post->create(array( 'post_type' => 'attachment' )); |
| 1009 |
|
|
| 1010 |
|
$p2_name = $p1 . '-attachment'; |
| 1011 |
|
$p2 = self::factory()->post->create( |
| 1012 |
|
array( |
| 1013 |
|
'post_type' => 'attachment', |
| 1014 |
|
'post_name' => $p2_name, |
| 1015 |
|
) |
| 1016 |
|
); |
| 1017 |
|
|
| 1018 |
|
$this->go_to("/?attachment_id=$p1"); |
| 1019 |
|
|
| 1020 |
|
$q = $GLOBALS['wp_query']; |
| 1021 |
|
|
| 1022 |
|
$this->assertTrue($q->is_attachment()); |
| 1023 |
|
$this->assertTrue($q->is_attachment($p1)); |
| 1024 |
|
$this->assertFalse($q->is_attachment($p2_name)); |
| 1025 |
|
$this->assertFalse($q->is_attachment($p2)); |
| 1026 |
|
} |
|
@@ 1126-1143 (lines=18) @@
|
| 1123 |
|
/** |
| 1124 |
|
* @ticket 24674 |
| 1125 |
|
*/ |
| 1126 |
|
public function test_is_page_with_page_slug_that_begins_with_a_number_that_clashes_with_a_page_ID() |
| 1127 |
|
{ |
| 1128 |
|
$p1 = self::factory()->post->create(array( 'post_type' => 'page' )); |
| 1129 |
|
|
| 1130 |
|
$p2_name = $p1 . '-page'; |
| 1131 |
|
$p2 = self::factory()->post->create( |
| 1132 |
|
array( |
| 1133 |
|
'post_type' => 'page', |
| 1134 |
|
'post_name' => $p2_name, |
| 1135 |
|
) |
| 1136 |
|
); |
| 1137 |
|
|
| 1138 |
|
$this->go_to("/?page_id=$p1"); |
| 1139 |
|
|
| 1140 |
|
$q = $GLOBALS['wp_query']; |
| 1141 |
|
|
| 1142 |
|
$this->assertTrue($q->is_page()); |
| 1143 |
|
$this->assertTrue($q->is_page($p1)); |
| 1144 |
|
$this->assertFalse($q->is_page($p2_name)); |
| 1145 |
|
$this->assertFalse($q->is_page($p2)); |
| 1146 |
|
} |