function BrowserHtmlDebugTrait::htmlOutput

Same name in other branches
  1. 9 core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php \Drupal\Tests\BrowserHtmlDebugTrait::htmlOutput()
  2. 8.9.x core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php \Drupal\Tests\BrowserHtmlDebugTrait::htmlOutput()
  3. 10 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()

9 calls to BrowserHtmlDebugTrait::htmlOutput()
BrowserHtmlDebugTrait::getResponseLogHandler in core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php
Provides a Guzzle middleware handler to log every response received.
BrowserWithJavascriptTest::drupalGetWithAlert in core/tests/Drupal/FunctionalJavascriptTests/BrowserWithJavascriptTest.php
Retrieves a Drupal path or an absolute path.
InlineBlockTestBase::removeInlineBlockFromLayout in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php
Removes an entity block from the layout but does not save the layout.
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.

... See full list

File

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

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;
    HtmlOutputLogger::log($uri);
}

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