You are here

public function ContainerAwareHttpKernelTest::testHandle in Zircon Profile 8

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

@dataProvider getProviderTypes

File

vendor/symfony/http-kernel/Tests/DependencyInjection/ContainerAwareHttpKernelTest.php, line 29

Class

ContainerAwareHttpKernelTest
@group legacy

Namespace

Symfony\Component\HttpKernel\Tests\DependencyInjection

Code

public function testHandle($type) {
  $request = new Request();
  $expected = new Response();
  $controller = function () use ($expected) {
    return $expected;
  };
  $container = $this
    ->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
  $this
    ->expectsEnterScopeOnce($container)
    ->expectsLeaveScopeOnce($container)
    ->expectsSetRequestWithAt($container, $request, 3)
    ->expectsSetRequestWithAt($container, null, 4);
  $dispatcher = new EventDispatcher();
  $resolver = $this
    ->getResolverMockFor($controller, $request);
  $stack = new RequestStack();
  $kernel = new ContainerAwareHttpKernel($dispatcher, $container, $resolver, $stack);
  $actual = $kernel
    ->handle($request, $type);
  $this
    ->assertSame($expected, $actual, '->handle() returns the response');
}