You are here

protected function KernelTestBase::prepareTemplate in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::prepareTemplate()
  2. 9 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::prepareTemplate()

File

core/tests/Drupal/KernelTests/KernelTestBase.php, line 981

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

protected function prepareTemplate(\Text_Template $template) {
  $bootstrap_globals = '';

  // Fix missing bootstrap.php when $preserveGlobalState is FALSE.
  // @see https://github.com/sebastianbergmann/phpunit/pull/797
  $bootstrap_globals .= '$__PHPUNIT_BOOTSTRAP = ' . var_export($GLOBALS['__PHPUNIT_BOOTSTRAP'], TRUE) . ";\n";

  // Avoid repetitive test namespace discoveries to improve performance.
  // @see /core/tests/bootstrap.php
  $bootstrap_globals .= '$namespaces = ' . var_export($GLOBALS['namespaces'], TRUE) . ";\n";
  $template
    ->setVar([
    'constants' => '',
    'included_files' => '',
    'globals' => $bootstrap_globals,
  ]);
}