You are here

public function DrupalKernelTest::testPreventChangeOfSitePath in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php \Drupal\system\Tests\DrupalKernel\DrupalKernelTest::testPreventChangeOfSitePath()

Tests setting of site path after kernel boot.

File

core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php, line 183
Contains \Drupal\system\Tests\DrupalKernel\DrupalKernelTest.

Class

DrupalKernelTest
Tests DIC compilation to disk.

Namespace

Drupal\system\Tests\DrupalKernel

Code

public function testPreventChangeOfSitePath() {

  // @todo: write a memory based storage backend for testing.
  $modules_enabled = array(
    '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');
}