|
@@ 1185-1208 (lines=24) @@
|
| 1182 |
|
$this->assertEqualSetsWithIndex($expected, $found); |
| 1183 |
|
} |
| 1184 |
|
|
| 1185 |
|
public function test_get_terms_hierarchical_tax_hide_empty_false_fields_idslug() |
| 1186 |
|
{ |
| 1187 |
|
// Set up a clean taxonomy. |
| 1188 |
|
$tax = 'hierarchical_fields'; |
| 1189 |
|
register_taxonomy($tax, 'post', array( 'hierarchical' => true )); |
| 1190 |
|
|
| 1191 |
|
$terms = $this->create_hierarchical_terms_and_posts(); |
| 1192 |
|
|
| 1193 |
|
$found = get_terms( |
| 1194 |
|
$tax, array( |
| 1195 |
|
'hide_empty' => false, |
| 1196 |
|
'fields' => 'id=>slug', |
| 1197 |
|
) |
| 1198 |
|
); |
| 1199 |
|
|
| 1200 |
|
$expected = array( |
| 1201 |
|
$terms['parent1'] => 'parent-1', |
| 1202 |
|
$terms['parent2'] => 'parent-2', |
| 1203 |
|
$terms['child1'] => 'child-1', |
| 1204 |
|
$terms['child2'] => 'child-2', |
| 1205 |
|
$terms['grandchild1'] => 'grandchild-1', |
| 1206 |
|
); |
| 1207 |
|
|
| 1208 |
|
_unregister_taxonomy('hierarchical_fields'); |
| 1209 |
|
|
| 1210 |
|
$this->assertEqualSetsWithIndex($expected, $found); |
| 1211 |
|
} |
|
@@ 1268-1291 (lines=24) @@
|
| 1265 |
|
$this->assertEqualSetsWithIndex($expected, $found); |
| 1266 |
|
} |
| 1267 |
|
|
| 1268 |
|
public function test_get_terms_hierarchical_tax_hide_empty_false_fields_idname() |
| 1269 |
|
{ |
| 1270 |
|
// Set up a clean taxonomy. |
| 1271 |
|
$tax = 'hierarchical_fields'; |
| 1272 |
|
register_taxonomy($tax, 'post', array( 'hierarchical' => true )); |
| 1273 |
|
|
| 1274 |
|
$terms = $this->create_hierarchical_terms_and_posts(); |
| 1275 |
|
|
| 1276 |
|
$found = get_terms( |
| 1277 |
|
$tax, array( |
| 1278 |
|
'hide_empty' => false, |
| 1279 |
|
'fields' => 'id=>name', |
| 1280 |
|
) |
| 1281 |
|
); |
| 1282 |
|
|
| 1283 |
|
$expected = array( |
| 1284 |
|
$terms['parent1'] => 'Parent 1', |
| 1285 |
|
$terms['parent2'] => 'Parent 2', |
| 1286 |
|
$terms['child1'] => 'Child 1', |
| 1287 |
|
$terms['child2'] => 'Child 2', |
| 1288 |
|
$terms['grandchild1'] => 'Grandchild 1', |
| 1289 |
|
); |
| 1290 |
|
|
| 1291 |
|
_unregister_taxonomy('hierarchical_fields'); |
| 1292 |
|
|
| 1293 |
|
$this->assertEqualSetsWithIndex($expected, $found); |
| 1294 |
|
} |