From e5b88bcd8e98b8c1f659dbb6c7c0548de84b1404 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sun, 7 Aug 2016 04:42:07 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/term/query.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/phpunit/tests/term/query.php b/tests/phpunit/tests/term/query.php index 8e80bb4fb1..2445741d47 100644 --- a/tests/phpunit/tests/term/query.php +++ b/tests/phpunit/tests/term/query.php @@ -142,4 +142,27 @@ class Tests_Term_Query extends WP_UnitTestCase { $clauses['orderby'] = 'ORDER BY tt.term_id'; 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 ); + } }