You are here

public function CsrfTokenGeneratorTest::testGetWithNoHashSalt in Drupal 9

Same name and namespace in other branches
  1. 8 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.

@covers ::get

File

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

Class

CsrfTokenGeneratorTest
Tests the CsrfTokenGenerator class.

Namespace

Drupal\Tests\Core\Access

Code

public function testGetWithNoHashSalt() {

  // Update settings with no hash salt.
  new Settings([]);
  $generator = new CsrfTokenGenerator($this->privateKey, $this->sessionMetadata);
  $this
    ->expectException(\RuntimeException::class);
  $generator
    ->get();
}