Test runner: Add @expectedIncorrectUsage to trap _doing_it_wrong() calls.

see #24813, #25282.


git-svn-id: https://develop.svn.wordpress.org/trunk@25785 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2013-10-15 14:30:02 +00:00
parent 772316ecc7
commit 5ceab9b1e3
3 changed files with 27 additions and 33 deletions

View File

@@ -5,26 +5,6 @@
*/
class Tests_Theme_Support extends WP_UnitTestCase {
function setUp() {
parent::setUp();
add_action( 'doing_it_wrong_run', array( $this, 'doing_it_wrong_run' ) );
}
function tearDown() {
parent::tearDown();
remove_action( 'doing_it_wrong_run', array( $this, 'doing_it_wrong_run' ) );
}
function doing_it_wrong_run( $function ) {
if ( in_array( $function, array( "add_theme_support( 'html5' )" ) ) )
add_filter( 'doing_it_wrong_trigger_error', array( $this, 'doing_it_wrong_trigger_error' ) );
}
function doing_it_wrong_trigger_error() {
remove_filter( 'doing_it_wrong_trigger_error', array( $this, 'doing_it_wrong_trigger_error' ) );
return false;
}
function test_the_basics() {
add_theme_support( 'automatic-feed-links' );
$this->assertTrue( current_theme_supports( 'automatic-feed-links' ) );
@@ -115,6 +95,8 @@ class Tests_Theme_Support extends WP_UnitTestCase {
/**
* @ticket 24932
*
* @expectedIncorrectUsage add_theme_support( 'html5' )
*/
function test_supports_html5_subset() {
remove_theme_support( 'html5' );
@@ -144,6 +126,8 @@ class Tests_Theme_Support extends WP_UnitTestCase {
/**
* @ticket 24932
*
* @expectedIncorrectUsage add_theme_support( 'html5' )
*/
function test_supports_html5_invalid() {
remove_theme_support( 'html5' );