You are here

protected function BrowserHtmlDebugTrait::htmlOutput in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php \Drupal\Tests\BrowserHtmlDebugTrait::htmlOutput()
  2. 9 core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php \Drupal\Tests\BrowserHtmlDebugTrait::htmlOutput()

Logs a HTML output message in a text file.

The link to the HTML output message will be printed by the results printer.

Parameters

string|null $message: (optional) The HTML output message to be stored. If not supplied the current page content is used.

See also

\Drupal\Tests\Listeners\VerbosePrinter::printResult()

4 calls to BrowserHtmlDebugTrait::htmlOutput()
BrowserWithJavascriptTest::drupalGetWithAlert in core/tests/Drupal/FunctionalJavascriptTests/BrowserWithJavascriptTest.php
Retrieves a Drupal path or an absolute path.
InstallerExistingConfigNoSystemSiteTest::testConfigSync in core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php
Tests that profiles with no system.site do not work.
InstallerExistingConfigSyncDirectoryProfileMismatchTest::testConfigSync in core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php
Tests that profile mismatch fails to install.
WebDriverTestBase::tearDown in core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php

File

core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php, line 117

Class

BrowserHtmlDebugTrait
Provides the debug functions for browser tests.

Namespace

Drupal\Tests

Code

protected function htmlOutput($message = NULL) {
  if (!$this->htmlOutputEnabled) {
    return;
  }
  $message = $message ?: $this
    ->getSession()
    ->getPage()
    ->getContent();
  $message = '<hr />ID #' . $this->htmlOutputCounter . ' (<a href="' . $this->htmlOutputClassName . '-' . ($this->htmlOutputCounter - 1) . '-' . $this->htmlOutputTestId . '.html">Previous</a> | <a href="' . $this->htmlOutputClassName . '-' . ($this->htmlOutputCounter + 1) . '-' . $this->htmlOutputTestId . '.html">Next</a>)<hr />' . $message;
  $html_output_filename = $this->htmlOutputClassName . '-' . $this->htmlOutputCounter . '-' . $this->htmlOutputTestId . '.html';
  file_put_contents($this->htmlOutputDirectory . '/' . $html_output_filename, $message);
  file_put_contents($this->htmlOutputCounterStorage, $this->htmlOutputCounter++);

  // Do not use the file_url_generator service as the module_handler service
  // might not be available.
  $uri = $this->htmlOutputBaseUrl . '/sites/simpletest/browser_output/' . $html_output_filename;
  file_put_contents($this->htmlOutputFile, $uri . "\n", FILE_APPEND);
}