Avoiding defining plugin commands using the local project plugins, refs #5277
parent
92207da83a
commit
591cbcee12
|
@ -109,7 +109,16 @@ class Application extends BaseApplication
|
||||||
$io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
|
$io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
|
||||||
ErrorHandler::register($io);
|
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) {
|
foreach ($this->getPluginCommands() as $command) {
|
||||||
if ($this->has($command->getName())) {
|
if ($this->has($command->getName())) {
|
||||||
$io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
|
$io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
|
||||||
|
@ -120,8 +129,7 @@ class Application extends BaseApplication
|
||||||
$this->hasPluginCommands = true;
|
$this->hasPluginCommands = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine command name to be executed, and if it's a proxy command
|
// determine command name to be executed incl plugin commands, and check if it's a proxy command
|
||||||
$commandName = '';
|
|
||||||
$isProxyCommand = false;
|
$isProxyCommand = false;
|
||||||
if ($name = $this->getCommandName($input)) {
|
if ($name = $this->getCommandName($input)) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -25,12 +25,12 @@ class ApplicationTest extends TestCase
|
||||||
$inputMock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
|
$inputMock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
|
||||||
$outputMock = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
|
$outputMock = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
|
||||||
|
|
||||||
$inputMock->expects($this->once())
|
$inputMock->expects($this->any())
|
||||||
->method('hasParameterOption')
|
->method('hasParameterOption')
|
||||||
->with($this->equalTo('--no-plugins'))
|
->with($this->equalTo('--no-plugins'))
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
|
|
||||||
$inputMock->expects($this->once())
|
$inputMock->expects($this->any())
|
||||||
->method('getFirstArgument')
|
->method('getFirstArgument')
|
||||||
->will($this->returnValue('list'));
|
->will($this->returnValue('list'));
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ class ApplicationTest extends TestCase
|
||||||
$inputMock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
|
$inputMock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
|
||||||
$outputMock = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
|
$outputMock = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
|
||||||
|
|
||||||
$inputMock->expects($this->once())
|
$inputMock->expects($this->any())
|
||||||
->method('getFirstArgument')
|
->method('getFirstArgument')
|
||||||
->will($this->returnValue($command));
|
->will($this->returnValue($command));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue