You are here

protected function CsrfTokenGeneratorTest::setupDefaultExpectations in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::setupDefaultExpectations()
  2. 9 core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::setupDefaultExpectations()

Set up default expectations on the mocks.

4 calls to CsrfTokenGeneratorTest::setupDefaultExpectations()
CsrfTokenGeneratorTest::testGet in core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
Tests CsrfTokenGenerator::get().
CsrfTokenGeneratorTest::testInvalidParameterTypes in core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
Tests CsrfTokenGenerator::validate() with invalid parameter types.
CsrfTokenGeneratorTest::testValidate in core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
Tests CsrfTokenGenerator::validate().
CsrfTokenGeneratorTest::testValidateParameterTypes in core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
Tests CsrfTokenGenerator::validate() with different parameter types.

File

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

Class

CsrfTokenGeneratorTest
Tests the CsrfTokenGenerator class.

Namespace

Drupal\Tests\Core\Access

Code

protected function setupDefaultExpectations() {
  $key = Crypt::randomBytesBase64();
  $this->privateKey
    ->expects($this
    ->any())
    ->method('get')
    ->will($this
    ->returnValue($key));
  $seed = Crypt::randomBytesBase64();
  $this->sessionMetadata
    ->expects($this
    ->any())
    ->method('getCsrfTokenSeed')
    ->will($this
    ->returnValue($seed));
}