|
@@ 321-345 (lines=25) @@
|
| 318 |
|
/** |
| 319 |
|
* @ticket 25710 |
| 320 |
|
*/ |
| 321 |
|
function test_get_terms_exclude_tree() |
| 322 |
|
{ |
| 323 |
|
|
| 324 |
|
$term_id_uncategorized = get_option('default_category'); |
| 325 |
|
|
| 326 |
|
$term_id1 = self::factory()->category->create(); |
| 327 |
|
$term_id11 = self::factory()->category->create(array( 'parent' => $term_id1 )); |
| 328 |
|
$term_id2 = self::factory()->category->create(); |
| 329 |
|
$term_id22 = self::factory()->category->create(array( 'parent' => $term_id2 )); |
| 330 |
|
|
| 331 |
|
$terms = get_terms( |
| 332 |
|
'category', array( |
| 333 |
|
'exclude' => $term_id_uncategorized, |
| 334 |
|
'fields' => 'ids', |
| 335 |
|
'hide_empty' => false, |
| 336 |
|
) |
| 337 |
|
); |
| 338 |
|
$this->assertEquals(array( $term_id1, $term_id11, $term_id2, $term_id22 ), $terms); |
| 339 |
|
|
| 340 |
|
$terms = get_terms( |
| 341 |
|
'category', array( |
| 342 |
|
'fields' => 'ids', |
| 343 |
|
'exclude_tree' => "$term_id1,$term_id_uncategorized", |
| 344 |
|
'hide_empty' => false, |
| 345 |
|
) |
| 346 |
|
); |
| 347 |
|
|
| 348 |
|
$this->assertEquals(array( $term_id2, $term_id22 ), $terms); |
|
@@ 1399-1418 (lines=20) @@
|
| 1396 |
|
/** |
| 1397 |
|
* @ticket 23261 |
| 1398 |
|
*/ |
| 1399 |
|
public function test_orderby_include() |
| 1400 |
|
{ |
| 1401 |
|
$tax = 'wptests_tax'; |
| 1402 |
|
register_taxonomy($tax, 'post'); |
| 1403 |
|
|
| 1404 |
|
$t1 = self::factory()->term->create(array( 'taxonomy' => $tax )); |
| 1405 |
|
$t2 = self::factory()->term->create(array( 'taxonomy' => $tax )); |
| 1406 |
|
$t3 = self::factory()->term->create(array( 'taxonomy' => $tax )); |
| 1407 |
|
$t4 = self::factory()->term->create(array( 'taxonomy' => $tax )); |
| 1408 |
|
|
| 1409 |
|
$found = get_terms( |
| 1410 |
|
$tax, array( |
| 1411 |
|
'fields' => 'ids', |
| 1412 |
|
'include' => array( $t4, $t1, $t2 ), |
| 1413 |
|
'orderby' => 'include', |
| 1414 |
|
'hide_empty' => false, |
| 1415 |
|
) |
| 1416 |
|
); |
| 1417 |
|
|
| 1418 |
|
_unregister_taxonomy('wptests_tax'); |
| 1419 |
|
|
| 1420 |
|
$this->assertEquals(array( $t4, $t1, $t2 ), $found); |
| 1421 |
|
} |