Make WordPress Core

Changeset 25388


Ignore:
Timestamp:
09/12/2013 05:48:58 AM (11 years ago)
Author:
wonderboymusic
Message:
  • 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.

Location:
trunk/tests/phpunit/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme.php

    r25362 r25388  
    1717        unset( $GLOBALS['wp_themes'] );
    1818
    19         add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run_check' ) );
    20     }
    21 
    22     function deprecated_function_run_check( $function ) {
    23         if ( in_array( $function, array( 'get_theme', 'get_themes', 'get_theme_data', 'get_current_theme' ) ) )
    24             add_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) );
    25     }
    26 
    27     function filter_deprecated_function_trigger_error() {
    28         remove_filter( 'deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) );
    29         return false;
     19        add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );
    3020    }
    3121
     
    3525        unset( $GLOBALS['wp_themes'] );
    3626        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;
    3739    }
    3840
  • trunk/tests/phpunit/tests/theme/themeDir.php

    r25254 r25388  
    2222        wp_clean_themes_cache();
    2323        unset( $GLOBALS['wp_themes'] );
     24        add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );
    2425    }
    2526
     
    3233        unset( $GLOBALS['wp_themes'] );
    3334        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;
    3446    }
    3547
     
    8092        $this->assertEquals( 'sandbox', $theme['Template'] );
    8193        $this->assertEquals( 'sandbox', $theme['Stylesheet'] );
    82         $this->assertEquals( $this->theme_root.'/sandbox/functions.php', reset($theme['Template Files']) );
    83         $this->assertEquals( $this->theme_root.'/sandbox/index.php', next($theme['Template Files']) );
    84 
    85         $this->assertEquals( $this->theme_root.'/sandbox/style.css', reset($theme['Stylesheet Files']) );
     94
     95        $template_files = $theme['Template Files'];
     96
     97        $this->assertEquals( $this->theme_root.'/sandbox/functions.php', reset( $template_files ) );
     98        $this->assertEquals( $this->theme_root.'/sandbox/index.php', next( $template_files ) );
     99
     100        $stylesheet_files = $theme['Stylesheet Files'];
     101
     102        $this->assertEquals( $this->theme_root.'/sandbox/style.css', reset( $stylesheet_files ) );
    86103
    87104        $this->assertEquals( $this->theme_root.'/sandbox', $theme['Template Dir'] );
Note: See TracChangeset for help on using the changeset viewer.