mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-06 12:51:58 +00:00
3.7 regression from [25119]: Have in_category() return false when the first argument is empty.
Adds unit tests. props ericlewis. fixes #25706 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@25923 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -152,4 +152,20 @@ class Tests_Taxonomy extends WP_UnitTestCase {
|
||||
_unregister_post_type( $post_type );
|
||||
|
||||
}
|
||||
/**
|
||||
* @ticket 25706
|
||||
*/
|
||||
function test_in_category() {
|
||||
$post = $this->factory->post->create_and_get();
|
||||
|
||||
// in_category() returns false when first parameter is empty()
|
||||
$this->assertFalse( in_category( '', $post ) );
|
||||
$this->assertFalse( in_category( false, $post ) );
|
||||
$this->assertFalse( in_category( null, $post ) );
|
||||
|
||||
// Test expected behavior of in_category()
|
||||
$term = wp_insert_term( 'Test', 'category' );
|
||||
wp_set_object_terms( $post->ID, $term['term_id'], 'category' );
|
||||
$this->assertTrue( in_category( $term['term_id'], $post ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user