public function testExecuteForApplicationCommandWithXmlOption() { $application = new Application(); $commandTester = new CommandTester($application->get('help')); $parsedCommand = $commandTester->execute(array('command_name' => 'list', '--format' => 'xml')); $provider = new Provider(); $provider->execute($parsedCommand->getCallable(), []); $this->assertRegExp('/list \\[--xml\\] \\[--raw\\] \\[--format="\\.\\.\\."\\] \\[namespace\\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); $this->assertRegExp('/<command/', $commandTester->getDisplay(), '->execute() returns an XML help text if --format=xml is passed'); }
public function testExecuteListsCommandsWithNamespaceArgument() { require_once realpath(__DIR__ . '/../Fixtures/FooCommand.php'); $application = new Application(); $application->add(new \FooCommand()); $commandTester = new CommandTester($command = $application->get('list')); $parsedCommand = $commandTester->execute(array('command' => $command->getName(), 'namespace' => 'foo', '--raw' => true)); /** @var $parsedCommand ParsedCommand */ $injector = new \Auryn\Provider(); $injector->execute($parsedCommand->getCallable()); $output = <<<EOF foo:bar The foo:bar command EOF; $this->assertEquals($output, $commandTester->getDisplay(true)); }
/** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The command "foofoo" does not exist. */ public function testGetInvalidCommand() { $application = new Application(); $application->get('foofoo'); }