function DrupalKernelTest::testPreventChangeOfSitePath
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php \Drupal\KernelTests\Core\DrupalKernel\DrupalKernelTest::testPreventChangeOfSitePath()
- 10 core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php \Drupal\KernelTests\Core\DrupalKernel\DrupalKernelTest::testPreventChangeOfSitePath()
- 11.x core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php \Drupal\KernelTests\Core\DrupalKernel\DrupalKernelTest::testPreventChangeOfSitePath()
Tests setting of site path after kernel boot.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ DrupalKernel/ DrupalKernelTest.php, line 169
Class
- DrupalKernelTest
- Tests DIC compilation to disk.
Namespace
Drupal\KernelTests\Core\DrupalKernelCode
public function testPreventChangeOfSitePath() {
// @todo: write a memory based storage backend for testing.
$modules_enabled = [
'system' => 'system',
'user' => 'user',
];
$request = Request::createFromGlobals();
$kernel = $this->getTestKernel($request, $modules_enabled);
$pass = FALSE;
try {
$kernel->setSitePath('/dev/null');
} catch (\LogicException $e) {
$pass = TRUE;
}
$this->assertTrue($pass, 'Throws LogicException if DrupalKernel::setSitePath() is called after boot');
// Ensure no LogicException if DrupalKernel::setSitePath() is called with
// identical path after boot.
$path = $kernel->getSitePath();
$kernel->setSitePath($path);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.