function RequestSanitizerTest::assertError

Same name in other branches
  1. 7.x modules/simpletest/tests/request_sanitizer.test \RequestSanitizerTest::assertError()
  2. 9 core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php \Drupal\Tests\Core\Security\RequestSanitizerTest::assertError()
  3. 8.9.x core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php \Drupal\Tests\Core\Security\RequestSanitizerTest::assertError()
  4. 10 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 373

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

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