WordPress.org

Make WordPress Core

Changeset 736 in tests


Ignore:
Timestamp:
06/11/12 00:47:39 (23 months ago)
Author:
nacin
Message:

Tests for extra theme headers via get_theme_data(), see #20897.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_theme.php

    r616 r736  
    99    function setUp() { 
    1010        parent::setUp(); 
     11        add_filter( 'extra_theme_headers', array( $this, '_theme_data_extra_headers' ) ); 
    1112        unset($GLOBALS['wp_themes']); 
     13    } 
     14 
     15    function tearDown() { 
     16        parent::tearDown(); 
     17        remove_filter( 'extra_theme_headers', array( $this, '_theme_data_extra_headers' ) ); 
    1218    } 
    1319 
     
    120126    } 
    121127 
     128    function test_extra_theme_headers() { 
     129        $this->knownWPBug( 20897 ); 
     130        $wp_theme = wp_get_theme( $this->theme_slug ); 
     131        $this->assertNotEmpty( $wp_theme->get('License') ); 
     132        $path_to_style_css = $wp_theme->get_theme_root() . '/' . $wp_theme->get_stylesheet() . '/style.css'; 
     133        $this->assertTrue( file_exists( $path_to_style_css ) ); 
     134        $theme_data = get_theme_data( $path_to_style_css ); 
     135        $this->assertArrayHasKey( 'License', $theme_data ); 
     136        $this->assertArrayNotHasKey( 'Not a Valid Key', $theme_data ); 
     137        $this->assertNotEmpty( $theme_data['License'] ); 
     138        $this->assertSame( $theme_data['License'], $wp_theme->get('License') ); 
     139    } 
     140 
     141    function _theme_data_extra_headers() { 
     142        return array( 'License' ); 
     143    } 
     144 
    122145    function test_switch_theme() { 
    123146        $themes = get_themes(); 
Note: See TracChangeset for help on using the changeset viewer.