Make WordPress Core

Changeset 570 in tests


Ignore:
Timestamp:
03/13/2012 09:51:05 PM (12 years ago)
Author:
kurtpayne
Message:

Fixing unit test errors, updating for new theme functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_theme.php

    r497 r570  
    1111    function test_get_themes_default() {
    1212        $themes = get_themes();
    13         // one theme is included by default: Twenty Ten
    14         $this->assertTrue( is_array($themes['Twenty Ten']) );
     13        // one theme is included by default: Twenty Eleven
     14        $this->assertInstanceOf( 'WP_Theme', $themes['Twenty Eleven']);
    1515    }
    1616
    1717    function test_get_themes_contents() {
    18         $themes = get_themes();
     18        $themes = wp_get_themes();
    1919
    2020        // Generic tests that should hold true for any theme
    2121        foreach ($themes as $k=>$theme) {
    22             $this->assertEquals($theme['Name'], $k);
     22            $this->assertEquals($theme['Template'], $k);
    2323            $this->assertTrue(!empty($theme['Title']));
    2424
     
    7373            $this->assertTrue(is_dir($dir . $theme['Stylesheet Dir']));
    7474
    75             $this->assertEquals('publish', $theme['Status']);
     75            $this->assertEquals('public', $theme['Status']);
    7676
    7777            $this->assertTrue(is_file($dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot']));
     
    8181
    8282    function test_get_theme() {
    83         $themes = get_themes();
    84 
    85         foreach (array_keys($themes) as $name) {
    86             $theme = get_theme($name);
    87             $this->assertTrue(is_array($theme));
    88             $this->assertEquals($theme, $themes[$name]);
     83        $themes = wp_get_themes();
     84        foreach ( $themes as $theme ) {
     85            $_theme = wp_get_theme( $theme->get_stylesheet() );
     86            $this->assertInstanceOf( 'WP_Theme', $_theme );
     87            $this->assertFalse( $_theme->errors() );
    8988        }
    9089    }
     
    166165        update_option('stylesheet', $style);
    167166
    168         $this->assertEquals( 'Twenty Ten', get_current_theme() );
     167        $theme =  wp_get_theme();
     168        $this->assertEquals( $style, $theme->__toString() );
     169        $this->assertTrue( false !== $theme->errors() );
    169170
    170171        // these return the bogus name - perhaps not ideal behaviour?
Note: See TracChangeset for help on using the changeset viewer.