From 780ea6f50484c8d3acdeccb6575d4032a2ed4d7e Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 28 Jan 2014 17:22:50 +0100 Subject: [PATCH] Fix generated twig paths for plugins : make them relative --- .../Phrasea/Plugin/Management/AutoloaderGenerator.php | 10 +++++----- .../Plugin/Management/AutoloaderGeneratorTest.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Alchemy/Phrasea/Plugin/Management/AutoloaderGenerator.php b/lib/Alchemy/Phrasea/Plugin/Management/AutoloaderGenerator.php index 798df0015a..2e126c3788 100644 --- a/lib/Alchemy/Phrasea/Plugin/Management/AutoloaderGenerator.php +++ b/lib/Alchemy/Phrasea/Plugin/Management/AutoloaderGenerator.php @@ -196,19 +196,19 @@ EOF; foreach ($manifests as $manifest) { $namespace = $this->quote('plugin-' . $manifest->getName()); - $path = $this->pluginDirectory . DIRECTORY_SEPARATOR . $manifest->getName() . DIRECTORY_SEPARATOR . 'views'; + $path = DIRECTORY_SEPARATOR . $manifest->getName() . DIRECTORY_SEPARATOR . 'views'; - if (is_dir($path)) { + if (is_dir($this->pluginDirectory . $path)) { $path = $this->quote($path); $buffer .= << $path, + $namespace => __DIR__ . $path, EOF; } foreach ($manifest->getTwigPaths() as $path) { - $path = $this->quote($this->pluginDirectory . DIRECTORY_SEPARATOR . $manifest->getName() . DIRECTORY_SEPARATOR . $path); + $path = $this->quote(DIRECTORY_SEPARATOR . $manifest->getName() . DIRECTORY_SEPARATOR . $path); $buffer .= <<assertInstanceOf('Vendor\CustomCommand', $cli['console']->find('hello:world')); $mapping = require $pluginsDir . '/twig-paths.php'; - $this->assertSame(array('plugin-test-plugin' => $pluginsDir . '/test-plugin/views', $pluginsDir . '/test-plugin/views', $pluginsDir . '/test-plugin/twig-views'), $mapping); + $this->assertSame(array('plugin-test-plugin' => realpath($pluginsDir) . '/test-plugin/views', realpath($pluginsDir) . '/test-plugin/views', realpath($pluginsDir) . '/test-plugin/twig-views'), $mapping); $this->assertRegExp('#@import#', file_get_contents($pluginsDir . '/login.less')); $this->assertRegExp('#@import#', file_get_contents($pluginsDir . '/account.less'));