Ticket #14485: 14485.3.diff
File 14485.3.diff, 3.3 KB (added by , 11 years ago) |
---|
-
tests/phpunit/tests/term/cache.php
17 17 // Test with only one Parent => Child 18 18 $term_id1 = $this->factory->category->create(); 19 19 $term_id1_child = $this->factory->category->create( array( 'parent' => $term_id1 ) ); 20 21 $term_ids = array( $term_id1, $term_id1_child ); 22 clean_term_cache( $term_ids, 'category' ); 23 20 24 $hierarchy = _get_term_hierarchy( 'category' ); 21 25 22 26 $this->assertEquals( array( $term_id1 => array( $term_id1_child ) ), $hierarchy ); … … 24 28 // Add another Parent => Child 25 29 $term_id2 = $this->factory->category->create(); 26 30 $term_id2_child = $this->factory->category->create( array( 'parent' => $term_id2 ) ); 31 32 $term_ids = array( $term_id2, $term_id2_child ); 33 clean_term_cache( $term_ids, 'category' ); 34 27 35 $hierarchy = _get_term_hierarchy( 'category' ); 28 36 29 37 $this->assertEquals( array( $term_id1 => array( $term_id1_child ), $term_id2 => array( $term_id2_child ) ), $hierarchy ); … … 76 84 break; 77 85 } 78 86 87 clean_term_cache( $parent_id, $tax ); 88 79 89 $terms = get_terms( $tax, array( 'hide_empty' => false ) ); 80 90 $this->assertEquals( $i, count( $terms ) ); 81 91 if ( $i > 1 ) { -
tests/phpunit/tests/term/getTerms.php
165 165 $term_id2 = $this->factory->category->create(); 166 166 $term_id22 = $this->factory->category->create( array( 'parent' => $term_id2 ) ); 167 167 168 // There's something else broken in the cache cleaning routines that leads to this having to be done manually169 delete_option( 'category_children' );168 $term_ids = array( $term_id1, $term_id11, $term_id2, $term_id22 ); 169 clean_term_cache( $term_ids, 'category' ); 170 170 171 171 $terms = get_terms( 'category', array( 172 172 'exclude' => $term_id_uncategorized, … … 275 275 $fruit = $this->factory->term->create( array( 'name' => 'Fruit', 'taxonomy' => $tax ) ); 276 276 $cranberries = $this->factory->term->create( array( 'name' => 'Cranberries', 'parent' => $fruit, 'taxonomy' => $tax ) ); 277 277 278 $term_ids = array( $cheese, $cheddar, $brie, $crackers, $butter, $multigrain, $fruit, $cranberries ); 279 clean_term_cache( $term_ids, $tax ); 280 278 281 $terms = get_terms( $tax, array( 'parent' => 0, 'cache_domain' => $tax ) ); 279 282 $this->assertNotEmpty( $terms ); 280 283 $this->assertEquals( wp_list_pluck( $terms, 'name' ), array( 'Cheese', 'Crackers' ) ); … … 295 298 $term = get_term( $spread, $tax ); 296 299 $this->assertEquals( 1, $term->count ); 297 300 301 $term_ids = array( $cheese, $cheddar, $spread ); 302 clean_term_cache( $term_ids, $tax ); 303 298 304 $terms = get_terms( $tax, array( 'parent' => 0, 'cache_domain' => $tax ) ); 299 305 $this->assertNotEmpty( $terms ); 300 306 $this->assertEquals( array( 'Cheese' ), wp_list_pluck( $terms, 'name' ) ); … … 319 325 $term = get_term( $t[7], $tax ); 320 326 $this->assertEquals( 1, $term->count ); 321 327 328 clean_term_cache( $t, $tax ); 329 322 330 $terms = get_terms( $tax, array( 'parent' => 0, 'cache_domain' => $tax ) ); 323 331 $this->assertNotEmpty( $terms ); 324 332 $this->assertEquals( array( 'term1' ), wp_list_pluck( $terms, 'name' ) );