You are here

public function CsrfTokenGeneratorTest::testValidateParameterTypes in Drupal 8

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