WordPress.org

Make WordPress Core

Changeset 257 in tests


Ignore:
Timestamp:
11/13/09 18:56:05 (4 years ago)
Author:
westi
Message:

Fix the TestDefaultThemes::test_get_themes_contents() test function to test correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_theme.php

    r255 r257  
    3535            // important attributes should all be set 
    3636            $default_headers = array(  
    37                 'Name' => 'Theme Name',  
    38                 'URI' => 'Theme URI',  
    39                 'Description' => 'Description',  
    40                 'Author' => 'Author',  
    41                 'AuthorURI' => 'Author URI', 
     37                'Title' => 'Theme Title',  
    4238                'Version' => 'Version',  
     39                'Parent Theme' => 'Parent Theme',  
     40                'Template Dir' => 'Template Dir',  
     41                'Stylesheet Dir' => 'Stylesheet Dir', 
    4342                'Template' => 'Template',  
    44                 'Status' => 'Status',  
     43                'Stylesheet' => 'Stylesheet',  
     44                'Screenshot' => 'Screenshot',  
     45                'Description' => 'Description', 
     46                'Author' => 'Author', 
    4547                'Tags' => 'Tags' 
     48//  Introduced in WordPress 2.9 so tests commented out for now 
     49//              'Theme Root' => 'Theme Root', 
     50//              'Theme Root URI' => 'Theme Root URI' 
    4651                ); 
    4752            foreach ($default_headers as $name => $value) { 
    48                 $this->assertTrue(isset($data[$name])); 
     53                $this->assertTrue(isset($theme[$name])); 
    4954            } 
     55 
     56            // Make the tests work both for WordPress 2.8.5 and WordPress 2.9-rare  
     57            $dir = isset($theme['Theme Root']) ? '' : WP_CONTENT_DIR; 
    5058 
    5159            // important attributes should all not be empty as well 
     
    6068            $this->assertTrue(count($theme['Template Files']) > 0); 
    6169            foreach ($theme['Template Files'] as $file) { 
    62                 $this->assertTrue(is_file(ABSPATH . $file)); 
    63                 $this->assertTrue(is_readable(ABSPATH . $file)); 
     70                $this->assertTrue(is_file($dir . $file)); 
     71                $this->assertTrue(is_readable($dir . $file)); 
    6472            } 
    6573 
     
    6876            $this->assertTrue(count($theme['Stylesheet Files']) > 0); 
    6977            foreach ($theme['Stylesheet Files'] as $file) { 
    70                 $this->assertTrue(is_file(ABSPATH . $file)); 
    71                 $this->assertTrue(is_readable(ABSPATH . $file)); 
     78                $this->assertTrue(is_file($dir . $file)); 
     79                $this->assertTrue(is_readable($dir . $file)); 
    7280            } 
    7381 
    74             $this->assertTrue(is_dir(ABSPATH . $theme['Template Dir'])); 
    75             $this->assertTrue(is_dir(ABSPATH . $theme['Stylesheet Dir'])); 
     82            $this->assertTrue(is_dir($dir . $theme['Template Dir'])); 
     83            $this->assertTrue(is_dir($dir . $theme['Stylesheet Dir'])); 
    7684 
    7785            $this->assertEquals('publish', $theme['Status']); 
    7886 
    79             $this->assertTrue(is_file(ABSPATH . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot'])); 
    80             $this->assertTrue(is_readable(ABSPATH . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot'])); 
     87            $this->assertTrue(is_file($dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot'])); 
     88            $this->assertTrue(is_readable($dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot'])); 
    8189        } 
    8290    } 
Note: See TracChangeset for help on using the changeset viewer.