You are here

public function TestKernel::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Test/TestKernel.php \Drupal\Core\Test\TestKernel::__construct()
  2. 10 core/lib/Drupal/Core/Test/TestKernel.php \Drupal\Core\Test\TestKernel::__construct()

Constructs a DrupalKernel object.

Parameters

string $environment: String indicating the environment, e.g. 'prod' or 'dev'.

$class_loader: The class loader. Normally \Composer\Autoload\ClassLoader, as included by the front controller, but may also be decorated; e.g., \Symfony\Component\ClassLoader\ApcClassLoader.

bool $allow_dumping: (optional) FALSE to stop the container from being written to or read from disk. Defaults to TRUE.

string $app_root: (optional) The path to the application root as a string. If not supplied, the application root will be computed.

Overrides DrupalKernel::__construct

File

core/lib/Drupal/Core/Test/TestKernel.php, line 15

Class

TestKernel
Kernel to mock requests to test simpletest.

Namespace

Drupal\Core\Test

Code

public function __construct($environment, $class_loader, $allow_dumping = TRUE) {

  // Include our bootstrap file.
  require_once __DIR__ . '/../../../../includes/bootstrap.inc';

  // Exit if we should be in a test environment but aren't.
  if (!drupal_valid_test_ua()) {
    header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
    exit;
  }
  parent::__construct($environment, $class_loader, $allow_dumping);
}