setUpHtmlOutput, initBrowserOutputFile and htmlOutput use browser output directory differently

Created on 11 August 2018, over 6 years ago
Updated 7 June 2024, 7 months 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 13 hours ago

Created by

🇨🇦Canada jibran Toronto, Canada

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.

  • The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • 🇩🇪Germany tstoeckler Essen, Germany

    Just hit this as well. Noticed that \Drupal\Tests\BrowserHtmlDebugTrait::htmlOutput() needs to be updated, as well.

  • First commit to issue fork.
  • Merge request !8327Update file BrowserHtmlDebugTrait.php → (Open) created by immaculatexavier
  • Pipeline finished with Failed
    7 months ago
    Total: 175s
    #193457
  • Pipeline finished with Failed
    7 months ago
    Total: 476s
    #193519
Production build 0.71.5 2024