wpRemoveObjectTerms.php 593 B

123456789101112131415161718192021222324
  1. <?php
  2. /**
  3. * @group taxonomy
  4. */
  5. class Tests_Term_WpRemoveObjectTerms extends WP_UnitTestCase {
  6. /**
  7. * @ticket 34338
  8. */
  9. public function test_removal_should_delete_object_relationship_cache() {
  10. register_taxonomy( 'wptests_tax', 'post' );
  11. $p = self::factory()->post->create();
  12. $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) );
  13. wp_set_object_terms( $p, $t, 'wptests_tax' );
  14. // Pollute the cache.
  15. get_the_terms( $p, 'wptests_tax' );
  16. wp_remove_object_terms( $p, $t, 'wptests_tax' );
  17. $this->assertFalse( get_the_terms( $p, 'wptests_tax' ) );
  18. }
  19. }