You are here

protected function TestBase::error in Zircon Profile 8.0

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

Fire an error assertion.

Parameters

$message: (optional) A message to display with the assertion. Do not translate messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed variables in the message text, not t(). If left blank, a default message will be displayed.

$group: (optional) The group this message is in, which is displayed in a column in test output. Use 'Debug' to indicate this is debugging output. Do not translate this string. Defaults to 'Other'; most tests do not override this default.

$caller: The caller of the error.

Return value

FALSE.

8 calls to TestBase::error()
PageRenderTest::assertPageRenderHookExceptions in core/modules/system/src/Tests/Common/PageRenderTest.php
Asserts whether expected exceptions are thrown for invalid hook implementations.
SimpleTestErrorCollectorTest::error in core/modules/system/src/Tests/Common/SimpleTestErrorCollectorTest.php
Stores errors into an array.
SimpleTestErrorCollectorTest::testErrorCollect in core/modules/system/src/Tests/Common/SimpleTestErrorCollectorTest.php
Tests that simpletest collects errors from the tested site.
TestBase::assertErrorLogged in core/modules/simpletest/src/TestBase.php
Asserts that a specific error has been logged to the PHP error log.
TestBase::errorHandler in core/modules/simpletest/src/TestBase.php
Handle errors during test runs.

... See full list

3 methods override TestBase::error()
ConfigInstallProfileUnmetDependenciesTest::error in core/modules/config/src/Tests/ConfigInstallProfileUnmetDependenciesTest.php
Override the error method so we can test for the expected exception.
SimpleTestErrorCollectorTest::error in core/modules/system/src/Tests/Common/SimpleTestErrorCollectorTest.php
Stores errors into an array.
UncaughtExceptionTest::error in core/modules/system/src/Tests/System/UncaughtExceptionTest.php
Fire an error assertion.

File

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

Class

TestBase
Base class for Drupal tests.

Namespace

Drupal\simpletest

Code

protected function error($message = '', $group = 'Other', array $caller = NULL) {
  if ($group == 'User notice') {

    // Since 'User notice' is set by trigger_error() which is used for debug
    // set the message to a status of 'debug'.
    return $this
      ->assert('debug', $message, 'Debug', $caller);
  }
  return $this
    ->assert('exception', $message, $group, $caller);
}