Permalink
Browse files

Fixing delivery of plugin assets that reside in the root of a plugin …

…webroot directory. Tests added.
  • Loading branch information...
1 parent e1eb827 commit 0b1efd3e86084dd65ab78e799d879e835cefe99f @markstory markstory committed Feb 17, 2010
View
@@ -617,7 +617,7 @@ function asset($url) {
if ($parts[0] === 'theme') {
$pos = strlen($parts[0] . $parts[1]) + 1;
- } elseif (count($parts) > 2) {
+ } else {
$pos = strlen($parts[0]);
}
$assetFile = null;
@@ -1905,6 +1905,12 @@ function testAssets() {
$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();
$Dispatcher->dispatch('test_plugin/flash/plugin_test.swf');
$result = ob_get_clean();
$file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS . 'webroot' . DS . 'flash' . DS . 'plugin_test.swf');
@@ -0,0 +1 @@
+alert('I am a root level file!');

0 comments on commit 0b1efd3

Please sign in to comment.