function PageCacheLegacyTest::testDeprecatedKernelArgument

Tests that page cache is constructed with a http kernel argument.

File

core/modules/page_cache/tests/src/Unit/PageCacheLegacyTest.php, line 27

Class

PageCacheLegacyTest
Tests \Drupal\page_cache\StackMiddleware\PageCache.

Namespace

Drupal\Tests\page_cache\Unit

Code

public function testDeprecatedKernelArgument() : void {
  $kernel = $this->createStub(HttpKernelInterface::class);
  $cache = $this->createStub(CacheBackendInterface::class);
  $requestPolicy = $this->createStub(RequestPolicyInterface::class);
  $responsePolicy = $this->createStub(ResponsePolicyInterface::class);
  $this->expectDeprecation('Calling Drupal\\page_cache\\StackMiddleware\\PageCache::__construct() without a service closure $http_kernel argument is deprecated in drupal:11.3.0 and it will throw an error in drupal:12.0.0. See https://www.drupal.org/node/3538740');
  new PageCache($kernel, $cache, $requestPolicy, $responsePolicy);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.