コード例 #1
0
 public function testGetDisplay()
 {
     $output = $this->tester->getOutput();
     $this->provider->alias('Danack\\Console\\Output\\Output', get_class($output));
     $this->provider->share($output);
     $callable = $this->parsedCommand->getCallable();
     $this->provider->execute($callable, []);
     $this->assertEquals('foo' . PHP_EOL, $this->tester->getDisplay(), '->getDisplay() returns the display of the last execution');
 }
コード例 #2
0
ファイル: ApplicationTest.php プロジェクト: Danack/Console
 public function testSetRunCustomDefaultCommand()
 {
     $command = new \FooCommand();
     $application = new Application();
     $application->setAutoExit(false);
     $application->add($command);
     $application->setDefaultCommand($command->getName());
     $tester = new ApplicationTester($application);
     $parsedCommand = $tester->run(array());
     $provider = new Provider();
     $provider->execute($parsedCommand->getCallable(), []);
     $this->assertEquals('interact called' . PHP_EOL . 'called' . PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command');
     $application = new CustomDefaultCommandApplication();
     $application->setAutoExit(false);
     $tester = new ApplicationTester($application);
     $parsedCommand = $tester->run(array());
     $provider->execute($parsedCommand->getCallable(), []);
     $this->assertEquals('interact called' . PHP_EOL . 'called' . PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command');
 }