Navigation Menu

Skip to content

Commit

Permalink
Fixing delivery of plugin assets that reside in the root of a plugin …
Browse files Browse the repository at this point in the history
…webroot directory. Tests added.
  • Loading branch information
markstory committed Feb 17, 2010
1 parent e1eb827 commit 0b1efd3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cake/dispatcher.php
Expand Up @@ -617,7 +617,7 @@ function asset($url) {


if ($parts[0] === 'theme') { if ($parts[0] === 'theme') {
$pos = strlen($parts[0] . $parts[1]) + 1; $pos = strlen($parts[0] . $parts[1]) + 1;
} elseif (count($parts) > 2) { } else {
$pos = strlen($parts[0]); $pos = strlen($parts[0]);
} }
$assetFile = null; $assetFile = null;
Expand Down
6 changes: 6 additions & 0 deletions cake/tests/cases/dispatcher.test.php
Expand Up @@ -1904,6 +1904,12 @@ function testAssets() {
$result = ob_get_clean(); $result = ob_get_clean();
$this->assertEqual('nested theme js file', $result); $this->assertEqual('nested theme js file', $result);


ob_start();
$Dispatcher->asset('test_plugin/root.js');
$result = ob_get_clean();
$expected = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS . 'webroot' . DS . 'root.js');
$this->assertEqual($result, $expected);

ob_start(); ob_start();
$Dispatcher->dispatch('test_plugin/flash/plugin_test.swf'); $Dispatcher->dispatch('test_plugin/flash/plugin_test.swf');
$result = ob_get_clean(); $result = ob_get_clean();
Expand Down
1 change: 1 addition & 0 deletions cake/tests/test_app/plugins/test_plugin/webroot/root.js
@@ -0,0 +1 @@
alert('I am a root level file!');

0 comments on commit 0b1efd3

Please sign in to comment.