public function PermissionsHashGeneratorTest::testGenerateStaticCache in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php \Drupal\Tests\Core\Session\PermissionsHashGeneratorTest::testGenerateStaticCache()
@covers ::generate
File
- core/tests/ Drupal/ Tests/ Core/ Session/ PermissionsHashGeneratorTest.php, line 199 
Class
- PermissionsHashGeneratorTest
- @coversDefaultClass \Drupal\Core\Session\PermissionsHashGenerator @group Session
Namespace
Drupal\Tests\Core\SessionCode
public function testGenerateStaticCache() {
  // Set expectations for the mocked cache backend.
  $expected_cid = 'user_permissions_hash:administrator,authenticated';
  $mock_cache = new \stdClass();
  $mock_cache->data = 'test_hash_here';
  $this->staticCache
    ->expects($this
    ->once())
    ->method('get')
    ->with($expected_cid)
    ->will($this
    ->returnValue($mock_cache));
  $this->staticCache
    ->expects($this
    ->never())
    ->method('set');
  $this->cache
    ->expects($this
    ->never())
    ->method('get');
  $this->cache
    ->expects($this
    ->never())
    ->method('set');
  $this->permissionsHash
    ->generate($this->account2);
}