Skip to content
Permalink
Browse files

Fixing building of the right vendor path in the dispatcher in the cas…

…e the plugin name appears again in the path
  • Loading branch information...
burzum committed Aug 12, 2009
1 parent 9363a61 commit 417bdb4514256fe925461fe96270beb906d0e633
@@ -619,15 +619,14 @@ function cached($url) {
if ($pos > 0) {
$plugin = substr($url, 0, $pos - 1);
$url = str_replace($plugin . '/', '', $url);
$url = preg_replace('/^' . preg_quote($plugin) . '\//i', '', $url);
$pluginPaths = Configure::read('pluginPaths');
$count = count($pluginPaths);
for ($i = 0; $i < $count; $i++) {
$paths[] = $pluginPaths[$i] . $plugin . DS . 'vendors' . DS;
}
}
$paths = array_merge($paths, Configure::read('vendorPaths'));
foreach ($paths as $path) {
if (is_file($path . $url) && file_exists($path . $url)) {
$assetFile = $path . $url;
@@ -1700,13 +1700,28 @@ function testStaticAssets() {
$this->assertEqual('this is the test asset css file', $result);
ob_start();
$Dispatcher->cached('test_plugin/js/test_plugin/test.js');
$result = ob_get_clean();
$this->assertEqual('alert("Test App");', $result);
Configure::write('debug', 0);
$Dispatcher->params = $Dispatcher->parseParams('test_plugin/js/test_plugin/test.js');
ob_start();
$Dispatcher->cached('test_plugin/js/test_plugin/test.js');
$result = ob_get_clean();
$this->assertEqual('alert("Test App");', $result);
Configure::write('debug', 0);
$Dispatcher->params = $Dispatcher->parseParams('test_plugin/css/test_plugin_asset.css');
ob_start();
$Dispatcher->cached('test_plugin/css/test_plugin_asset.css');
$result = ob_get_clean();
$this->assertEqual('this is the test plugin asset css file', $result);
Configure::write('debug', 0);
$Dispatcher->params = $Dispatcher->parseParams('test_plugin/img/cake.icon.gif');
ob_start();

0 comments on commit 417bdb4

Please sign in to comment.
You can’t perform that action at this time.