Make WordPress Core

Ticket #29467: taxonomy-unittests.diff

File taxonomy-unittests.diff, 891 bytes (added by realloc, 10 years ago)

Unit test for the ticket #29467

  • tests/phpunit/tests/taxonomy.php

     
    333333                $this->assertEqualSets( array( $t1 ), get_ancestors( $t2, 'wptests_conflict' ) );
    334334                _unregister_post_type( 'wptests_pt' );
    335335        }
     336        /**
     337         * @ticket 29467
     338         */
     339        public function test_is_object_in_term_returns_true_if_term_name_begins_with_number() {
     340                $post_ID  = $this->factory->post->create();
     341                $cat_name = $post_ID . '_term_name';
     342                $cat_id   = wp_insert_category( array(
     343                        'cat_name' => $post_ID . '_term_name',
     344                ) );
     345
     346                $this->assertFalse( is_object_in_term( $post_ID, 'category', $cat_name ) );
     347                wp_set_post_categories( $post_ID, array( $cat_id ) );
     348                $this->assertTrue( is_object_in_term( $post_ID, 'category', $cat_name ) );
     349        }
    336350}