function DebugDump::bootstrap

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/TestTools/Extension/Dump/DebugDump.php \Drupal\TestTools\Extension\Dump\DebugDump::bootstrap()

File

core/tests/Drupal/TestTools/Extension/Dump/DebugDump.php, line 41

Class

DebugDump
Drupal's extension for printing dump() output results.

Namespace

Drupal\TestTools\Extension\Dump

Code

public function bootstrap(Configuration $configuration, Facade $facade, ParameterCollection $parameters) : void {
  // Determine staging file path.
  self::$stagingFilePath = tempnam(sys_get_temp_dir(), 'dpd');
  // Determine color output.
  $colors = $parameters->has('colors') ? $parameters->get('colors') : FALSE;
  self::$colors = filter_var($colors, \FILTER_VALIDATE_BOOLEAN);
  // Print caller.
  $printCaller = $parameters->has('printCaller') ? $parameters->get('printCaller') : FALSE;
  self::$printCaller = filter_var($printCaller, \FILTER_VALIDATE_BOOLEAN);
  // Set the environment variable with the configuration.
  $config = json_encode([
    'stagingFilePath' => self::$stagingFilePath,
    'colors' => self::$colors,
    'printCaller' => self::$printCaller,
  ]);
  putenv('DRUPAL_PHPUNIT_DUMPER_CONFIG=' . $config);
  $facade->registerSubscriber(new TestRunnerFinishedSubscriber($this));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.