You are here

public function InlineFragmentRendererTest::testExceptionInSubRequestsDoesNotMangleOutputBuffers in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php \Symfony\Component\HttpKernel\Tests\Fragment\InlineFragmentRendererTest::testExceptionInSubRequestsDoesNotMangleOutputBuffers()

File

vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php, line 143

Class

InlineFragmentRendererTest

Namespace

Symfony\Component\HttpKernel\Tests\Fragment

Code

public function testExceptionInSubRequestsDoesNotMangleOutputBuffers() {
  $resolver = $this
    ->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface');
  $resolver
    ->expects($this
    ->once())
    ->method('getController')
    ->will($this
    ->returnValue(function () {
    ob_start();
    echo 'bar';
    throw new \RuntimeException();
  }));
  $resolver
    ->expects($this
    ->once())
    ->method('getArguments')
    ->will($this
    ->returnValue(array()));
  $kernel = new HttpKernel(new EventDispatcher(), $resolver);
  $renderer = new InlineFragmentRenderer($kernel);

  // simulate a main request with output buffering
  ob_start();
  echo 'Foo';

  // simulate a sub-request with output buffering and an exception
  $renderer
    ->render('/', Request::create('/'), array(
    'ignore_errors' => true,
  ));
  $this
    ->assertEquals('Foo', ob_get_clean());
}