コード例 #1
0
 public function testCreateDisabled()
 {
     $config = CommandConfig::create()->setName('command')->disable();
     $applicationConfig = new ApplicationConfig();
     $application = new ConsoleApplication($applicationConfig);
     $applicationAdapter = new ApplicationAdapter($application);
     $command = new Command($config, $application);
     $adapter = new CommandAdapter($command, $applicationAdapter);
     $this->assertFalse($adapter->isEnabled());
 }
コード例 #2
0
 public function testCreate()
 {
     $config = ApplicationConfig::create()->setName('test-bin')->setDisplayName('Test Name')->setVersion('1.2.3')->setHelperSet($helperSet = new HelperSet())->beginCommand('command')->end();
     $application = new ConsoleApplication($config);
     $adapter = new ApplicationAdapter($application);
     $this->assertSame('Test Name', $adapter->getName());
     $this->assertSame('1.2.3', $adapter->getVersion());
     $this->assertSame('<info>Test Name</info> version <comment>1.2.3</comment>', $adapter->getLongVersion());
     $this->assertSame('<info>Test Name</info> version <comment>1.2.3</comment>', $adapter->getHelp());
     $this->assertSame($helperSet, $adapter->getHelperSet());
     $this->assertSame(array(), $adapter->getNamespaces());
     $this->assertEquals(new ArgsFormatInputDefinition($application->getGlobalArgsFormat()), $adapter->getDefinition());
     $commandAdapter = new CommandAdapter($application->getCommand('command'), $adapter);
     $commandAdapter->setApplication($adapter);
     $commandAdapter->setHelperSet($helperSet);
     $this->assertEquals($commandAdapter, $adapter->get('command'));
 }