function CsrfTokenGeneratorTest::testValidateParameterTypes

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::testValidateParameterTypes()
  2. 10 core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::testValidateParameterTypes()
  3. 11.x core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::testValidateParameterTypes()

Tests CsrfTokenGenerator::validate() with different parameter types.

@covers ::validate @dataProvider providerTestValidateParameterTypes

Parameters

mixed $token: The token to be validated.

mixed $value: (optional) An additional value to base the token on.

File

core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php, line 140

Class

CsrfTokenGeneratorTest
Tests the CsrfTokenGenerator class.

Namespace

Drupal\Tests\Core\Access

Code

public function testValidateParameterTypes($token, $value) {
    $this->setupDefaultExpectations();
    // The following check might throw PHP fatals and notices, so we disable
    // error assertions.
    set_error_handler(function () {
        return TRUE;
    });
    $this->assertFalse($this->generator
        ->validate($token, $value));
    restore_error_handler();
}

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