|
@@ 512-528 (lines=17) @@
|
| 509 |
|
/** |
| 510 |
|
* @ticket 31118 |
| 511 |
|
*/ |
| 512 |
|
public function test_child_of_should_skip_query_when_specified_parent_is_not_found_in_hierarchy_cache() |
| 513 |
|
{ |
| 514 |
|
global $wpdb; |
| 515 |
|
|
| 516 |
|
register_taxonomy('wptests_tax', 'post', array( 'hierarchical' => true, )); |
| 517 |
|
|
| 518 |
|
$terms = self::factory()->term->create_many(3, array( 'taxonomy' => 'wptests_tax' )); |
| 519 |
|
|
| 520 |
|
$num_queries = $wpdb->num_queries; |
| 521 |
|
|
| 522 |
|
$found = get_terms( |
| 523 |
|
'wptests_tax', array( |
| 524 |
|
'hide_empty' => false, |
| 525 |
|
'child_of' => $terms[0], |
| 526 |
|
) |
| 527 |
|
); |
| 528 |
|
|
| 529 |
|
$this->assertEmpty($found); |
| 530 |
|
$this->assertSame($num_queries, $wpdb->num_queries); |
| 531 |
|
} |
|
@@ 1978-1994 (lines=17) @@
|
| 1975 |
|
/** |
| 1976 |
|
* @ticket 31118 |
| 1977 |
|
*/ |
| 1978 |
|
public function test_parent_should_skip_query_when_specified_parent_is_not_found_in_hierarchy_cache() |
| 1979 |
|
{ |
| 1980 |
|
global $wpdb; |
| 1981 |
|
|
| 1982 |
|
register_taxonomy('wptests_tax', 'post', array( 'hierarchical' => true, )); |
| 1983 |
|
|
| 1984 |
|
$terms = self::factory()->term->create_many(3, array( 'taxonomy' => 'wptests_tax' )); |
| 1985 |
|
|
| 1986 |
|
$num_queries = $wpdb->num_queries; |
| 1987 |
|
|
| 1988 |
|
$found = get_terms( |
| 1989 |
|
'wptests_tax', array( |
| 1990 |
|
'hide_empty' => false, |
| 1991 |
|
'parent' => $terms[0], |
| 1992 |
|
) |
| 1993 |
|
); |
| 1994 |
|
|
| 1995 |
|
$this->assertEmpty($found); |
| 1996 |
|
$this->assertSame($num_queries, $wpdb->num_queries); |
| 1997 |
|
} |
|
@@ 2355-2370 (lines=16) @@
|
| 2352 |
|
/** |
| 2353 |
|
* @ticket 14162 |
| 2354 |
|
*/ |
| 2355 |
|
public function test_should_prime_individual_term_cache_when_fields_is_all() |
| 2356 |
|
{ |
| 2357 |
|
global $wpdb; |
| 2358 |
|
|
| 2359 |
|
register_taxonomy('wptests_tax', 'post'); |
| 2360 |
|
$terms = self::factory()->term->create_many(2, array( 'taxonomy' => 'wptests_tax' )); |
| 2361 |
|
|
| 2362 |
|
$found = get_terms( |
| 2363 |
|
'wptests_tax', array( |
| 2364 |
|
'hide_empty' => false, |
| 2365 |
|
'fields' => 'all', |
| 2366 |
|
) |
| 2367 |
|
); |
| 2368 |
|
|
| 2369 |
|
$num_queries = $wpdb->num_queries; |
| 2370 |
|
$term0 = get_term($terms[0]); |
| 2371 |
|
$this->assertSame($num_queries, $wpdb->num_queries); |
| 2372 |
|
|
| 2373 |
|
} |