You are here

protected function CsrfTokenGeneratorTest::setUp in Zircon Profile 8.0

Same name and namespace in other branches
  1. 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 47
Contains \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest.

Class

CsrfTokenGeneratorTest
Tests the CsrfTokenGenerator class.

Namespace

Drupal\Tests\Core\Access

Code

protected function setUp() {
  parent::setUp();
  $this->privateKey = $this
    ->getMockBuilder('Drupal\\Core\\PrivateKey')
    ->disableOriginalConstructor()
    ->setMethods(array(
    'get',
  ))
    ->getMock();
  $this->sessionMetadata = $this
    ->getMockBuilder('Drupal\\Core\\Session\\MetadataBag')
    ->disableOriginalConstructor()
    ->getMock();
  $settings = array(
    'hash_salt' => $this
      ->randomMachineName(),
  );
  new Settings($settings);
  $this->generator = new CsrfTokenGenerator($this->privateKey, $this->sessionMetadata);
}