function StackKernelIntegrationTest::testServiceClosureMiddlewares
Tests that service closure middleware avoids creation of http kernel.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ HttpKernel/ StackKernelIntegrationTest.php, line 40
Class
- StackKernelIntegrationTest
- Tests the stacked kernel functionality.
Namespace
Drupal\KernelTests\Core\HttpKernelCode
public function testServiceClosureMiddlewares() : void {
$this->assertFalse(\Drupal::getContainer()->initialized('http_kernel.basic'));
\Drupal::service('http_kernel');
$this->assertTrue(\Drupal::getContainer()->initialized('http_kernel.basic'));
// Page cache provides a service closure middleware.
\Drupal::service('module_installer')->install([
'page_cache',
]);
$this->assertFalse(\Drupal::getContainer()->initialized('http_kernel.basic'));
\Drupal::service('http_kernel');
$this->assertFalse(\Drupal::getContainer()->initialized('http_kernel.basic'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.