| @@ 854-870 (lines=17) @@ | ||
| 851 | /** |
|
| 852 | * @ticket 24674 |
|
| 853 | */ |
|
| 854 | public function test_is_single_with_slug_that_begins_with_a_number_that_clashes_with_another_post_id() |
|
| 855 | { |
|
| 856 | $p1 = self::factory()->post->create(); |
|
| 857 | ||
| 858 | $p2_name = $p1 . '-post'; |
|
| 859 | $p2 = self::factory()->post->create( |
|
| 860 | array( |
|
| 861 | 'slug' => $p2_name, |
|
| 862 | ) |
|
| 863 | ); |
|
| 864 | ||
| 865 | $this->go_to("/?p=$p1"); |
|
| 866 | ||
| 867 | $q = $GLOBALS['wp_query']; |
|
| 868 | ||
| 869 | $this->assertTrue($q->is_single()); |
|
| 870 | $this->assertTrue($q->is_single($p1)); |
|
| 871 | $this->assertFalse($q->is_single($p2_name)); |
|
| 872 | $this->assertFalse($q->is_single($p2)); |
|
| 873 | } |
|
| @@ 1031-1047 (lines=17) @@ | ||
| 1028 | /** |
|
| 1029 | * @ticket 24674 |
|
| 1030 | */ |
|
| 1031 | public function test_is_author_with_nicename_that_begins_with_a_number_that_clashes_with_another_author_id() |
|
| 1032 | { |
|
| 1033 | $u1 = self::factory()->user->create(); |
|
| 1034 | ||
| 1035 | $u2_name = $u1 . '_user'; |
|
| 1036 | $u2 = self::factory()->user->create( |
|
| 1037 | array( |
|
| 1038 | 'user_nicename' => $u2_name, |
|
| 1039 | ) |
|
| 1040 | ); |
|
| 1041 | ||
| 1042 | $this->go_to("/?author=$u1"); |
|
| 1043 | ||
| 1044 | $q = $GLOBALS['wp_query']; |
|
| 1045 | ||
| 1046 | $this->assertTrue($q->is_author()); |
|
| 1047 | $this->assertTrue($q->is_author($u1)); |
|
| 1048 | $this->assertFalse($q->is_author($u2_name)); |
|
| 1049 | $this->assertFalse($q->is_author($u2)); |
|
| 1050 | } |
|
| @@ 1055-1071 (lines=17) @@ | ||
| 1052 | /** |
|
| 1053 | * @ticket 24674 |
|
| 1054 | */ |
|
| 1055 | public function test_is_category_with_slug_that_begins_with_a_number_that_clashes_with_another_category_id() |
|
| 1056 | { |
|
| 1057 | $c1 = self::factory()->category->create(); |
|
| 1058 | ||
| 1059 | $c2_name = $c1 . '-category'; |
|
| 1060 | $c2 = self::factory()->category->create( |
|
| 1061 | array( |
|
| 1062 | 'slug' => $c2_name, |
|
| 1063 | ) |
|
| 1064 | ); |
|
| 1065 | ||
| 1066 | $this->go_to("/?cat=$c1"); |
|
| 1067 | ||
| 1068 | $q = $GLOBALS['wp_query']; |
|
| 1069 | ||
| 1070 | $this->assertTrue($q->is_category()); |
|
| 1071 | $this->assertTrue($q->is_category($c1)); |
|
| 1072 | $this->assertFalse($q->is_category($c2_name)); |
|
| 1073 | $this->assertFalse($q->is_category($c2)); |
|
| 1074 | } |
|
| @@ 1079-1095 (lines=17) @@ | ||
| 1076 | /** |
|
| 1077 | * @ticket 24674 |
|
| 1078 | */ |
|
| 1079 | public function test_is_tag_with_slug_that_begins_with_a_number_that_clashes_with_another_tag_id() |
|
| 1080 | { |
|
| 1081 | $t1 = self::factory()->tag->create(); |
|
| 1082 | ||
| 1083 | $t2_name = $t1 . '-tag'; |
|
| 1084 | $t2 = self::factory()->tag->create( |
|
| 1085 | array( |
|
| 1086 | 'slug' => $t2_name, |
|
| 1087 | ) |
|
| 1088 | ); |
|
| 1089 | ||
| 1090 | $this->go_to("/?tag_id=$t1"); |
|
| 1091 | ||
| 1092 | $q = $GLOBALS['wp_query']; |
|
| 1093 | ||
| 1094 | $this->assertTrue($q->is_tag()); |
|
| 1095 | $this->assertTrue($q->is_tag($t1)); |
|
| 1096 | $this->assertFalse($q->is_tag($t2_name)); |
|
| 1097 | $this->assertFalse($q->is_tag($t2)); |
|
| 1098 | } |
|