| | 136 | |
| | 137 | /** |
| | 138 | * @ticket 32454 |
| | 139 | */ |
| | 140 | public function test_querystring_query_taxonomy_term_single() { |
| | 141 | register_taxonomy( 'test_tax_cat', 'post' ); |
| | 142 | |
| | 143 | wp_insert_term( "test1", 'test_tax_cat' ); |
| | 144 | wp_insert_term( "test2", 'test_tax_cat' ); |
| | 145 | wp_insert_term( "test3", 'test_tax_cat' ); |
| | 146 | |
| | 147 | $p1 = $this->factory->post->create(); |
| | 148 | $p2 = $this->factory->post->create(); |
| | 149 | $p3 = $this->factory->post->create(); |
| | 150 | |
| | 151 | wp_set_object_terms( $p1, "test1", 'test_tax_cat' ); |
| | 152 | wp_set_object_terms( $p2, array( "test1", "test2" ), 'test_tax_cat' ); |
| | 153 | wp_set_object_terms( $p3, "test2", 'test_tax_cat' ); |
| | 154 | |
| | 155 | $url = add_query_arg( |
| | 156 | array( |
| | 157 | 'test_tax_cat' => 'test1', |
| | 158 | ), '/' |
| | 159 | ); |
| | 160 | |
| | 161 | $this->go_to( $url ); |
| | 162 | |
| | 163 | $q = $GLOBALS['wp_query']; |
| | 164 | $posts = array(); |
| | 165 | |
| | 166 | foreach ( $q->posts as $post ) { |
| | 167 | $posts[] = $post->ID; |
| | 168 | } |
| | 169 | |
| | 170 | $this->assertEquals( array( $p1, $p2), $posts ); |
| | 171 | } |
| | 172 | |
| | 173 | /** |
| | 174 | * @ticket 32454 |
| | 175 | */ |
| | 176 | public function test_querystring_query_taxonomy_term_multiple() { |
| | 177 | register_taxonomy( 'test_tax_cat', 'post' ); |
| | 178 | |
| | 179 | wp_insert_term( "test1", 'test_tax_cat' ); |
| | 180 | wp_insert_term( "test2", 'test_tax_cat' ); |
| | 181 | wp_insert_term( "test3", 'test_tax_cat' ); |
| | 182 | |
| | 183 | $p1 = $this->factory->post->create(); |
| | 184 | $p2 = $this->factory->post->create(); |
| | 185 | $p3 = $this->factory->post->create(); |
| | 186 | $p4 = $this->factory->post->create(); |
| | 187 | |
| | 188 | wp_set_object_terms( $p1, "test1", 'test_tax_cat' ); |
| | 189 | wp_set_object_terms( $p2, array( "test1", "test2" ), 'test_tax_cat' ); |
| | 190 | wp_set_object_terms( $p3, "test2", 'test_tax_cat' ); |
| | 191 | wp_set_object_terms( $p4, "test3", 'test_tax_cat' ); |
| | 192 | |
| | 193 | $url = add_query_arg( |
| | 194 | array( |
| | 195 | 'test_tax_cat' => array('test1','test2'), |
| | 196 | ), '/' |
| | 197 | ); |
| | 198 | |
| | 199 | $this->go_to( $url ); |
| | 200 | |
| | 201 | $q = $GLOBALS['wp_query']; |
| | 202 | $posts = array(); |
| | 203 | |
| | 204 | foreach ( $q->posts as $post ) { |
| | 205 | $posts[] = $post->ID; |
| | 206 | } |
| | 207 | |
| | 208 | $this->assertEquals( array( $p1, $p2, $p3), $posts ); |
| | 209 | } |