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()); }
public function testStaticCreateWithName() { $config = CommandConfig::create('command', $this->applicationConfig); $this->assertSame('command', $config->getName()); $this->assertSame($this->applicationConfig, $config->getApplicationConfig()); }
public function testGetAliases() { $ls = new Command(CommandConfig::create('ls')->addAlias('ls-alias')); $cd = new Command(CommandConfig::create('cd')->addAlias('cd-alias')); $this->collection->add($ls); $this->collection->add($cd); $this->assertSame(array('cd-alias' => 'cd', 'ls-alias' => 'ls'), $this->collection->getAliases()); }
/** * @dataProvider getInputOutput */ public function testFindSimilarNames($input, array $suggestions) { $commands = new CommandCollection(array(new Command(CommandConfig::create('package')->addAlias('package-alias')), new Command(CommandConfig::create('pack')->addAlias('pack-alias')), new Command(CommandConfig::create('pack')))); $this->assertSame($suggestions, SimilarCommandName::find($input, $commands)); }
public function testGetCommandsExcludesDisabledCommands() { $this->config->addCommandConfig($enabled = CommandConfig::create('command1')->enable()); $this->config->addCommandConfig($disabled = CommandConfig::create('command2')->disable()); $application = new ConsoleApplication($this->config); $this->assertEquals(new CommandCollection(array(new Command($enabled, $application))), $application->getCommands()); }