public function CsrfTokenGeneratorTest::testValidate in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::testValidate()
- 10 core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::testValidate()
Tests CsrfTokenGenerator::validate().
@covers ::validate
File
- core/
tests/ Drupal/ Tests/ Core/ Access/ CsrfTokenGeneratorTest.php, line 118
Class
- CsrfTokenGeneratorTest
- Tests the CsrfTokenGenerator class.
Namespace
Drupal\Tests\Core\AccessCode
public function testValidate() {
$this
->setupDefaultExpectations();
$token = $this->generator
->get();
$this
->assertTrue($this->generator
->validate($token));
$this
->assertFalse($this->generator
->validate($token, 'foo'));
$token = $this->generator
->get('bar');
$this
->assertTrue($this->generator
->validate($token, 'bar'));
}