Ejemplo n.º 1
0
 public function testCreate()
 {
     $config = CommandConfig::create()->setName('command')->addAlias('alias1')->addAlias('alias2')->setDescription('Description of the command')->setHelp('The help for %command.name%')->addArgument('argument')->addOption('option', 'o')->setHelperSet($helperSet = new HelperSet());
     $applicationConfig = new ApplicationConfig();
     $application = new ConsoleApplication($applicationConfig);
     $applicationAdapter = new ApplicationAdapter($application);
     $command = new Command($config, $application);
     $adapter = new CommandAdapter($command, $applicationAdapter);
     $this->assertSame('command', $adapter->getName());
     $this->assertEquals(new ArgsFormatInputDefinition($command->getArgsFormat()), $adapter->getDefinition());
     $this->assertEquals(new ArgsFormatInputDefinition($command->getArgsFormat()), $adapter->getNativeDefinition());
     $this->assertSame($command, $adapter->getAdaptedCommand());
     $this->assertSame(array('alias1', 'alias2'), $adapter->getAliases());
     $this->assertSame($applicationAdapter, $adapter->getApplication());
     $this->assertSame('Description of the command', $adapter->getDescription());
     $this->assertSame('The help for %command.name%', $adapter->getHelp());
     $this->assertSame('The help for command', $adapter->getProcessedHelp());
     $this->assertSame($helperSet, $adapter->getHelperSet());
     $this->assertSame('command [-o|--option] [--] <cmd1> [<argument>]', $adapter->getSynopsis());
     $this->assertTrue($adapter->isEnabled());
 }