WordPress.org

Make WordPress Core

Changeset 591 in tests


Ignore:
Timestamp:
03/28/12 11:15:20 (2 years ago)
Author:
westi
Message:

Add some test cases for the old get_theme_data function for themes in the root and subdirectories.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_theme.php

    r579 r591  
    351351        $this->assertTrue( in_array( $this->theme_root . '/page-templates/template-top-level.php', $templates)); 
    352352    } 
     353 
     354    function test_get_theme_data_top_level() { 
     355        $theme_data = get_theme_data( realpath( DIR_TESTROOT . '/' . DIR_TESTDATA . '/themedir1/theme1/style.css' ) ); 
     356 
     357        $this->assertEquals( 'My Theme', $theme_data['Name'] ); 
     358        $this->assertEquals( 'http://example.org/', $theme_data['URI'] ); 
     359        $this->assertEquals( 'An example theme', $theme_data['Description'] ); 
     360        $this->assertEquals( '<a href="http://example.com/" title="Visit author homepage">Minnie Bannister</a>', $theme_data['Author'] ); 
     361        $this->assertEquals( 'http://example.com/', $theme_data['AuthorURI'] ); 
     362        $this->assertEquals( '1.3', $theme_data['Version'] ); 
     363        $this->assertEquals( '', $theme_data['Template'] ); 
     364        $this->assertEquals( 'publish', $theme_data['Status'] ); 
     365        $this->assertEquals( array(), $theme_data['Tags'] ); 
     366        $this->assertEquals( 'My Theme', $theme_data['Title'] ); 
     367        $this->assertEquals( 'Minnie Bannister', $theme_data['AuthorName'] ); 
     368    } 
     369 
     370    function test_get_theme_data_subdir() { 
     371        $theme_data = get_theme_data( $this->theme_root . '/subdir/theme2/style.css' ); 
     372 
     373        $this->assertEquals( 'My Subdir Theme', $theme_data['Name'] ); 
     374        $this->assertEquals( 'http://example.org/', $theme_data['URI'] ); 
     375        $this->assertEquals( 'An example theme in a sub directory', $theme_data['Description'] ); 
     376        $this->assertEquals( '<a href="http://wordpress.org/" title="Visit author homepage">Mr. WordPress</a>', $theme_data['Author'] ); 
     377        $this->assertEquals( 'http://wordpress.org/', $theme_data['AuthorURI'] ); 
     378        $this->assertEquals( '0.1', $theme_data['Version'] ); 
     379        $this->assertEquals( '', $theme_data['Template'] ); 
     380        $this->assertEquals( 'publish', $theme_data['Status'] ); 
     381        $this->assertEquals( array(), $theme_data['Tags'] ); 
     382        $this->assertEquals( 'My Subdir Theme', $theme_data['Title'] ); 
     383        $this->assertEquals( 'Mr. WordPress', $theme_data['AuthorName'] ); 
     384    } 
     385 
    353386} 
    354387 
Note: See TracChangeset for help on using the changeset viewer.