protected function CsrfTokenGeneratorTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::setUp()
Overrides UnitTestCase::setUp
File
- core/
tests/ Drupal/ Tests/ Core/ Access/ CsrfTokenGeneratorTest.php, line 42
Class
- CsrfTokenGeneratorTest
- Tests the CsrfTokenGenerator class.
Namespace
Drupal\Tests\Core\AccessCode
protected function setUp() : void {
parent::setUp();
$this->privateKey = $this
->getMockBuilder('Drupal\\Core\\PrivateKey')
->disableOriginalConstructor()
->setMethods([
'get',
])
->getMock();
$this->sessionMetadata = $this
->getMockBuilder('Drupal\\Core\\Session\\MetadataBag')
->disableOriginalConstructor()
->getMock();
$settings = [
'hash_salt' => $this
->randomMachineName(),
];
new Settings($settings);
$this->generator = new CsrfTokenGenerator($this->privateKey, $this->sessionMetadata);
}