| @@ 2420-2434 (lines=15) @@ | ||
| 2417 | /** |
|
| 2418 | * @ticket 35935 |
|
| 2419 | */ |
|
| 2420 | public function test_hierarchical_offset_plus_number() |
|
| 2421 | { |
|
| 2422 | register_taxonomy('wptests_tax', 'post', array( 'hierarchical' => true )); |
|
| 2423 | ||
| 2424 | $terms = self::factory()->term->create_many(3, array( 'taxonomy' => 'wptests_tax' )); |
|
| 2425 | ||
| 2426 | $found = get_terms( |
|
| 2427 | 'wptests_tax', array( |
|
| 2428 | 'number' => 1, |
|
| 2429 | 'offset' => 1, |
|
| 2430 | 'hide_empty' => false, |
|
| 2431 | 'fields' => 'ids', |
|
| 2432 | 'orderby' => 'term_id', |
|
| 2433 | 'order' => 'ASC', |
|
| 2434 | ) |
|
| 2435 | ); |
|
| 2436 | $this->assertEqualSets(array( $terms[1] ), $found); |
|
| 2437 | } |
|
| @@ 2442-2456 (lines=15) @@ | ||
| 2439 | /** |
|
| 2440 | * @ticket 35935 |
|
| 2441 | */ |
|
| 2442 | public function test_hierarchical_offset_plus_number_exceeds_available_count() |
|
| 2443 | { |
|
| 2444 | register_taxonomy('wptests_tax', 'post', array( 'hierarchical' => true )); |
|
| 2445 | ||
| 2446 | $terms = self::factory()->term->create_many(2, array( 'taxonomy' => 'wptests_tax' )); |
|
| 2447 | ||
| 2448 | $found = get_terms( |
|
| 2449 | 'wptests_tax', array( |
|
| 2450 | 'number' => 2, |
|
| 2451 | 'offset' => 1, |
|
| 2452 | 'hide_empty' => false, |
|
| 2453 | 'fields' => 'ids', |
|
| 2454 | 'orderby' => 'term_id', |
|
| 2455 | 'order' => 'ASC', |
|
| 2456 | ) |
|
| 2457 | ); |
|
| 2458 | $this->assertEqualSets(array( $terms[1] ), $found); |
|
| 2459 | } |
|
| @@ 2464-2478 (lines=15) @@ | ||
| 2461 | /** |
|
| 2462 | * @ticket 35935 |
|
| 2463 | */ |
|
| 2464 | public function test_hierarchical_offset_exceeds_available_count() |
|
| 2465 | { |
|
| 2466 | register_taxonomy('wptests_tax', 'post', array( 'hierarchical' => true )); |
|
| 2467 | ||
| 2468 | $terms = self::factory()->term->create_many(2, array( 'taxonomy' => 'wptests_tax' )); |
|
| 2469 | ||
| 2470 | $found = get_terms( |
|
| 2471 | 'wptests_tax', array( |
|
| 2472 | 'number' => 100, |
|
| 2473 | 'offset' => 3, |
|
| 2474 | 'hide_empty' => false, |
|
| 2475 | 'fields' => 'ids', |
|
| 2476 | 'orderby' => 'term_id', |
|
| 2477 | 'order' => 'ASC', |
|
| 2478 | ) |
|
| 2479 | ); |
|
| 2480 | $this->assertEqualSets(array(), $found); |
|
| 2481 | } |
|