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

Props jchristopher.
Fixes #21651.



git-svn-id: https://develop.svn.wordpress.org/trunk@25334 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2013-09-11 00:01:19 +00:00
parent a963ab0852
commit 0c0c81d81c
2 changed files with 11 additions and 2 deletions
+7 -1
View File
@@ -489,7 +489,7 @@ class Tests_Term extends WP_UnitTestCase {
$this->assertEquals( array( $term4['term_id'] ), $post->post_category );
wp_set_post_categories( $post_id, array( $term1['term_id'], $term2['term_id'] ), true );
$this->assertEquals( array( $term2['term_id'], $term4['term_id'],$term1['term_id'] ), $post->post_category );
$this->assertEquals( array( $term2['term_id'], $term4['term_id'], $term1['term_id'] ), $post->post_category );
wp_set_post_categories( $post_id, array(), true );
$this->assertEquals( 1, count( $post->post_category ) );
@@ -499,4 +499,10 @@ class Tests_Term extends WP_UnitTestCase {
$this->assertEquals( 1, count( $post->post_category ) );
$this->assertEquals( get_option( 'default_category' ), $post->post_category[0] );
}
function test_get_term_by_tt_id() {
$term1 = wp_insert_term( 'Foo', 'category' );
$term2 = get_term_by( 'term_taxonomy_id', $term1['term_taxonomy_id'], 'category' );
$this->assertEquals( get_term( $term1['term_id'], 'category' ), $term2 );
}
}