Permalink
Browse files

Adding test for themes in app/webroot dir. Closes #1061

  • Loading branch information...
markstory committed Sep 1, 2010
1 parent b02e213 commit 08d6c19ab6aa65f68226d7dafd0a3ab27bd7ea26
Showing with 28 additions and 0 deletions.
  1. +28 −0 cake/tests/cases/libs/view/helpers/html.test.php
@@ -626,6 +626,34 @@ function testScript() {
$this->assertNull($result);
}
+/**
+ * test a script file in the webroot/theme dir.
+ *
+ * @return void
+ */
+ function testScriptInTheme() {
+ if ($this->skipIf(!is_writable(WWW_ROOT . 'theme'), 'Cannot write to webroot/theme')) {
+ return;
+ }
+ App::import('Core', 'File');
+
+ $testfile = WWW_ROOT . 'theme' . DS . 'test_theme' . DS . 'js' . DS . '__test_js.js';
+ $file =& new File($testfile, true);
+
+ App::build(array(
+ 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
+ ));
+
+ $this->Html->webroot = '/';
+ $this->Html->theme = 'test_theme';
+ $result = $this->Html->script('__test_js.js');
+ $expected = array(
+ 'script' => array('src' => '/theme/test_theme/js/__test_js.js', 'type' => 'text/javascript')
+ );
+ $this->assertTags($result, $expected);
+ App::build();
+ }
+
/**
* test Script block generation
*

0 comments on commit 08d6c19

Please sign in to comment.