mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-06 23:58:03 +00:00
Tests: Use the function get_num_queries across all unit tests.
Replace use of `$wpdb->num_queries` with a function call to `get_num_queries`. This improves readability and consistency between tests. Props SergeyBiryukov, peterwilsoncc, spacedmonkey. See #57841. git-svn-id: https://develop.svn.wordpress.org/trunk@55745 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -101,8 +101,6 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_get_term_should_update_term_cache_when_passed_an_object() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$term = self::factory()->term->create(
|
||||
array(
|
||||
@@ -116,7 +114,7 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
// Affirm that the cache is empty.
|
||||
$this->assertEmpty( wp_cache_get( $term, 'terms' ) );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// get_term() will only be update the cache if the 'filter' prop is unset.
|
||||
unset( $term_object->filter );
|
||||
@@ -124,13 +122,11 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
$term_object_2 = get_term( $term_object, 'wptests_tax' );
|
||||
|
||||
// No new queries should have fired.
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
$this->assertSame( $term_object, $term_object_2 );
|
||||
}
|
||||
|
||||
public function test_get_term_should_update_term_cache_when_passed_a_valid_term_identifier() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$term = self::factory()->term->create(
|
||||
array(
|
||||
@@ -143,23 +139,21 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
// Affirm that the cache is empty.
|
||||
$this->assertEmpty( wp_cache_get( $term, 'terms' ) );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// Prime cache.
|
||||
$term_object = get_term( $term, 'wptests_tax' );
|
||||
$this->assertNotEmpty( wp_cache_get( $term, 'terms' ) );
|
||||
$this->assertSame( $num_queries + 1, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 1, get_num_queries() );
|
||||
|
||||
$term_object_2 = get_term( $term, 'wptests_tax' );
|
||||
|
||||
// No new queries should have fired.
|
||||
$this->assertSame( $num_queries + 1, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 1, get_num_queries() );
|
||||
$this->assertEquals( $term_object, $term_object_2 );
|
||||
}
|
||||
|
||||
public function test_get_term_by_should_update_term_cache_when_passed_a_valid_term_identifier() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$term = self::factory()->term->create(
|
||||
array(
|
||||
@@ -172,17 +166,17 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
// Affirm that the cache is empty.
|
||||
$this->assertEmpty( wp_cache_get( $term, 'terms' ) );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// Prime cache.
|
||||
$term_object = get_term_by( 'id', $term, 'wptests_tax' );
|
||||
$this->assertNotEmpty( wp_cache_get( $term, 'terms' ) );
|
||||
$this->assertSame( $num_queries + 1, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 1, get_num_queries() );
|
||||
|
||||
$term_object_2 = get_term( $term, 'wptests_tax' );
|
||||
|
||||
// No new queries should have fired.
|
||||
$this->assertSame( $num_queries + 1, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 1, get_num_queries() );
|
||||
$this->assertEquals( $term_object, $term_object_2 );
|
||||
}
|
||||
|
||||
@@ -190,8 +184,6 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
* @ticket 30749
|
||||
*/
|
||||
public function test_get_terms_should_update_cache_for_located_terms() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
|
||||
$terms = self::factory()->term->create_many(
|
||||
@@ -208,13 +200,13 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
foreach ( $terms as $term_id ) {
|
||||
get_term( $term_id, 'wptests_tax' );
|
||||
}
|
||||
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
_unregister_taxonomy( 'wptests_tax' );
|
||||
}
|
||||
@@ -242,8 +234,6 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
* @ticket 21760
|
||||
*/
|
||||
public function test_get_term_by_slug_cache() {
|
||||
global $wpdb;
|
||||
|
||||
$term_id = self::factory()->term->create(
|
||||
array(
|
||||
'slug' => 'burrito',
|
||||
@@ -253,28 +243,26 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
clean_term_cache( $term_id, 'post_tag' );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
$term = get_term_by( 'slug', 'burrito', 'post_tag' );
|
||||
$num_queries = $num_queries + 2;
|
||||
$this->assertSame( 'Taco', $term->name );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
// This should now hit cache.
|
||||
$term = get_term_by( 'slug', 'burrito', 'post_tag' );
|
||||
$this->assertSame( 'Taco', $term->name );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
$this->assertEquals( get_term( $term_id, 'post_tag' ), $term );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 21760
|
||||
*/
|
||||
public function test_get_term_by_slug_cache_update() {
|
||||
global $wpdb;
|
||||
|
||||
$term_id = self::factory()->term->create(
|
||||
array(
|
||||
'slug' => 'burrito',
|
||||
@@ -284,35 +272,33 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
clean_term_cache( $term_id, 'post_tag' );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
$term = get_term_by( 'slug', 'burrito', 'post_tag' );
|
||||
$num_queries = $num_queries + 2;
|
||||
$this->assertSame( 'Taco', $term->name );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
// This should now hit cache.
|
||||
$term = get_term_by( 'slug', 'burrito', 'post_tag' );
|
||||
$this->assertSame( 'Taco', $term->name );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
// Update the tag which invalidates the cache.
|
||||
wp_update_term( $term_id, 'post_tag', array( 'name' => 'No Taco' ) );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// This should not hit cache.
|
||||
$term = get_term_by( 'slug', 'burrito', 'post_tag' );
|
||||
$num_queries = $num_queries + 2;
|
||||
$this->assertSame( 'No Taco', $term->name );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 21760
|
||||
*/
|
||||
public function test_get_term_by_name_cache() {
|
||||
global $wpdb;
|
||||
|
||||
$term_id = self::factory()->term->create(
|
||||
array(
|
||||
'name' => 'Burrito',
|
||||
@@ -322,26 +308,24 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
clean_term_cache( $term_id, 'post_tag' );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
get_term_by( 'name', 'Burrito', 'post_tag' );
|
||||
$num_queries = $num_queries + 2;
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
// This should now hit cache.
|
||||
$term = get_term_by( 'name', 'Burrito', 'post_tag' );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
$this->assertEquals( get_term( $term_id, 'post_tag' ), $term );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 21760
|
||||
*/
|
||||
public function test_get_term_by_name_cache_update() {
|
||||
global $wpdb;
|
||||
|
||||
$term_id = self::factory()->term->create(
|
||||
array(
|
||||
'name' => 'Burrito',
|
||||
@@ -351,32 +335,30 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
clean_term_cache( $term_id, 'post_tag' );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
get_term_by( 'name', 'Burrito', 'post_tag' );
|
||||
$num_queries = $num_queries + 2;
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
// This should now hit cache.
|
||||
get_term_by( 'name', 'Burrito', 'post_tag' );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
// Update the tag which invalidates the cache.
|
||||
wp_update_term( $term_id, 'post_tag', array( 'slug' => 'taco' ) );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// This should not hit cache.
|
||||
get_term_by( 'name', 'burrito', 'post_tag' );
|
||||
$num_queries = $num_queries + 2;
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 21760
|
||||
*/
|
||||
public function test_invalidating_term_caches_should_fail_when_invalidation_is_suspended() {
|
||||
global $wpdb;
|
||||
|
||||
$term_id = self::factory()->term->create(
|
||||
array(
|
||||
'name' => 'Burrito',
|
||||
@@ -385,7 +367,7 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
clean_term_cache( $term_id, 'post_tag' );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$last_changed = wp_cache_get( 'last_changed', 'terms' );
|
||||
|
||||
$term1 = get_term_by( 'name', 'Burrito', 'post_tag' );
|
||||
@@ -393,18 +375,18 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
|
||||
// Verify the term is cached.
|
||||
$term2 = get_term_by( 'name', 'Burrito', 'post_tag' );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
$this->assertEquals( $term1, $term2 );
|
||||
|
||||
$suspend = wp_suspend_cache_invalidation();
|
||||
|
||||
// Update the tag.
|
||||
wp_update_term( $term_id, 'post_tag', array( 'name' => 'Taco' ) );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// Verify that the cached term still matches the initial cached term.
|
||||
$term3 = get_term_by( 'name', 'Burrito', 'post_tag' );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
$this->assertEquals( $term1, $term3 );
|
||||
|
||||
// Verify that last changed has not been updated as part of an invalidation routine.
|
||||
@@ -418,8 +400,6 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
* @ticket 21760
|
||||
*/
|
||||
public function test_get_term_by_does_not_prime_term_meta_cache() {
|
||||
global $wpdb;
|
||||
|
||||
$term_id = self::factory()->term->create(
|
||||
array(
|
||||
'name' => 'Burrito',
|
||||
@@ -429,18 +409,18 @@ class Tests_Term_Cache extends WP_UnitTestCase {
|
||||
add_term_meta( $term_id, 'foo', 'bar' );
|
||||
|
||||
clean_term_cache( $term_id, 'post_tag' );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
$term = get_term_by( 'name', 'Burrito', 'post_tag' );
|
||||
$num_queries = $num_queries + 2;
|
||||
$this->assertInstanceOf( 'WP_Term', $term );
|
||||
$this->assertSame( $term_id, $term->term_id );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
$term_meta = get_term_meta( $term_id, 'foo', true );
|
||||
$num_queries++;
|
||||
$this->assertSame( $term_meta, 'bar' );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,17 +60,15 @@ class Tests_Term_GetTerm extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_passing_term_object_should_skip_database_query_when_filter_property_is_empty() {
|
||||
global $wpdb;
|
||||
|
||||
$term = self::factory()->term->create_and_get( array( 'taxonomy' => 'wptests_tax' ) );
|
||||
clean_term_cache( $term->term_id, 'wptests_tax' );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
unset( $term->filter );
|
||||
$term_a = get_term( $term, 'wptests_tax' );
|
||||
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
public function test_passing_term_string_that_casts_to_int_0_should_return_null() {
|
||||
@@ -82,18 +80,16 @@ class Tests_Term_GetTerm extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_cache_should_be_populated_by_successful_fetch() {
|
||||
global $wpdb;
|
||||
|
||||
$t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) );
|
||||
clean_term_cache( $t, 'wptests_tax' );
|
||||
|
||||
// Prime cache.
|
||||
$term_a = get_term( $t, 'wptests_tax' );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// Second call shouldn't require a database query.
|
||||
$term_b = get_term( $t, 'wptests_tax' );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
$this->assertEquals( $term_a, $term_b );
|
||||
}
|
||||
|
||||
@@ -196,19 +192,17 @@ class Tests_Term_GetTerm extends WP_UnitTestCase {
|
||||
* @ticket 34533
|
||||
*/
|
||||
public function test_shared_term_in_cache_should_be_ignored_when_specifying_a_different_taxonomy() {
|
||||
global $wpdb;
|
||||
|
||||
$terms = $this->generate_shared_terms();
|
||||
|
||||
// Prime cache for 'wptests_tax'.
|
||||
get_term( $terms[0]['term_id'], 'wptests_tax' );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// Database should be hit again.
|
||||
$found = get_term( $terms[1]['term_id'], 'wptests_tax_2' );
|
||||
$num_queries++;
|
||||
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
$this->assertInstanceOf( 'WP_Term', $found );
|
||||
$this->assertSame( 'wptests_tax_2', $found->taxonomy );
|
||||
}
|
||||
|
||||
@@ -111,8 +111,6 @@ class Tests_Term_GetTermBy extends WP_UnitTestCase {
|
||||
* @ticket 14162
|
||||
*/
|
||||
public function test_should_prime_term_cache() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$t = self::factory()->term->create(
|
||||
array(
|
||||
@@ -123,18 +121,18 @@ class Tests_Term_GetTermBy extends WP_UnitTestCase {
|
||||
|
||||
clean_term_cache( $t, 'wptests_tax' );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$found = get_term_by( 'slug', 'foo', 'wptests_tax' );
|
||||
$num_queries = $num_queries + 2;
|
||||
|
||||
$this->assertInstanceOf( 'WP_Term', $found );
|
||||
$this->assertSame( $t, $found->term_id );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
// Calls to `get_term()` should now hit cache.
|
||||
$found2 = get_term( $t );
|
||||
$this->assertSame( $t, $found->term_id );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -134,26 +134,24 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
* @ticket 23326
|
||||
*/
|
||||
public function test_get_terms_cache() {
|
||||
global $wpdb;
|
||||
|
||||
$this->set_up_three_posts_and_tags();
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// last_changed and num_queries should bump.
|
||||
$terms = get_terms( 'post_tag', array( 'update_term_meta_cache' => false ) );
|
||||
$this->assertCount( 3, $terms );
|
||||
$time1 = wp_cache_get( 'last_changed', 'terms' );
|
||||
$this->assertNotEmpty( $time1 );
|
||||
$this->assertSame( $num_queries + 2, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 2, get_num_queries() );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// Again. last_changed and num_queries should remain the same.
|
||||
$terms = get_terms( 'post_tag', array( 'update_term_meta_cache' => false ) );
|
||||
$this->assertCount( 3, $terms );
|
||||
$this->assertSame( $time1, wp_cache_get( 'last_changed', 'terms' ) );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,21 +165,21 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
// Prime cache.
|
||||
$terms = get_terms( 'post_tag' );
|
||||
$time1 = wp_cache_get( 'last_changed', 'terms' );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// num_queries should bump, last_changed should remain the same.
|
||||
$terms = get_terms( 'post_tag', array( 'number' => 2 ) );
|
||||
$this->assertCount( 2, $terms );
|
||||
$this->assertSame( $time1, wp_cache_get( 'last_changed', 'terms' ) );
|
||||
$this->assertSame( $num_queries + 1, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 1, get_num_queries() );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// Again. last_changed and num_queries should remain the same.
|
||||
$terms = get_terms( 'post_tag', array( 'number' => 2 ) );
|
||||
$this->assertCount( 2, $terms );
|
||||
$this->assertSame( $time1, wp_cache_get( 'last_changed', 'terms' ) );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,12 +193,12 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
// Prime cache.
|
||||
$terms = get_terms( 'post_tag' );
|
||||
$time1 = wp_cache_get( 'last_changed', 'terms' );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// Force last_changed to bump.
|
||||
wp_delete_term( $terms[0]->term_id, 'post_tag' );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$time2 = wp_cache_get( 'last_changed', 'terms' );
|
||||
$this->assertNotEquals( $time1, $time2 );
|
||||
|
||||
@@ -208,15 +206,15 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
$terms = get_terms( 'post_tag' );
|
||||
$this->assertCount( 2, $terms );
|
||||
$this->assertSame( $time2, wp_cache_get( 'last_changed', 'terms' ) );
|
||||
$this->assertSame( $num_queries + 1, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 1, get_num_queries() );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
// Again. last_changed and num_queries should remain the same.
|
||||
$terms = get_terms( 'post_tag' );
|
||||
$this->assertCount( 2, $terms );
|
||||
$this->assertSame( $time2, wp_cache_get( 'last_changed', 'terms' ) );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
// @todo Repeat with term insert and update.
|
||||
}
|
||||
@@ -848,13 +846,11 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
* @ticket 31118
|
||||
*/
|
||||
public function test_child_of_should_skip_query_when_specified_parent_is_not_found_in_hierarchy_cache() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
|
||||
|
||||
$terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
$found = get_terms(
|
||||
'wptests_tax',
|
||||
@@ -865,7 +861,7 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
$this->assertEmpty( $found );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2473,13 +2469,11 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
* @ticket 31118
|
||||
*/
|
||||
public function test_parent_should_skip_query_when_specified_parent_is_not_found_in_hierarchy_cache() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
|
||||
|
||||
$terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
$found = get_terms(
|
||||
'wptests_tax',
|
||||
@@ -2490,7 +2484,7 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
$this->assertEmpty( $found );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2773,13 +2767,13 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
foreach ( $terms as $t ) {
|
||||
$this->assertSame( 'bar', get_term_meta( $t, 'foo', true ) );
|
||||
}
|
||||
|
||||
$this->assertSame( $num_queries + 1, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 1, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2803,13 +2797,13 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
foreach ( $terms as $t ) {
|
||||
$this->assertSame( 'bar', get_term_meta( $t, 'foo', true ) );
|
||||
}
|
||||
|
||||
$this->assertSame( $num_queries + 3, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 3, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2908,7 +2902,7 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
$found = get_terms(
|
||||
'wptests_tax',
|
||||
@@ -2918,7 +2912,7 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
$this->assertNotEmpty( $found );
|
||||
|
||||
@@ -2931,8 +2925,6 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
* @ticket 14162
|
||||
*/
|
||||
public function test_should_prime_individual_term_cache_when_fields_is_all() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
|
||||
|
||||
@@ -2944,9 +2936,9 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$term0 = get_term( $terms[0] );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -197,8 +197,6 @@ class Tests_Term_GetTheTerms extends WP_UnitTestCase {
|
||||
* @ticket 36814
|
||||
*/
|
||||
public function test_uncached_terms_should_be_primed_with_a_single_query() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
|
||||
$terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
|
||||
@@ -210,13 +208,13 @@ class Tests_Term_GetTheTerms extends WP_UnitTestCase {
|
||||
// Clean cache for two of the terms.
|
||||
clean_term_cache( array( $terms[0], $terms[1] ), 'wptests_tax', false );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$found = get_the_terms( self::$post_ids[0], 'wptests_tax' );
|
||||
|
||||
$this->assertSameSets( $terms, wp_list_pluck( $found, 'term_id' ) );
|
||||
|
||||
$num_queries++;
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -135,46 +135,42 @@ class Tests_IsObjectInTerm extends WP_UnitTestCase {
|
||||
* @ticket 32044
|
||||
*/
|
||||
public function test_should_populate_and_hit_relationships_cache() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
|
||||
|
||||
$o = 12345;
|
||||
wp_set_object_terms( $o, $terms[0], 'wptests_tax' );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$this->assertTrue( is_object_in_term( $o, 'wptests_tax', $terms[0] ) );
|
||||
$num_queries = $num_queries + 2;
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
$this->assertFalse( is_object_in_term( $o, 'wptests_tax', $terms[1] ) );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 32044
|
||||
*/
|
||||
public function test_should_not_be_fooled_by_a_stale_relationship_cache() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
|
||||
|
||||
$o = 12345;
|
||||
wp_set_object_terms( $o, $terms[0], 'wptests_tax' );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$this->assertTrue( is_object_in_term( $o, 'wptests_tax', $terms[0] ) );
|
||||
$num_queries = $num_queries + 2;
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
wp_set_object_terms( $o, $terms[1], 'wptests_tax' );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$this->assertTrue( is_object_in_term( $o, 'wptests_tax', $terms[1] ) );
|
||||
$num_queries = $num_queries + 2;
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -114,8 +114,6 @@ class Tests_Term_Meta extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_term_meta_should_be_lazy_loaded_for_all_terms_in_wp_query_loop() {
|
||||
global $wpdb;
|
||||
|
||||
$p = self::factory()->post->create( array( 'post_status' => 'publish' ) );
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
@@ -139,20 +137,20 @@ class Tests_Term_Meta extends WP_UnitTestCase {
|
||||
the_post();
|
||||
|
||||
// First request will hit the database.
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$this->assertSame( 'bar', get_term_meta( $terms[0], 'foo', true ) );
|
||||
$num_queries++;
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
// Second and third requests should be in cache.
|
||||
$this->assertSame( 'bar', get_term_meta( $terms[1], 'foo', true ) );
|
||||
$this->assertSame( 'bar', get_term_meta( $terms[2], 'foo', true ) );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
// Querying a term not primed should result in a hit.
|
||||
$num_queries++;
|
||||
$this->assertSame( 'bar', get_term_meta( $orphan_term, 'foo', true ) );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,8 +184,6 @@ class Tests_Term_Meta extends WP_UnitTestCase {
|
||||
* @ticket 36593
|
||||
*/
|
||||
public function test_lazy_load_term_meta_false() {
|
||||
global $wpdb;
|
||||
|
||||
$p = self::factory()->post->create( array( 'post_status' => 'publish' ) );
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
@@ -210,14 +206,14 @@ class Tests_Term_Meta extends WP_UnitTestCase {
|
||||
$q->the_post();
|
||||
|
||||
// Requests will hit the database.
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$this->assertSame( 'bar', get_term_meta( $terms[0], 'foo', true ) );
|
||||
$num_queries++;
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
$this->assertSame( 'bar', get_term_meta( $terms[1], 'foo', true ) );
|
||||
$num_queries++;
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,8 +456,6 @@ class Tests_Term_Query extends WP_UnitTestCase {
|
||||
* @group cache
|
||||
*/
|
||||
public function test_count_query_should_be_cached() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax_1', 'post' );
|
||||
|
||||
$terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax_1' ) );
|
||||
@@ -472,7 +470,7 @@ class Tests_Term_Query extends WP_UnitTestCase {
|
||||
$count = $query->get_terms();
|
||||
$this->assertEquals( 2, $count );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
$query = new WP_Term_Query(
|
||||
array(
|
||||
@@ -483,7 +481,7 @@ class Tests_Term_Query extends WP_UnitTestCase {
|
||||
);
|
||||
$count = $query->get_terms();
|
||||
$this->assertEquals( 2, $count );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -803,11 +801,9 @@ class Tests_Term_Query extends WP_UnitTestCase {
|
||||
* @ticket 41246
|
||||
*/
|
||||
public function test_terms_pre_query_filter_should_bypass_database_query() {
|
||||
global $wpdb;
|
||||
|
||||
add_filter( 'terms_pre_query', array( __CLASS__, 'filter_terms_pre_query' ), 10, 2 );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
$q = new WP_Term_Query();
|
||||
$results = $q->query(
|
||||
@@ -819,7 +815,7 @@ class Tests_Term_Query extends WP_UnitTestCase {
|
||||
remove_filter( 'terms_pre_query', array( __CLASS__, 'filter_terms_pre_query' ), 10, 2 );
|
||||
|
||||
// Make sure no queries were executed.
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
// We manually inserted a non-existing term and overrode the results with it.
|
||||
$this->assertSame( array( 555 ), $q->terms );
|
||||
|
||||
@@ -320,7 +320,6 @@ class Tests_TermExists extends WP_UnitTestCase {
|
||||
* @covers ::term_exists()
|
||||
*/
|
||||
public function test_term_exists_caching() {
|
||||
global $wpdb;
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
|
||||
$slug = __FUNCTION__;
|
||||
@@ -331,14 +330,14 @@ class Tests_TermExists extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
$this->assertEquals( $t, term_exists( $slug ) );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$this->assertEquals( $t, term_exists( $slug ) );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
|
||||
$this->assertTrue( wp_delete_term( $t, 'wptests_tax' ) );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$this->assertNull( term_exists( $slug ) );
|
||||
$this->assertSame( $num_queries + 2, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 2, get_num_queries() );
|
||||
|
||||
// Clean up.
|
||||
_unregister_taxonomy( 'wptests_tax' );
|
||||
@@ -349,7 +348,6 @@ class Tests_TermExists extends WP_UnitTestCase {
|
||||
* @covers ::term_exists()
|
||||
*/
|
||||
public function test_term_exists_caching_suspend_cache_invalidation() {
|
||||
global $wpdb;
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
|
||||
wp_suspend_cache_invalidation( true );
|
||||
@@ -362,9 +360,9 @@ class Tests_TermExists extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
$this->assertEquals( $t, term_exists( $slug ) );
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$this->assertEquals( $t, term_exists( $slug ) );
|
||||
$this->assertSame( $num_queries + 1, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 1, get_num_queries() );
|
||||
wp_suspend_cache_invalidation( false );
|
||||
|
||||
// Clean up.
|
||||
|
||||
@@ -616,8 +616,6 @@ class Tests_Term_WpGetObjectTerms extends WP_UnitTestCase {
|
||||
* @ticket 10142
|
||||
*/
|
||||
public function test_termmeta_cache_should_be_lazy_loaded_by_default() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
|
||||
add_term_meta( $terms[0], 'foo', 'bar' );
|
||||
@@ -629,21 +627,19 @@ class Tests_Term_WpGetObjectTerms extends WP_UnitTestCase {
|
||||
|
||||
$found = wp_get_object_terms( $p, 'wptests_tax' );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
foreach ( $terms as $t ) {
|
||||
$this->assertSame( 'bar', get_term_meta( $t, 'foo', true ) );
|
||||
}
|
||||
|
||||
$this->assertSame( $num_queries + 1, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 1, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 10142
|
||||
*/
|
||||
public function test_termmeta_cache_should_not_be_primed_when_update_term_meta_cache_is_false() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
|
||||
add_term_meta( $terms[0], 'foo', 'bar' );
|
||||
@@ -661,21 +657,19 @@ class Tests_Term_WpGetObjectTerms extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
foreach ( $terms as $t ) {
|
||||
$this->assertSame( 'bar', get_term_meta( $t, 'foo', true ) );
|
||||
}
|
||||
|
||||
$this->assertSame( $num_queries + 3, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 3, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 36932
|
||||
*/
|
||||
public function test_termmeta_cache_should_be_primed_when_fields_is_all_with_object_id() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
|
||||
add_term_meta( $terms[0], 'foo', 'bar' );
|
||||
@@ -694,21 +688,19 @@ class Tests_Term_WpGetObjectTerms extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
foreach ( $terms as $t ) {
|
||||
$this->assertSame( 'bar', get_term_meta( $t, 'foo', true ) );
|
||||
}
|
||||
|
||||
$this->assertSame( $num_queries + 1, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 1, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 36932
|
||||
*/
|
||||
public function test_termmeta_cache_should_be_primed_when_fields_is_ids() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
|
||||
add_term_meta( $terms[0], 'foo', 'bar' );
|
||||
@@ -727,13 +719,13 @@ class Tests_Term_WpGetObjectTerms extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
|
||||
foreach ( $terms as $t ) {
|
||||
$this->assertSame( 'bar', get_term_meta( $t, 'foo', true ) );
|
||||
}
|
||||
|
||||
$this->assertSame( $num_queries + 1, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries + 1, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -816,8 +808,6 @@ class Tests_Term_WpGetObjectTerms extends WP_UnitTestCase {
|
||||
* @ticket 14162
|
||||
*/
|
||||
public function test_should_prime_cache_for_found_terms() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$p = self::factory()->post->create();
|
||||
$t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) );
|
||||
@@ -831,9 +821,9 @@ class Tests_Term_WpGetObjectTerms extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$term = get_term( $t );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -865,8 +855,6 @@ class Tests_Term_WpGetObjectTerms extends WP_UnitTestCase {
|
||||
* @ticket 14162
|
||||
*/
|
||||
public function test_term_cache_should_be_primed_for_all_taxonomies() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax1', 'post' );
|
||||
register_taxonomy( 'wptests_tax2', 'post' );
|
||||
$p = self::factory()->post->create();
|
||||
@@ -888,10 +876,10 @@ class Tests_Term_WpGetObjectTerms extends WP_UnitTestCase {
|
||||
|
||||
$this->assertSameSets( array( $t1, $t2 ), wp_list_pluck( $found, 'term_id' ) );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$num_queries = get_num_queries();
|
||||
$term1 = get_term( $t1 );
|
||||
$term2 = get_term( $t2 );
|
||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||
$this->assertSame( $num_queries, get_num_queries() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user