You are here

public function TestRunnerKernel::boot in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Test/TestRunnerKernel.php \Drupal\Core\Test\TestRunnerKernel::boot()

Boots the current kernel.

Return value

$this

Overrides DrupalKernel::boot

File

core/lib/Drupal/Core/Test/TestRunnerKernel.php, line 51
Contains \Drupal\Core\Test\TestRunnerKernel.

Class

TestRunnerKernel
Kernel for run-tests.sh.

Namespace

Drupal\Core\Test

Code

public function boot() {

  // Ensure that required Settings exist.
  if (!Settings::getAll()) {
    new Settings(array(
      'hash_salt' => 'run-tests',
      'container_yamls' => [],
      // If there is no settings.php, then there is no parent site. In turn,
      // there is no public files directory; use a custom public files path.
      'file_public_path' => 'sites/default/files',
    ));
  }

  // Remove Drupal's error/exception handlers; they are designed for HTML
  // and there is no storage nor a (watchdog) logger here.
  restore_error_handler();
  restore_exception_handler();

  // In addition, ensure that PHP errors are not hidden away in logs.
  ini_set('display_errors', TRUE);
  parent::boot();
  $this
    ->getContainer()
    ->get('module_handler')
    ->loadAll();
  simpletest_classloader_register();

  // Register stream wrappers.
  $this
    ->getContainer()
    ->get('stream_wrapper_manager')
    ->register();

  // Create the build/artifacts directory if necessary.
  include_once DRUPAL_ROOT . '/core/includes/file.inc';
  if (!is_dir('public://simpletest')) {
    mkdir('public://simpletest', 0777, TRUE);
  }
}