WordPress.org

Make WordPress Core

Ticket #34338: Test_34338.php

File Test_34338.php, 601 bytes (added by tszming, 4 years ago)

Test

Line 
1<?php
2
3class Test_34338 extends WP_UnitTestCase
4{
5    function test_remove_object_terms()
6    {
7        $post_id = $this->factory->post->create();
8        wp_set_object_terms($post_id, 'test', 'category');
9
10        // Pollute the cache
11        $terms = get_the_terms($post_id, 'category');
12
13        wp_remove_object_terms($post_id, 'test', 'category');
14        $this->assertEquals(false, get_the_terms($post_id, 'category')); // should work but not work
15
16        wp_set_object_terms($post_id, null, 'category');
17        $this->assertEquals(false, get_the_terms($post_id, 'category')); // work
18    }
19}