diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index a03327df3..c6b9bd377 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -109,7 +109,16 @@ class Application extends BaseApplication $io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet()); ErrorHandler::register($io); - if (!$input->hasParameterOption('--no-plugins') && !$this->hasPluginCommands) { + // determine command name to be executed without including plugin commands + $commandName = ''; + if ($name = $this->getCommandName($input)) { + try { + $commandName = $this->find($name)->getName(); + } catch (\InvalidArgumentException $e) { + } + } + + if (!$input->hasParameterOption('--no-plugins') && !$this->hasPluginCommands && 'global' !== $commandName) { foreach ($this->getPluginCommands() as $command) { if ($this->has($command->getName())) { $io->writeError('Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped'); @@ -120,8 +129,7 @@ class Application extends BaseApplication $this->hasPluginCommands = true; } - // determine command name to be executed, and if it's a proxy command - $commandName = ''; + // determine command name to be executed incl plugin commands, and check if it's a proxy command $isProxyCommand = false; if ($name = $this->getCommandName($input)) { try { diff --git a/tests/Composer/Test/ApplicationTest.php b/tests/Composer/Test/ApplicationTest.php index 823c2b4d1..b977b78e0 100644 --- a/tests/Composer/Test/ApplicationTest.php +++ b/tests/Composer/Test/ApplicationTest.php @@ -25,12 +25,12 @@ class ApplicationTest extends TestCase $inputMock = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $outputMock = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); - $inputMock->expects($this->once()) + $inputMock->expects($this->any()) ->method('hasParameterOption') ->with($this->equalTo('--no-plugins')) ->will($this->returnValue(true)); - $inputMock->expects($this->once()) + $inputMock->expects($this->any()) ->method('getFirstArgument') ->will($this->returnValue('list')); @@ -73,7 +73,7 @@ class ApplicationTest extends TestCase $inputMock = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $outputMock = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); - $inputMock->expects($this->once()) + $inputMock->expects($this->any()) ->method('getFirstArgument') ->will($this->returnValue($command));