diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php index 3426f6f9a249..895973d7c425 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php @@ -19,7 +19,14 @@ public function testAutoloadMainExtension() { $container = $this->getMock( 'Symfony\\Component\\DependencyInjection\\ContainerBuilder', - array('getExtensionConfig', 'loadFromExtension', 'getParameterBag') + array( + 'getExtensionConfig', + 'loadFromExtension', + 'getParameterBag', + 'getDefinitions', + 'getAliases', + 'getExtensions', + ) ); $params = $this->getMock('Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag'); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php index 271aaf5b2bca..7be9b9e6d5bf 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php @@ -104,9 +104,6 @@ public function testSubRequestWithDifferentMethod() ->will($this->returnValue(array())); $context = new RequestContext(); - $requestMatcher->expects($this->any()) - ->method('getContext') - ->will($this->returnValue($context)); $listener = new RouterListener($requestMatcher, new RequestContext()); $listener->onKernelRequest($event); diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php index 421b1b1fcdf5..358b89c52ade 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php @@ -14,6 +14,7 @@ use Symfony\Component\HttpKernel\HttpCache\HttpCache; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\HttpKernelInterface; /** * @group time-sensitive @@ -27,15 +28,11 @@ public function testTerminateDelegatesTerminationOnlyForTerminableInterface() ->getMock(); // does not implement TerminableInterface - $kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpKernelInterface') - ->disableOriginalConstructor() - ->getMock(); - - $kernelMock->expects($this->never()) - ->method('terminate'); + $kernel = new TestKernel(); + $httpCache = new HttpCache($kernel, $storeMock); + $httpCache->terminate(Request::create('/'), new Response()); - $kernel = new HttpCache($kernelMock, $storeMock); - $kernel->terminate(Request::create('/'), new Response()); + $this->assertFalse($kernel->terminateCalled, 'terminate() is never called if the kernel class does not implement TerminableInterface'); // implements TerminableInterface $kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Kernel') @@ -1228,3 +1225,17 @@ public function testEsiCacheRemoveValidationHeadersIfEmbeddedResponses() $this->assertNull($this->response->getLastModified()); } } + +class TestKernel implements HttpKernelInterface +{ + public $terminateCalled = false; + + public function terminate(Request $request, Response $response) + { + $this->terminateCalled = true; + } + + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) + { + } +} diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index fa1294e80654..ee3b48143007 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -806,13 +806,7 @@ public function testTerminateReturnsSilentlyIfKernelIsNotBooted() public function testTerminateDelegatesTerminationOnlyForTerminableInterface() { // does not implement TerminableInterface - $httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface') - ->disableOriginalConstructor() - ->getMock(); - - $httpKernelMock - ->expects($this->never()) - ->method('terminate'); + $httpKernel = new TestKernel(); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest') ->disableOriginalConstructor() @@ -821,11 +815,13 @@ public function testTerminateDelegatesTerminationOnlyForTerminableInterface() $kernel->expects($this->once()) ->method('getHttpKernel') - ->will($this->returnValue($httpKernelMock)); + ->willReturn($httpKernel); $kernel->setIsBooted(true); $kernel->terminate(Request::create('/'), new Response()); + $this->assertFalse($httpKernel->terminateCalled, 'terminate() is never called if the kernel class does not implement TerminableInterface'); + // implements TerminableInterface $httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel') ->disableOriginalConstructor() @@ -903,3 +899,17 @@ protected function getKernelForInvalidLocateResource() ; } } + +class TestKernel implements HttpKernelInterface +{ + public $terminateCalled = false; + + public function terminate() + { + $this->terminateCalled = true; + } + + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) + { + } +}