You are here

protected function RequestSanitizerTest::assertError in Drupal 8

Same name and namespace in other branches
  1. 9 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.

3 calls to RequestSanitizerTest::assertError()
RequestSanitizerTest::testRequestSanitization in core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php
Tests RequestSanitizer class.
RequestSanitizerTest::testSanitizedDestinationGet in core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php
Tests unacceptable destinations are removed from GET requests.
RequestSanitizerTest::testSanitizedDestinationPost in core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php
Tests unacceptable destinations are removed from GET requests.

File

core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php, line 361

Class

RequestSanitizerTest
Tests RequestSanitizer class.

Namespace

Drupal\Tests\Core\Security

Code

protected function assertError($errstr, $errno) {
  foreach ($this->errors as $error) {
    if ($error['errstr'] === $errstr && $error['errno'] === $errno) {
      return;
    }
  }
  $this
    ->fail("Error with level {$errno} and message '{$errstr}' not found in " . var_export($this->errors, TRUE));
}