mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
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:
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user