setUpHtmlOutput, initBrowserOutputFile and htmlOutput use browser output directory differently

Created on 11 August 2018, almost 6 years ago
Updated 7 June 2024, 21 days ago

Problem/Motivation

A simple grep shows sometimes we use browser output directory as absolute path and sometimes relative. We should consolidate how we want to use it.

grep -inr browser_output core/
core/tests/Drupal/Tests/Listeners/HtmlOutputPrinterTrait.php:37:        $this->browserOutputFile = tempnam($html_output_directory, 'browser_output_');
core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php:121:    $uri = $GLOBALS['base_url'] . '/sites/simpletest/browser_output/' . $html_output_filename;
core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php:132:    $browser_output_file = getenv('BROWSERTEST_OUTPUT_FILE');
core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php:133:    $this->htmlOutputEnabled = is_file($browser_output_file);
core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php:135:      $this->htmlOutputFile = $browser_output_file;
core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php:137:      $this->htmlOutputDirectory = DRUPAL_ROOT . '/sites/simpletest/browser_output';
core/phpunit.xml.dist:29:    <!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output -->

Also see https://gitlab.com/weitzman/drupal-test-traits/merge_requests/39

the html files are not going into the BROWSERTEST_OUTPUT_DIRECTORY. instead they are going into /sites/simpletest/browser_output regardless.

Proposed resolution

We can convert BROWSERTEST_OUTPUT_DIRECTORY to always be relative webroot and convert to absolute/url when needs be that would mean \Drupal\Tests\Listeners\HtmlOutputPrinterTrait::setUpHtmlOutput has to adapt.

Remaining tasks

  • Agree on the approach.
  • Create patch.
  • Commit it.
  • Rejoice.

User interface changes

None

API changes

None

Data model changes

None.

📌 Task
Status

Needs work

Version

11.0 🔥

Component
PHPUnit  →

Last updated about 2 hours ago

Created by

🇵🇰Pakistan jibran Sydney, Australia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024