diff --git tests/phpunit/tests/term/getTerms.php tests/phpunit/tests/term/getTerms.php
index 2be4e8c..ac4d1c8 100644
|
|
|
class Tests_Term_getTerms extends WP_UnitTestCase { |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
| | 85 | * @ticket 29894 |
| | 86 | */ |
| | 87 | public function test_get_terms_cache_using_loosely_typed_hash_values() { |
| | 88 | global $wpdb; |
| | 89 | |
| | 90 | $posts = $this->factory->post->create_many( 5, array( 'post_type' => 'post' ) ); |
| | 91 | foreach ( $posts as $post ) { |
| | 92 | wp_set_object_terms( $post, rand_str(), 'post_tag' ); |
| | 93 | } |
| | 94 | |
| | 95 | $num_queries = $wpdb->num_queries; |
| | 96 | |
| | 97 | $terms = get_terms( 'post_tag', array( |
| | 98 | 'hide_empty' => 0, |
| | 99 | ) ); |
| | 100 | |
| | 101 | // First call should result in a query. |
| | 102 | $this->assertSame( $num_queries + 1, $wpdb->num_queries ); |
| | 103 | |
| | 104 | $terms = get_terms( 'post_tag', array( |
| | 105 | 'hide_empty' => false, |
| | 106 | ) ); |
| | 107 | |
| | 108 | // Second call should hit the cache. |
| | 109 | $this->assertSame( $num_queries + 1, $wpdb->num_queries ); |
| | 110 | } |
| | 111 | |
| | 112 | /** |
| 85 | 113 | * @ticket 23506 |
| 86 | 114 | */ |
| 87 | 115 | function test_get_terms_should_allow_arbitrary_indexed_taxonomies_array() { |