You are here

public function ApplicationTest::testRunDispatchesAllEventsWithException in Zircon Profile 8.0

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

File

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

Class

ApplicationTest

Namespace

Symfony\Component\Console\Tests

Code

public function testRunDispatchesAllEventsWithException() {
  $application = new Application();
  $application
    ->setDispatcher($this
    ->getDispatcher());
  $application
    ->setAutoExit(false);
  $application
    ->register('foo')
    ->setCode(function (InputInterface $input, OutputInterface $output) {
    $output
      ->write('foo.');
    throw new \RuntimeException('foo');
  });
  $tester = new ApplicationTester($application);
  $tester
    ->run(array(
    'command' => 'foo',
  ));
  $this
    ->assertContains('before.foo.caught.after.', $tester
    ->getDisplay());
}