Clean up 'post-thumbnail' theme support unit tests.

* Separate into smaller test methods.
* Remove incorrect tests. A number of assertions in the existing test have always incorrectly described the behavior of `current_theme_supports( 'post-thumbnails' )`, but no one ever noticed because the tests had been designed to bail when `_wp_render_title_tag()` did not exist. The failures finally became visible when that function was introduced in [30074].

See #18548.

git-svn-id: https://develop.svn.wordpress.org/trunk@30148 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2014-11-01 04:00:59 +00:00
parent 2ade0b964a
commit 262150a91e
1 changed files with 5 additions and 22 deletions

View File

@ -34,48 +34,31 @@ class Tests_Theme_Support extends WP_UnitTestCase {
$this->assertFalse( get_theme_support( 'admin-bar' ) );
}
function test_post_thumbnails() {
public function test_post_thumbnails() {
add_theme_support( 'post-thumbnails' );
$this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
remove_theme_support( 'post-thumbnails' );
$this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
add_theme_support( 'post-thumbnails' );
$this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
}
// simple array of post types.
public function test_post_thumbnails_flat_array_of_post_types() {
add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
$this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
$this->assertTrue( current_theme_supports( 'post-thumbnails', 'post' ) );
$this->assertFalse( current_theme_supports( 'post-thumbnails', 'book' ) );
remove_theme_support( 'post-thumbnails' );
$this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
}
#WP18548
if ( ! function_exists( '_wp_render_title_tag' ) )
return;
// array of arguments, with the key of 'types' holding the post types.
add_theme_support( 'post-thumbnails', array( 'types' => array( 'post', 'page' ) ) );
$this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
$this->assertTrue( current_theme_supports( 'post-thumbnails', 'post' ) );
$this->assertFalse( current_theme_supports( 'post-thumbnails', 'book' ) );
remove_theme_support( 'post-thumbnails' );
$this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
public function test_post_thumbnails_types_true() {
// array of arguments, with the key of 'types' holding the post types.
add_theme_support( 'post-thumbnails', array( 'types' => true ) );
$this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
$this->assertTrue( current_theme_supports( 'post-thumbnails', rand_str() ) ); // any type
remove_theme_support( 'post-thumbnails' );
$this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
// array of arguments, with some other argument, and no 'types' argument.
add_theme_support( 'post-thumbnails', array( rand_str() => rand_str() ) );
$this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
$this->assertTrue( current_theme_supports( 'post-thumbnails', rand_str() ) ); // any type
remove_theme_support( 'post-thumbnails' );
$this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
}
/**