Changeset 40 in tests for wp-testcase/test_includes_theme.php
- Timestamp:
- 10/03/2007 12:26:31 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-testcase/test_includes_theme.php
r1 r40 4 4 5 5 6 class Test Themes extends WPTestCase {6 class TestDefaultThemes extends WPTestCase { 7 7 function setUp() { 8 8 unset($GLOBALS['wp_themes']); … … 131 131 $this->assertEquals(get_single_template(), get_query_template('single')); 132 132 $this->assertEquals(get_attachment_template(), get_query_template('attachment')); 133 133 134 134 // this one doesn't behave like the others 135 135 if (get_query_template('comments-popup')) … … 164 164 } 165 165 166 include_once(DIR_TESTDATA . '/sample_blogs.php'); 167 168 // Test functions that fetch stuff from the theme directory 169 class TestThemeDir extends _WPEmptyBlog { 170 function setUp() { 171 parent::setUp(); 172 $this->theme_root = realpath(DIR_TESTROOT.'/'.DIR_TESTDATA.'/themedir1'); 173 174 add_filter('theme_root', array(&$this, '_theme_root')); 175 176 // clear caches 177 unset($GLOBALS['wp_themes']); 178 unset($GLOBALS['wp_broken_themes']); 179 180 } 181 182 function tearDown() { 183 remove_filter('theme_root', array(&$this, '_theme_root')); 184 parent::tearDown(); 185 } 186 187 // replace the normal theme root dir with our premade test dir 188 function _theme_root($dir) { 189 return $this->theme_root; 190 } 191 192 function test_theme_default() { 193 $themes = get_themes(); 194 195 $theme = $themes['WordPress Default']; 196 $this->assertFalse( empty($theme) ); 197 198 #echo gen_tests_array('theme', $theme); 199 200 $this->assertEquals( 'WordPress Default', $theme['Name'] ); 201 $this->assertEquals( 'WordPress Default', $theme['Title'] ); 202 $this->assertEquals( 'The default WordPress theme based on the famous <a href="http://binarybonsai.com/kubrick/">Kubrick</a>.', $theme['Description'] ); 203 $this->assertEquals( '<a href="http://binarybonsai.com/" title="Visit author homepage">Michael Heilemann</a>', $theme['Author'] ); 204 $this->assertEquals( '1.6', $theme['Version'] ); 205 $this->assertEquals( 'default', $theme['Template'] ); 206 $this->assertEquals( 'default', $theme['Stylesheet'] ); 207 $this->assertEquals( $this->theme_root.'/default/functions.php', $theme['Template Files'][0] ); 208 $this->assertEquals( $this->theme_root.'/default/index.php', $theme['Template Files'][1] ); 209 210 $this->assertEquals( $this->theme_root.'/default/style.css', $theme['Stylesheet Files'][0] ); 211 212 $this->assertEquals( $this->theme_root.'/default', $theme['Template Dir'] ); 213 $this->assertEquals( $this->theme_root.'/default', $theme['Stylesheet Dir'] ); 214 $this->assertEquals( 'publish', $theme['Status'] ); 215 $this->assertEquals( '', $theme['Parent Theme'] ); 216 217 } 218 219 function test_theme_sandbox() { 220 $themes = get_themes(); 221 222 $theme = $themes['Sandbox']; 223 $this->assertFalse( empty($theme) ); 224 225 #echo gen_tests_array('theme', $theme); 226 227 $this->assertEquals( 'Sandbox', $theme['Name'] ); 228 $this->assertEquals( 'Sandbox', $theme['Title'] ); 229 $this->assertEquals( 'A theme with powerful, semantic CSS selectors and the ability to add new skins.', $theme['Description'] ); 230 $this->assertEquals( '<a href="http://andy.wordpress.com/">Andy Skelton</a> & <a href="http://www.plaintxt.org/">Scott Allan Wallick</a>', $theme['Author'] ); 231 $this->assertEquals( '0.6.1-wpcom', $theme['Version'] ); 232 $this->assertEquals( 'sandbox', $theme['Template'] ); 233 $this->assertEquals( 'sandbox', $theme['Stylesheet'] ); 234 $this->assertEquals( $this->theme_root.'/sandbox/functions.php', $theme['Template Files'][0] ); 235 $this->assertEquals( $this->theme_root.'/sandbox/index.php', $theme['Template Files'][1] ); 236 237 $this->assertEquals( $this->theme_root.'/sandbox/style.css', $theme['Stylesheet Files'][0] ); 238 239 $this->assertEquals( $this->theme_root.'/sandbox', $theme['Template Dir'] ); 240 $this->assertEquals( $this->theme_root.'/sandbox', $theme['Stylesheet Dir'] ); 241 $this->assertEquals( 'publish', $theme['Status'] ); 242 $this->assertEquals( '', $theme['Parent Theme'] ); 243 244 } 245 246 // a css only theme 247 function test_theme_stylesheet_only() { 248 $themes = get_themes(); 249 250 $theme = $themes['Stylesheet Only']; 251 $this->assertFalse( empty($theme) ); 252 253 #echo gen_tests_array('theme', $theme); 254 255 $this->assertEquals( 'Stylesheet Only', $theme['Name'] ); 256 $this->assertEquals( 'Stylesheet Only', $theme['Title'] ); 257 $this->assertEquals( 'A three-column widget-ready theme in dark blue.', $theme['Description'] ); 258 $this->assertEquals( '<a href="http://www.example.com/" title="Visit author homepage">Henry Crun</a>', $theme['Author'] ); 259 $this->assertEquals( '1.0', $theme['Version'] ); 260 $this->assertEquals( 'sandbox', $theme['Template'] ); 261 $this->assertEquals( 'stylesheetonly', $theme['Stylesheet'] ); 262 $this->assertEquals( $this->theme_root.'/sandbox/functions.php', $theme['Template Files'][0] ); 263 $this->assertEquals( $this->theme_root.'/sandbox/index.php', $theme['Template Files'][1] ); 264 265 $this->assertEquals( $this->theme_root.'/stylesheetonly/style.css', $theme['Stylesheet Files'][0] ); 266 267 $this->assertEquals( $this->theme_root.'/sandbox', $theme['Template Dir'] ); 268 $this->assertEquals( $this->theme_root.'/stylesheetonly', $theme['Stylesheet Dir'] ); 269 $this->assertEquals( 'publish', $theme['Status'] ); 270 $this->assertEquals( 'Sandbox', $theme['Parent Theme'] ); 271 272 } 273 274 } 166 275 167 276 ?>
Note: See TracChangeset
for help on using the changeset viewer.