function CsrfTokenGeneratorTest::testGetWithNoHashSalt

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::testGetWithNoHashSalt()
  2. 10 core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::testGetWithNoHashSalt()
  3. 9 core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::testGetWithNoHashSalt()
  4. 8.9.x core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php \Drupal\Tests\Core\Access\CsrfTokenGeneratorTest::testGetWithNoHashSalt()

Tests the exception thrown when no 'hash_salt' is provided in settings.

File

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

Class

CsrfTokenGeneratorTest
Tests the CsrfTokenGenerator class.

Namespace

Drupal\Tests\Core\Access

Code

public function testGetWithNoHashSalt() : void {
  // Update settings with no hash salt.
  new Settings([]);
  $generator = new CsrfTokenGenerator($this->createStub(PrivateKey::class), $this->createStub(MetadataBag::class));
  $this->expectException(\RuntimeException::class);
  $generator->get();
}

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