function RequestSanitizerTest::assertError
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php \Drupal\Tests\Core\Security\RequestSanitizerTest::assertError()
- 8.9.x core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php \Drupal\Tests\Core\Security\RequestSanitizerTest::assertError()
- 10 core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php \Drupal\Tests\Core\Security\RequestSanitizerTest::assertError()
- 11.x core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php \Drupal\Tests\Core\Security\RequestSanitizerTest::assertError()
Asserts that the expected error has been logged.
Parameters
string $errstr: The error message.
int $errno: The severity level of the error.
string $label: The label to include with the message.
Return value
bool TRUE if the assertion succeeded, FALSE otherwise.
1 call to RequestSanitizerTest::assertError()
- RequestSanitizerTest::requestSanitizationTest in modules/
simpletest/ tests/ request_sanitizer.test - Tests RequestSanitizer class.
File
-
modules/
simpletest/ tests/ request_sanitizer.test, line 236
Class
- RequestSanitizerTest
- Tests DrupalRequestSanitizer class.
Code
protected function assertError($errstr, $errno, $label) {
$label = empty($label) ? '' : $label . ': ';
foreach ($this->errors as $error) {
if ($error['errstr'] === $errstr && $error['errno'] === $errno) {
return $this->pass($label . "Error with level {$errno} and message '{$errstr}' found");
}
}
return $this->fail($label . "Error with level {$errno} and message '{$errstr}' not found in " . var_export($this->errors, TRUE));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.