function DebugDump::testRunnerFinished

Prints the dumps generated during the test.

File

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

Class

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

Namespace

Drupal\TestTools\Extension\Dump

Code

public function testRunnerFinished(TestRunnerFinished $event) : void {
  $dumps = self::getDumps();
  // Cleanup.
  unlink(self::$stagingFilePath);
  putenv('DRUPAL_PHPUNIT_DUMPER_CONFIG');
  if ($dumps === []) {
    return;
  }
  print "\n\n";
  print "dump() output\n";
  print "-------------\n\n";
  foreach ($dumps as $testId => $testDumps) {
    if (self::$printCaller) {
      print $testId . "\n";
    }
    foreach ($testDumps as $dump) {
      if (self::$printCaller) {
        print "in " . $dump['file'] . ", line " . $dump['line'] . ":\n";
      }
      foreach ($dump['dump'] as $line) {
        print $line . "\n";
      }
      if (self::$printCaller) {
        print "\n";
      }
    }
    if (self::$printCaller) {
      print "\n";
    }
  }
}

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