public function PermissionsHashGeneratorTest::testGeneratePersistentCache in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php \Drupal\Tests\Core\Session\PermissionsHashGeneratorTest::testGeneratePersistentCache()
@covers ::generate
File
- core/
tests/ Drupal/ Tests/ Core/ Session/ PermissionsHashGeneratorTest.php, line 171
Class
- PermissionsHashGeneratorTest
- @coversDefaultClass \Drupal\Core\Session\PermissionsHashGenerator @group Session
Namespace
Drupal\Tests\Core\SessionCode
public function testGeneratePersistentCache() {
// 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(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($mock_cache));
$this->cache
->expects($this
->never())
->method('set');
$this->permissionsHash
->generate($this->account2);
}