Taxononmy: add unit that shows that `WP_Term_Query` is broken when the query is read from the cache.

See #37591.


git-svn-id: https://develop.svn.wordpress.org/trunk@38211 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2016-08-07 04:42:07 +00:00
parent 0b1f2f7ca3
commit e5b88bcd8e
1 changed files with 23 additions and 0 deletions

View File

@ -142,4 +142,27 @@ class Tests_Term_Query extends WP_UnitTestCase {
$clauses['orderby'] = 'ORDER BY tt.term_id'; $clauses['orderby'] = 'ORDER BY tt.term_id';
return $clauses; return $clauses;
} }
/**
* @ticket 37591
*/
public function test_terms_is_set() {
register_taxonomy( 'wptests_tax_1', 'post' );
self::factory()->term->create( array( 'taxonomy' => 'wptests_tax_1' ) );
$q1 = new WP_Term_Query( array(
'taxonomy' => 'wptests_tax_1',
'hide_empty' => false
) );
$this->assertNotEmpty( $q1->terms );
$q2 = new WP_Term_Query( array(
'taxonomy' => 'wptests_tax_1',
'hide_empty' => false
) );
$this->assertNotEmpty( $q2->terms );
}
} }