You are here

protected function TestBase::verbose in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/TestBase.php \Drupal\simpletest\TestBase::verbose()

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

27 calls to TestBase::verbose()
AuthTest::basicAuthGet in core/modules/rest/src/Tests/AuthTest.php
Performs a HTTP request with Basic authentication.
CommentUserNameTest::testUsername in core/modules/comment/src/Tests/Views/CommentUserNameTest.php
Test the username formatter.
ConfigCRUDTest::testDataTypes in core/modules/config/src/Tests/ConfigCRUDTest.php
Tests data type handling.
DateTimeFieldTest::renderTestEntity in core/modules/datetime/src/Tests/DateTimeFieldTest.php
Renders a entity_test and sets the output in the internal browser.
FilterAPITest::testCheckMarkupFilterSubset in core/modules/filter/src/Tests/FilterAPITest.php
Tests the ability to apply only a subset of filters.

... See full list

File

core/modules/simpletest/src/TestBase.php, line 951
Contains \Drupal\simpletest\TestBase.

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