You are here

public function CommandTesterTest::testCommandFromApplication in Zircon Profile 8

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

File

vendor/symfony/console/Tests/Tester/CommandTesterTest.php, line 69

Class

CommandTesterTest

Namespace

Symfony\Component\Console\Tests\Tester

Code

public function testCommandFromApplication() {
  $application = new Application();
  $application
    ->setAutoExit(false);
  $command = new Command('foo');
  $command
    ->setCode(function ($input, $output) {
    $output
      ->writeln('foo');
  });
  $application
    ->add($command);
  $tester = new CommandTester($application
    ->find('foo'));

  // check that there is no need to pass the command name here
  $this
    ->assertEquals(0, $tester
    ->execute(array()));
}