protected function TestBase::error

Fire an error assertion.

Parameters

$message: (optional) A message to display with the assertion. Do not translate messages: use format_string() 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.

6 calls to TestBase::error()
SimpleTestErrorCollectorTest::error in drupal/core/modules/system/lib/Drupal/system/Tests/Common/SimpleTestErrorCollectorTest.php
Stores errors into an array.
SimpleTestErrorCollectorTest::testErrorCollect in drupal/core/modules/system/lib/Drupal/system/Tests/Common/SimpleTestErrorCollectorTest.php
Tests that simpletest collects errors from the tested site.
TestBase::errorHandler in drupal/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
Handle errors during test runs.
TestBase::exceptionHandler in drupal/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
Handle exceptions.
TestBase::verbose in drupal/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
Logs verbose message in a text file.

... See full list

1 method overrides TestBase::error()
SimpleTestErrorCollectorTest::error in drupal/core/modules/system/lib/Drupal/system/Tests/Common/SimpleTestErrorCollectorTest.php
Stores errors into an array.

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php, line 591
Definition of 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);
}