* Suppress deprecated function notices in tests/theme/themeDir.php

* Set `$theme['Template Files']` and `$theme['Stylesheet Files']` to a variable before calling array methods upon them - avoids `Indirect modification of overloaded element has no effect` notice
* Clean up setUp/tearDown in `tests/theme.php`

See #25282.



git-svn-id: https://develop.svn.wordpress.org/trunk@25388 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2013-09-12 05:48:58 +00:00
parent ee35baae6b
commit f4ac65db2d
2 changed files with 33 additions and 14 deletions

View File

@@ -16,17 +16,7 @@ class Tests_Theme extends WP_UnitTestCase {
wp_clean_themes_cache();
unset( $GLOBALS['wp_themes'] );
add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run_check' ) );
}
function deprecated_function_run_check( $function ) {
if ( in_array( $function, array( 'get_theme', 'get_themes', 'get_theme_data', 'get_current_theme' ) ) )
add_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) );
}
function filter_deprecated_function_trigger_error() {
remove_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) );
return false;
add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );
}
function tearDown() {
@@ -34,6 +24,18 @@ class Tests_Theme extends WP_UnitTestCase {
wp_clean_themes_cache();
unset( $GLOBALS['wp_themes'] );
parent::tearDown();
remove_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );
}
function deprecated_function_run( $function ) {
if ( in_array( $function, array( 'get_theme', 'get_themes', 'get_theme_data', 'get_current_theme' ) ) )
add_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) );
}
function deprecated_function_trigger_error() {
remove_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) );
return false;
}
function test_wp_get_themes_default() {