You are here

public function PermissionsHashGeneratorTest::testGenerateNoCache in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php \Drupal\Tests\Core\Session\PermissionsHashGeneratorTest::testGenerateNoCache()
  2. 10 core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php \Drupal\Tests\Core\Session\PermissionsHashGeneratorTest::testGenerateNoCache()

Tests the generate method with no cache returned.

File

core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php, line 224

Class

PermissionsHashGeneratorTest
@coversDefaultClass \Drupal\Core\Session\PermissionsHashGenerator @group Session

Namespace

Drupal\Tests\Core\Session

Code

public function testGenerateNoCache() {

  // Set expectations for the mocked cache backend.
  $expected_cid = 'user_permissions_hash:administrator,authenticated';
  $this->staticCache
    ->expects($this
    ->once())
    ->method('get')
    ->with($expected_cid)
    ->will($this
    ->returnValue(FALSE));
  $this->staticCache
    ->expects($this
    ->once())
    ->method('set')
    ->with($expected_cid, $this
    ->isType('string'));
  $this->cache
    ->expects($this
    ->once())
    ->method('get')
    ->with($expected_cid)
    ->will($this
    ->returnValue(FALSE));
  $this->cache
    ->expects($this
    ->once())
    ->method('set')
    ->with($expected_cid, $this
    ->isType('string'));
  $this->permissionsHash
    ->generate($this->account2);
}