From c1d88a13cdf41e8806eacb1058f97a6db1445a94 Mon Sep 17 00:00:00 2001 From: nevvermind Date: Fri, 1 May 2015 18:22:26 +0100 Subject: [PATCH] Fixes wrong value returned when getting the vendor dir through PluginConfig When using `\MagentoHackathon\Composer\Magento\ProjectConfig::getVendorDir()`, the passed array didn't contain the "vendor-dir" key, so the default value was always returned, irrelevant of the configuration in "composer.json". Also, the said method must always return the absolute path to the vendor folder, as it's the case with Composer. --- src/MagentoHackathon/Composer/Magento/ProjectConfig.php | 6 +++++- .../MagentoHackathon/Composer/Magento/ModuleManagerTest.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/MagentoHackathon/Composer/Magento/ProjectConfig.php b/src/MagentoHackathon/Composer/Magento/ProjectConfig.php index 381a4cc6..6c4853c4 100644 --- a/src/MagentoHackathon/Composer/Magento/ProjectConfig.php +++ b/src/MagentoHackathon/Composer/Magento/ProjectConfig.php @@ -437,7 +437,11 @@ public function getComposerRepositories() */ public function getVendorDir() { - return $this->fetchVarFromConfigArray($this->composerConfig, 'vendor-dir', 'vendor'); + return $this->fetchVarFromConfigArray( + $this->composerConfig['config'], + 'vendor-dir', + getcwd() . '/vendor' + ); } /** diff --git a/tests/MagentoHackathon/Composer/Magento/ModuleManagerTest.php b/tests/MagentoHackathon/Composer/Magento/ModuleManagerTest.php index 14a8eafb..a46fcc94 100644 --- a/tests/MagentoHackathon/Composer/Magento/ModuleManagerTest.php +++ b/tests/MagentoHackathon/Composer/Magento/ModuleManagerTest.php @@ -30,7 +30,7 @@ public function setUp() new InstalledPackageDumper() ); - $config = new ProjectConfig(array(), array('vendor-dir' => 'vendor')); + $config = new ProjectConfig(array(), array('config' => array('vendor-dir' => 'vendor'))); $this->unInstallStrategy = $this->getMock('MagentoHackathon\Composer\Magento\UnInstallStrategy\UnInstallStrategyInterface');