function CsrfTokenGeneratorTest::testValidateParameterTypes

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

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

Attributes

#[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 137

Class

CsrfTokenGeneratorTest
Tests the CsrfTokenGenerator class.

Namespace

Drupal\Tests\Core\Access

Code

public function testValidateParameterTypes($token, $value) : void {
  $this->setupDefaultExpectations();
  // The following check might throw PHP fatal errors 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.