Changeset 59015
- Timestamp:
- 09/11/2024 10:39:45 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/cache.php
r58919 r59015 446 446 $this->assertWPError( $terms ); 447 447 } 448 449 /** 450 * Ensures that the term query cache is cleared when a child term is inserted. 451 * 452 * @ticket 62031 453 */ 454 public function test_inserting_child_term_clears_the_query_cache() { 455 register_taxonomy( 456 'wptests_tax', 457 'post', 458 array( 459 'hierarchical' => true, 460 ) 461 ); 462 463 $parent = self::factory()->term->create( 464 array( 465 'taxonomy' => 'wptests_tax', 466 ) 467 ); 468 469 $children = get_terms( 470 array( 471 'taxonomy' => 'wptests_tax', 472 'hide_empty' => false, 473 'parent' => $parent, 474 'fields' => 'ids', 475 ) 476 ); 477 478 $this->assertEmpty( $children, 'No child terms are expected to exist.' ); 479 480 $child = wp_insert_term( 481 'child-term-62031', 482 'wptests_tax', 483 array( 484 'parent' => $parent, 485 ) 486 ); 487 488 $children = get_terms( 489 array( 490 'taxonomy' => 'wptests_tax', 491 'hide_empty' => false, 492 'parent' => $parent, 493 'fields' => 'ids', 494 ) 495 ); 496 497 $this->assertNotEmpty( $children, 'Child terms are expected to exist.' ); 498 $this->assertContains( $child['term_id'], $children, 'Querying by parent ID is expected to include the new child term.' ); 499 } 448 500 }
Note: See TracChangeset
for help on using the changeset viewer.