diff --git tests/phpunit/tests/term.php tests/phpunit/tests/term.php
index d6dedd6..01cab7b 100644
|
|
class Tests_Term extends WP_UnitTestCase { |
713 | 713 | |
714 | 714 | $this->assertSame( 0, $created_term->term_group ); |
715 | 715 | } |
| 716 | |
| 717 | public function test_wp_delete_term_should_invalidate_cache_for_child_terms() { |
| 718 | register_taxonomy( 'wptests_tax', 'post', array( |
| 719 | 'hierarchical' => true, |
| 720 | ) ); |
| 721 | |
| 722 | $parent = $this->factory->term->create( array( |
| 723 | 'taxonomy' => 'wptests_tax', |
| 724 | ) ); |
| 725 | |
| 726 | $child = $this->factory->term->create( array( |
| 727 | 'taxonomy' => 'wptests_tax', |
| 728 | 'parent' => $parent, |
| 729 | ) ); |
| 730 | |
| 731 | // Prime the cache. |
| 732 | $child_term = get_term( $child, 'wptests_tax' ); |
| 733 | $this->assertSame( $parent, $child_term->parent ); |
| 734 | |
| 735 | wp_delete_term( $parent, 'wptests_tax' ); |
| 736 | $child_term = get_term( $child, 'wptests_tax' ); |
| 737 | $this->assertSame( 0, $child_term->parent ); |
| 738 | } |
| 739 | |
716 | 740 | /** |
717 | 741 | * @ticket 5381 |
718 | 742 | */ |