| | 155 | |
| | 156 | /** |
| | 157 | * @ticket 14485 |
| | 158 | */ |
| | 159 | function test_taxonomy_hierarchy_cache() { |
| | 160 | $taxonomy = 'where-you-live'; |
| | 161 | register_taxonomy( $taxonomy, 'user', array('hierarchical' => true, 'show_ui' => true, 'query_var' => true, 'label' => __('Where they live')) ); |
| | 162 | |
| | 163 | $country = 'USA'; |
| | 164 | $state = 'New York'; |
| | 165 | |
| | 166 | $tax_country = wp_insert_term($country, $taxonomy); |
| | 167 | $country_term_id = $tax_country['term_id']; |
| | 168 | wp_insert_term($state, 'where-you-live', array('parent'=>$country_term_id)); |
| | 169 | |
| | 170 | $state_terms = get_term_children($country_term_id, $taxonomy); |
| | 171 | |
| | 172 | $term = $state_terms[0]; |
| | 173 | $result = get_term($term, $taxonomy); |
| | 174 | |
| | 175 | $this->assertEquals( $result->name, $state ); |
| | 176 | } |