function HtmlOutputLogger::testRunnerStarted

Empties the list of the HTML output created during the test run.

File

core/tests/Drupal/TestTools/Extension/HtmlLogging/HtmlOutputLogger.php, line 113

Class

HtmlOutputLogger
Drupal's extension for providing HTML output results for functional tests.

Namespace

Drupal\TestTools\Extension\HtmlLogging

Code

public function testRunnerStarted(TestRunnerStarted $event) : void {
    if (!$this->enabled) {
        throw new \RuntimeException("HTML output is not enabled");
    }
    // Convert to a canonicalized absolute pathname just in case the current
    // working directory is changed.
    $this->browserOutputFile = tempnam($this->outputDirectory, 'browser_output_');
    if ($this->browserOutputFile) {
        touch($this->browserOutputFile);
        putenv('BROWSERTEST_OUTPUT_FILE=' . $this->browserOutputFile);
    }
    else {
        // Remove any environment variable.
        putenv('BROWSERTEST_OUTPUT_FILE');
        throw new \RuntimeException("Unable to create a temporary file in {$this->outputDirectory}.");
    }
}

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