You are here

protected function TestBase::verbose in Drupal 8

Logs a verbose message in a text file.

The link to the verbose message will be placed in the test results as a passing assertion with the text '[verbose message]'.

Parameters

$message: The verbose message to be stored.

See also

simpletest_verbose()

9 calls to TestBase::verbose()
DateTestBase::renderTestEntity in core/modules/datetime/src/Tests/DateTestBase.php
Renders a entity_test and sets the output in the internal browser.
KernelTestBase::render in core/modules/simpletest/src/KernelTestBase.php
Renders a render array.
RESTTestBase::httpRequest in core/modules/rest/src/Tests/RESTTestBase.php
Helper function to issue a HTTP request with simpletest's cURL.
ViewKernelTestBase::executeView in core/modules/views/src/Tests/ViewKernelTestBase.php
Executes a view with debugging.
ViewTestBase::executeView in core/modules/views/src/Tests/ViewTestBase.php
Executes a view with debugging.

... See full list

File

core/modules/simpletest/src/TestBase.php, line 858

Class

TestBase
Base class for Drupal tests.

Namespace

Drupal\simpletest

Code

protected function verbose($message) {

  // Do nothing if verbose debugging is disabled.
  if (!$this->verbose) {
    return;
  }
  $message = '<hr />ID #' . $this->verboseId . ' (<a href="' . $this->verboseClassName . '-' . ($this->verboseId - 1) . '-' . $this->testId . '.html">Previous</a> | <a href="' . $this->verboseClassName . '-' . ($this->verboseId + 1) . '-' . $this->testId . '.html">Next</a>)<hr />' . $message;
  $verbose_filename = $this->verboseClassName . '-' . $this->verboseId . '-' . $this->testId . '.html';
  if (file_put_contents($this->verboseDirectory . '/' . $verbose_filename, $message)) {
    $url = $this->verboseDirectoryUrl . '/' . $verbose_filename;

    // Not using \Drupal\Core\Utility\LinkGeneratorInterface::generate()
    // to avoid invoking the theme system, so that unit tests
    // can use verbose() as well.
    $url = '<a href="' . $url . '" target="_blank">Verbose message</a>';
    $this
      ->error($url, 'User notice');
  }
  $this->verboseId++;
}