public function DrupalKernelTest::testRepeatedBootWithDifferentEnvironment in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php \Drupal\KernelTests\Core\DrupalKernel\DrupalKernelTest::testRepeatedBootWithDifferentEnvironment()
- 9 core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php \Drupal\KernelTests\Core\DrupalKernel\DrupalKernelTest::testRepeatedBootWithDifferentEnvironment()
Tests repeated loading of compiled DIC with different environment.
File
- core/
tests/ Drupal/ KernelTests/ Core/ DrupalKernel/ DrupalKernelTest.php, line 146
Class
- DrupalKernelTest
- Tests DIC compilation to disk.
Namespace
Drupal\KernelTests\Core\DrupalKernelCode
public function testRepeatedBootWithDifferentEnvironment() {
$request = Request::createFromGlobals();
$class_loader = (require $this->root . '/autoload.php');
$environments = [
'testing1',
'testing1',
'testing2',
'testing2',
];
foreach ($environments as $environment) {
$kernel = DrupalKernel::createFromRequest($request, $class_loader, $environment);
$this
->setSetting('container_yamls', []);
$this
->setSetting('hash_salt', $this->databasePrefix);
$this
->assertInstanceOf(DrupalKernelInterface::class, $kernel
->boot(), "Environment {$environment} should boot.");
}
}