function SimpleTestErrorCollectorTest::assertError

Asserts that a collected error matches what we are expecting.

1 call to SimpleTestErrorCollectorTest::assertError()
SimpleTestErrorCollectorTest::testErrorCollect in core/modules/simpletest/src/Tests/SimpleTestErrorCollectorTest.php
Tests that simpletest collects errors from the tested site.

File

core/modules/simpletest/src/Tests/SimpleTestErrorCollectorTest.php, line 86

Class

SimpleTestErrorCollectorTest
Tests SimpleTest error and exception collector.

Namespace

Drupal\simpletest\Tests

Code

public function assertError($error, $group, $function, $file, $message = NULL) {
    $this->assertEqual($error['group'], $group, new FormattableMarkup("Group was %group", [
        '%group' => $group,
    ]));
    $this->assertEqual($error['caller']['function'], $function, new FormattableMarkup("Function was %function", [
        '%function' => $function,
    ]));
    $this->assertEqual(\Drupal::service('file_system')->basename($error['caller']['file']), $file, new FormattableMarkup("File was %file", [
        '%file' => $file,
    ]));
    if (isset($message)) {
        $this->assertEqual($error['message'], $message, new FormattableMarkup("Message was %message", [
            '%message' => $message,
        ]));
    }
}

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