function CsrfTokenGeneratorTest::setupDefaultExpectations

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::setupDefaultExpectations()
  2. 8.9.x core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::setupDefaultExpectations()
  3. 11.x 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 68

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')
        ->willReturn($key);
    $seed = Crypt::randomBytesBase64();
    $this->sessionMetadata
        ->expects($this->any())
        ->method('getCsrfTokenSeed')
        ->willReturn($seed);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.