You are here

public function PermissionsHashGeneratorTest::testGenerateNoCache in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 229
Contains \Drupal\Tests\Core\Session\PermissionsHashGeneratorTest.

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);
}