Skip to content

Commit

Permalink
Adding test for themes in app/webroot dir. Closes cakephp#1061
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Sep 1, 2010
1 parent b02e213 commit 08d6c19
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions cake/tests/cases/libs/view/helpers/html.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 08d6c19

Please sign in to comment.