You are here

public function ApplicationTest::testSetRunCustomDefaultCommand in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Tests/ApplicationTest.php \Symfony\Component\Console\Tests\ApplicationTest::testSetRunCustomDefaultCommand()

File

vendor/symfony/console/Tests/ApplicationTest.php, line 983

Class

ApplicationTest

Namespace

Symfony\Component\Console\Tests

Code

public function testSetRunCustomDefaultCommand() {
  $command = new \FooCommand();
  $application = new Application();
  $application
    ->setAutoExit(false);
  $application
    ->add($command);
  $application
    ->setDefaultCommand($command
    ->getName());
  $tester = new ApplicationTester($application);
  $tester
    ->run(array());
  $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);
  $tester
    ->run(array());
  $this
    ->assertEquals('interact called' . PHP_EOL . 'called' . PHP_EOL, $tester
    ->getDisplay(), 'Application runs the default set command if different from \'list\' command');
}