Reintroduce term meta unit test accidentally removed in [36566].
git-svn-id: https://develop.svn.wordpress.org/trunk@36567 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
28fad09b61
commit
0e9ff07da5
@ -150,6 +150,41 @@ class Tests_Term_Meta extends WP_UnitTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_adding_term_meta_should_bust_get_terms_cache() {
|
||||||
|
$terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
|
||||||
|
|
||||||
|
add_term_meta( $terms[0], 'foo', 'bar' );
|
||||||
|
|
||||||
|
// Prime cache.
|
||||||
|
$found = get_terms( 'wptests_tax', array(
|
||||||
|
'hide_empty' => false,
|
||||||
|
'fields' => 'ids',
|
||||||
|
'meta_query' => array(
|
||||||
|
array(
|
||||||
|
'key' => 'foo',
|
||||||
|
'value' => 'bar',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) );
|
||||||
|
|
||||||
|
$this->assertEqualSets( array( $terms[0] ), $found );
|
||||||
|
|
||||||
|
add_term_meta( $terms[1], 'foo', 'bar' );
|
||||||
|
|
||||||
|
$found = get_terms( 'wptests_tax', array(
|
||||||
|
'hide_empty' => false,
|
||||||
|
'fields' => 'ids',
|
||||||
|
'meta_query' => array(
|
||||||
|
array(
|
||||||
|
'key' => 'foo',
|
||||||
|
'value' => 'bar',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) );
|
||||||
|
|
||||||
|
$this->assertEqualSets( array( $terms[0], $terms[1] ), $found );
|
||||||
|
}
|
||||||
|
|
||||||
public function test_updating_term_meta_should_bust_get_terms_cache() {
|
public function test_updating_term_meta_should_bust_get_terms_cache() {
|
||||||
$terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
|
$terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user