You are here

protected function TestBase::verbose in SimpleTest 8.3

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()

5 calls to TestBase::verbose()
KernelTestBase::render in src/KernelTestBase.php
Renders a render array.
WebTestBase::drupalGet in src/WebTestBase.php
Retrieves a Drupal path or an absolute path.
WebTestBase::drupalHead in src/WebTestBase.php
Retrieves only the headers for a Drupal path or an absolute path.
WebTestBase::drupalPostAjaxForm in src/WebTestBase.php
Executes an Ajax form submission.
WebTestBase::drupalPostForm in src/WebTestBase.php
Executes a form submission.

File

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++;
}