You are here

public function HttpCacheTest::testTerminateDelegatesTerminationOnlyForTerminableInterface in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php \Symfony\Component\HttpKernel\Tests\HttpCache\HttpCacheTest::testTerminateDelegatesTerminationOnlyForTerminableInterface()

File

vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php, line 20

Class

HttpCacheTest

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public function testTerminateDelegatesTerminationOnlyForTerminableInterface() {
  $storeMock = $this
    ->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpCache\\StoreInterface')
    ->disableOriginalConstructor()
    ->getMock();

  // does not implement TerminableInterface
  $kernelMock = $this
    ->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpKernelInterface')
    ->disableOriginalConstructor()
    ->getMock();
  $kernelMock
    ->expects($this
    ->never())
    ->method('terminate');
  $kernel = new HttpCache($kernelMock, $storeMock);
  $kernel
    ->terminate(Request::create('/'), new Response());

  // implements TerminableInterface
  $kernelMock = $this
    ->getMockBuilder('Symfony\\Component\\HttpKernel\\Kernel')
    ->disableOriginalConstructor()
    ->setMethods(array(
    'terminate',
    'registerBundles',
    'registerContainerConfiguration',
  ))
    ->getMock();
  $kernelMock
    ->expects($this
    ->once())
    ->method('terminate');
  $kernel = new HttpCache($kernelMock, $storeMock);
  $kernel
    ->terminate(Request::create('/'), new Response());
}