registerConfigCommandAlias() публичный Метод

public registerConfigCommandAlias ( Command $command )
$command Symfony\Component\Console\Command\Command
Пример #1
0
 /**
  * Override standard command registration. We want alias support.
  *
  * @param \Symfony\Component\Console\Command\Command $command
  * @return \Symfony\Component\Console\Command\Command
  */
 public function add(Command $command)
 {
     if ($this->config) {
         $this->config->registerConfigCommandAlias($command);
     }
     return parent::add($command);
 }
Пример #2
0
 /**
  * @test
  */
 public function configCommandAlias()
 {
     $config = new Config();
     $input = new ArgvInput();
     $actual = $config->checkConfigCommandAlias($input);
     $this->assertInstanceOf('Symfony\\Component\\Console\\Input\\InputInterface', $actual);
     $saved = $_SERVER['argv'];
     $config->setConfig(array('commands' => array('aliases' => array(array('list-help' => 'list --help')))));
     $definition = new InputDefinition();
     $definition->addArgument(new InputArgument('command'));
     $argv = array('/path/to/command', 'list-help');
     $_SERVER['argv'] = $argv;
     $input = new ArgvInput($argv, $definition);
     $this->assertSame('list-help', (string) $input);
     $actual = $config->checkConfigCommandAlias($input);
     $this->assertSame('list-help', $actual->getFirstArgument());
     $this->assertSame('list-help --help', (string) $actual);
     $_SERVER['argv'] = $saved;
     $command = new Command('list');
     $config->registerConfigCommandAlias($command);
     $this->assertSame(array('list-help'), $command->getAliases());
 }