diff --git a/src/Console/Command/Task/PluginTask.php b/src/Console/Command/Task/PluginTask.php index 969a2fb6d30..e2072d622a8 100644 --- a/src/Console/Command/Task/PluginTask.php +++ b/src/Console/Command/Task/PluginTask.php @@ -213,6 +213,14 @@ protected function _generateTestBootstrap($plugin, $path) { $this->createFile($file, $out); } +/** + * Modifies App's coposer.json to include the plugin and tries to call + * composer dump-autoload to refresh the autoloader cache + * + * @param string $plugin Name of plugin + * @param string $path The path to save the phpunit.xml file to. + * @return boolean True if composer could be modified correctly + */ protected function _modifyAutoloader($plugin, $path) { $path = dirname($path); @@ -239,7 +247,8 @@ protected function _modifyAutoloader($plugin, $path) { } try { - $command = 'php ' . escapeshellarg($composer) . ' dump-autoload '; + $command = 'cd ' . escapeshellarg($path) . '; '; + $command .= 'php ' . escapeshellarg($composer) . ' dump-autoload '; $this->Project->callComposer($command); } catch (\RuntimeException $e) { $error = $e->getMessage();