You are here

protected function RequestSanitizerTest::assertError in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php \Drupal\Tests\Core\Security\RequestSanitizerTest::assertError()
  2. 9 core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php \Drupal\Tests\Core\Security\RequestSanitizerTest::assertError()

Asserts that the expected error has been logged.

@internal

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 363

Class

RequestSanitizerTest
Tests RequestSanitizer class.

Namespace

Drupal\Tests\Core\Security

Code

protected function assertError(string $errstr, int $errno) : void {
  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));
}