WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/11/2013 12:01:19 AM (8 years ago)
Author:
wonderboymusic
Message:

Add term_taxonomy_id to available fields in get_term_by(). Adds unit test.

Props jchristopher.
Fixes #21651.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/term.php

    r25234 r25334  
    490490
    491491        wp_set_post_categories( $post_id, array( $term1['term_id'], $term2['term_id'] ), true );
    492         $this->assertEquals( array( $term2['term_id'], $term4['term_id'],$term1['term_id'] ), $post->post_category );
     492        $this->assertEquals( array( $term2['term_id'], $term4['term_id'], $term1['term_id'] ), $post->post_category );
    493493
    494494        wp_set_post_categories( $post_id, array(), true );
     
    500500        $this->assertEquals( get_option( 'default_category' ), $post->post_category[0] );
    501501    }
     502
     503    function test_get_term_by_tt_id() {
     504        $term1 = wp_insert_term( 'Foo', 'category' );
     505        $term2 = get_term_by( 'term_taxonomy_id', $term1['term_taxonomy_id'], 'category' );
     506        $this->assertEquals( get_term( $term1['term_id'], 'category' ), $term2 );
     507    }
    502508}
Note: See TracChangeset for help on using the changeset viewer.