Changeset 25402
- Timestamp:
- 09/12/2013 02:47:58 PM (11 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase.php
r25017 r25402 7 7 8 8 protected static $forced_tickets = array(); 9 protected $deprecated_functions = array(); 9 10 10 11 /** … … 25 26 $this->start_transaction(); 26 27 add_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) ); 28 29 if ( ! empty( $this->deprecated_functions ) ) 30 add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) ); 27 31 } 28 32 … … 33 37 remove_filter( 'query', array( $this, '_drop_temporary_tables' ) ); 34 38 remove_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) ); 39 if ( ! empty( $this->deprecated_functions ) ) 40 remove_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) ); 41 } 42 43 function deprecated_function_run( $function ) { 44 if ( in_array( $function, $this->deprecated_functions ) ) 45 add_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) ); 46 } 47 48 function deprecated_function_trigger_error() { 49 remove_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) ); 50 return false; 35 51 } 36 52 -
trunk/tests/phpunit/tests/admin/includesTheme.php
r25362 r25402 4 4 */ 5 5 class Tests_Admin_includesTheme extends WP_UnitTestCase { 6 protected $deprecated_functions = array( 'get_theme', 'get_themes', 'get_theme_data', 'get_current_theme' ); 7 6 8 function setUp() { 7 9 parent::setUp(); … … 18 20 wp_clean_themes_cache(); 19 21 unset( $GLOBALS['wp_themes'] ); 20 21 add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run_check' ) );22 }23 24 function deprecated_function_run_check( $function ) {25 if ( in_array( $function, array( 'get_theme', 'get_themes', 'get_theme_data', 'get_current_theme' ) ) )26 add_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) );27 }28 29 function filter_deprecated_function_trigger_error() {30 remove_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) );31 return false;32 22 } 33 23 -
trunk/tests/phpunit/tests/formatting/CleanPre.php
r25378 r25402 8 8 */ 9 9 class Tests_Formatting_CleanPre extends WP_UnitTestCase { 10 function setUp() { 11 parent::setUp(); 12 add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run_check' ) ); 13 } 14 15 function tearDown() { 16 parent::tearDown(); 17 remove_action( 'deprecated_function_run', array( $this, 'deprecated_function_run_check' ) ); 18 } 19 20 function deprecated_function_run_check( $function ) { 21 if ( in_array( $function, array( 'clean_pre' ) ) ) 22 add_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) ); 23 } 24 25 function deprecated_function_trigger_error() { 26 remove_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) ); 27 return false; 28 } 10 protected $deprecated_functions = array( 'clean_pre' ); 29 11 30 12 function test_removes_self_closing_br_with_space() { -
trunk/tests/phpunit/tests/image/functions.php
r25380 r25402 7 7 */ 8 8 class Tests_Image_Functions extends WP_UnitTestCase { 9 protected $deprecated_functions = array( 'wp_load_image' ); 10 9 11 /** 10 12 * Setup test fixture … … 18 20 19 21 include_once( DIR_TESTDATA . '/../includes/mock-image-editor.php' ); 20 add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );21 }22 23 function tearDown() {24 parent::tearDown();25 remove_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );26 }27 28 function deprecated_function_run( $function ) {29 if ( in_array( $function, array( 'wp_load_image' ) ) )30 add_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) );31 }32 33 function deprecated_function_trigger_error() {34 remove_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) );35 return false;36 22 } 37 23 -
trunk/tests/phpunit/tests/image/size.php
r25367 r25402 7 7 */ 8 8 class Tests_Image_Size extends WP_UnitTestCase { 9 function setUp() { 10 parent::setUp(); 11 12 add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run_check' ) ); 13 } 14 15 function tearDown() { 16 parent::tearDown(); 17 18 remove_action( 'deprecated_function_run', array( $this, 'deprecated_function_run_check' ) ); 19 } 20 21 function deprecated_function_run_check( $function ) { 22 if ( in_array( $function, array( 'wp_shrink_dimensions' ) ) ) 23 add_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) ); 24 } 25 26 function filter_deprecated_function_trigger_error() { 27 remove_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) ); 28 return false; 29 } 30 9 protected $deprecated_functions = array( 'wp_shrink_dimensions' ); 10 31 11 function test_constrain_dims_zero() { 32 12 if (!is_callable('wp_constrain_dimensions')) -
trunk/tests/phpunit/tests/media.php
r25382 r25402 6 6 */ 7 7 class Tests_Media extends WP_UnitTestCase { 8 protected $deprecated_functions = array( 'wp_convert_bytes_to_hr' ); 8 9 9 10 function setUp() { … … 20 21 $this->img_html = '<img src="' . $this->img_url . '"/>'; 21 22 $this->img_dimensions = array( 'width' => 100, 'height' => 100 ); 22 add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );23 }24 25 function tearDown() {26 parent::tearDown();27 remove_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );28 }29 30 function deprecated_function_run( $function ) {31 if ( in_array( $function, array( 'wp_convert_bytes_to_hr' ) ) )32 add_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) );33 }34 35 function deprecated_function_trigger_error() {36 remove_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) );37 return false;38 23 } 39 24 -
trunk/tests/phpunit/tests/ms.php
r25397 r25402 9 9 */ 10 10 class Tests_MS extends WP_UnitTestCase { 11 11 protected $deprecated_functions = array( 'is_blog_user', 'get_dashboard_blog' ); 12 12 protected $plugin_hook_count = 0; 13 13 … … 16 16 17 17 $_SERVER['REMOTE_ADDR'] = ''; 18 add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run_check' ) );19 }20 21 function tearDown() {22 parent::tearDown();23 remove_action( 'deprecated_function_run', array( $this, 'deprecated_function_run_check' ) );24 }25 26 function deprecated_function_run_check( $function ) {27 if ( in_array( $function, array( 'is_blog_user', 'get_dashboard_blog' ) ) )28 add_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) );29 }30 31 function filter_deprecated_function_trigger_error() {32 remove_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) );33 return false;34 18 } 35 19 -
trunk/tests/phpunit/tests/theme.php
r25388 r25402 7 7 */ 8 8 class Tests_Theme extends WP_UnitTestCase { 9 10 var$theme_slug = 'twentyeleven';11 var$theme_name = 'Twenty Eleven';9 protected $deprecated_functions = array( 'get_theme', 'get_themes', 'get_theme_data', 'get_current_theme' ); 10 protected $theme_slug = 'twentyeleven'; 11 protected $theme_name = 'Twenty Eleven'; 12 12 13 13 function setUp() { … … 16 16 wp_clean_themes_cache(); 17 17 unset( $GLOBALS['wp_themes'] ); 18 19 add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );20 18 } 21 19 … … 25 23 unset( $GLOBALS['wp_themes'] ); 26 24 parent::tearDown(); 27 28 remove_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );29 }30 31 function deprecated_function_run( $function ) {32 if ( in_array( $function, array( 'get_theme', 'get_themes', 'get_theme_data', 'get_current_theme' ) ) )33 add_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) );34 }35 36 function deprecated_function_trigger_error() {37 remove_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) );38 return false;39 25 } 40 26 -
trunk/tests/phpunit/tests/theme/themeDir.php
r25388 r25402 7 7 */ 8 8 class Tests_Theme_ThemeDir extends WP_UnitTestCase { 9 protected $deprecated_functions = array( 'get_theme', 'get_themes', 'get_theme_data', 'get_current_theme', 'get_broken_themes' ); 10 9 11 function setUp() { 10 12 parent::setUp(); … … 22 24 wp_clean_themes_cache(); 23 25 unset( $GLOBALS['wp_themes'] ); 24 add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );25 26 } 26 27 … … 33 34 unset( $GLOBALS['wp_themes'] ); 34 35 parent::tearDown(); 35 remove_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );36 }37 38 function deprecated_function_run( $function ) {39 if ( in_array( $function, array( 'get_theme', 'get_themes', 'get_theme_data', 'get_current_theme', 'get_broken_themes' ) ) )40 add_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) );41 }42 43 function deprecated_function_trigger_error() {44 remove_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) );45 return false;46 36 } 47 37 -
trunk/tests/phpunit/tests/user/capabilities.php
r25391 r25402 8 8 */ 9 9 class Tests_User_Capabilities extends WP_UnitTestCase { 10 var $user_ids = array(); 10 protected $user_ids = array(); 11 protected $deprecated_functions = array( 'set_current_user' ); 11 12 12 13 function setUp() { … … 16 17 17 18 $this->orig_users = get_users(); 18 add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );19 }20 21 function tearDown() {22 parent::tearDown();23 remove_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );24 }25 26 function deprecated_function_run( $function ) {27 if ( in_array( $function, array( 'set_current_user' ) ) )28 add_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) );29 }30 31 function deprecated_function_trigger_error() {32 remove_filter( 'deprecated_function_trigger_error', array( $this, 'deprecated_function_trigger_error' ) );33 return false;34 19 } 35 20
Note: See TracChangeset
for help on using the changeset viewer.