Exemple #1
0
 public function testGetDisplay()
 {
     $this->provider->alias('Danack\\Console\\Output\\Output', get_class($this->tester->getOutput()));
     $this->provider->share($this->tester->getOutput());
     $callable = $this->parsedCommand->getCallable();
     $this->provider->execute($callable, []);
     $foo = $this->tester->getDisplay();
     $this->assertEquals('foo' . PHP_EOL, $foo, '->getDisplay() returns the display of the last execution');
 }
Exemple #2
0
 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');
 }
Exemple #3
0
    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));
    }
Exemple #4
0
 public function testRunInteractive()
 {
     $tester = new CommandTester(new \TestCommand());
     $tester->execute(array(), array('interactive' => true));
     $this->assertEquals('interact called' . PHP_EOL, $tester->getDisplay(), '->run() calls the interact() method if the input is interactive');
 }