Merge pull request #899 from romainneutron/plugins-absolute-dirs

[3.8] Fix generated twig paths for plugins : make them relative
This commit is contained in:
Nicolas Le Goff
2014-01-28 09:49:17 -08:00
2 changed files with 6 additions and 6 deletions

View File

@@ -196,19 +196,19 @@ EOF;
foreach ($manifests as $manifest) { foreach ($manifests as $manifest) {
$namespace = $this->quote('plugin-' . $manifest->getName()); $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); $path = $this->quote($path);
$buffer .= <<<EOF $buffer .= <<<EOF
$namespace => $path, $namespace => __DIR__ . $path,
EOF; EOF;
} }
foreach ($manifest->getTwigPaths() as $path) { 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 .= <<<EOF $buffer .= <<<EOF
$path, __DIR__ . $path,
EOF; EOF;
} }
} }

View File

@@ -65,7 +65,7 @@ class AutoloaderGeneratorTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('Vendor\CustomCommand', $cli['console']->find('hello:world')); $this->assertInstanceOf('Vendor\CustomCommand', $cli['console']->find('hello:world'));
$mapping = require $pluginsDir . '/twig-paths.php'; $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 . '/login.less'));
$this->assertRegExp('#@import#', file_get_contents($pluginsDir . '/account.less')); $this->assertRegExp('#@import#', file_get_contents($pluginsDir . '/account.less'));