Make WordPress Core


Ignore:
Timestamp:
09/11/2013 06:30:06 PM (11 years ago)
Author:
wonderboymusic
Message:

Add action/filter to Tests_Theme::setUp() to suppress errors while running back-compat tests on get_theme(), get_themes(), get_theme_data(), get_current_theme().

See #25282.

File:
1 edited

Legend:

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

    r25264 r25354  
    1616        wp_clean_themes_cache();
    1717        unset( $GLOBALS['wp_themes'] );
     18
     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( 'filter_deprecated_function_trigger_error', array( $this, 'filter_deprecated_function_trigger_error' ) );
     29        return false;
    1830    }
    1931
     
    7082    function test_get_themes_contents() {
    7183        $themes = get_themes();
    72 
    7384        // Generic tests that should hold true for any theme
    74         foreach ($themes as $k=>$theme) {
    75             $this->assertEquals($theme['Name'], $k);
    76             $this->assertTrue(!empty($theme['Title']));
     85        foreach ( $themes as $k => $theme ) {
     86            $this->assertEquals( $theme['Name'], $k );
     87            $this->assertNotEmpty( $theme['Title'] );
    7788
    7889            // important attributes should all be set
     
    101112
    102113            // important attributes should all not be empty as well
    103             $this->assertTrue(!empty($theme['Description']));
    104             $this->assertTrue(!empty($theme['Author']));
     114            $this->assertNotEmpty( $theme['Description'] );
     115            $this->assertNotEmpty( $theme['Author'] );
    105116            $this->assertTrue(version_compare($theme['Version'], 0) > 0);
    106             $this->assertTrue(!empty($theme['Template']));
    107             $this->assertTrue(!empty($theme['Stylesheet']));
     117            $this->assertNotEmpty( $theme['Template'] );
     118            $this->assertNotEmpty( $theme['Stylesheet'] );
    108119
    109120            // template files should all exist
     
    180191
    181192        for ( $i = 0; $i < 3; $i++ ) {
    182             foreach ($themes as $name=>$theme) {
     193            foreach ( $themes as $name => $theme ) {
    183194                // switch to this theme
    184195                if ( $i === 2 )
Note: See TracChangeset for help on using the changeset viewer.