function TestBase::error

Fire an error assertion.

Parameters

$message: (optional) A message to display with the assertion. Do not translate messages: use \Drupal\Component\Render\FormattableMarkup 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 core/modules/simpletest/src/Tests/SimpleTestErrorCollectorTest.php
Stores errors into an array.
SimpleTestErrorCollectorTest::testErrorCollect in core/modules/simpletest/src/Tests/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.
TestBase::exceptionHandler in core/modules/simpletest/src/TestBase.php
Handle exceptions.

... See full list

1 method overrides TestBase::error()
SimpleTestErrorCollectorTest::error in core/modules/simpletest/src/Tests/SimpleTestErrorCollectorTest.php
Stores errors into an array.

File

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.