protected function BrowserHtmlDebugTrait::htmlOutput in Drupal 9
Same name and namespace in other branches
- 8 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.
- InstallerExistingConfigNoSystemSiteTest::testConfigSync in core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerExistingConfigNoSystemSiteTest.php - Tests that profiles with no system.site do not work.
- InstallerExistingConfigSyncDriectoryProfileMismatchTest::testConfigSync in core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerExistingConfigSyncDriectoryProfileMismatchTest.php - Tests that profile mismatch fails to install.
- SaveUploadTest::testInvalidUtf8FilenameUpload in core/
modules/ file/ tests/ src/ Functional/ SaveUploadTest.php - Tests that filenames containing invalid UTF-8 are rejected.
File
- core/
tests/ Drupal/ Tests/ BrowserHtmlDebugTrait.php, line 117
Class
- BrowserHtmlDebugTrait
- Provides the debug functions for browser tests.
Namespace
Drupal\TestsCode
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);
}