diff --git a/core/tests/Drupal/Tests/Core/Session/PermissionsHashTest.php b/core/tests/Drupal/Tests/Core/Session/PermissionsHashTest.php index 2bc202c..d760daa 100644 --- a/core/tests/Drupal/Tests/Core/Session/PermissionsHashTest.php +++ b/core/tests/Drupal/Tests/Core/Session/PermissionsHashTest.php @@ -112,7 +112,7 @@ protected function setUp() { ->disableOriginalConstructor() ->getMock(); - $this->permissionsHash = new PermissionsHashGenerator($this->privateKey, $this->cache); + $this->permissionsHash = new PermissionsHashGenerator($this->privateKey, $this->cache, new \Drupal\Core\Cache\MemoryBackend('test')); } /** @@ -130,9 +130,9 @@ public function testGenerate() { } /** - * Tests the generate method with cache returned. + * Tests the generate method with persistent cache returned. */ - public function testGenerateCache() { + public function testGeneratePersistentCache() { // Set expectations for the mocked cache backend. $expected_cid = 'user_permissions_hash:administrator,authenticated'; @@ -150,6 +150,27 @@ public function testGenerateCache() { } /** + * Tests the generate method with static cache returned. + */ + 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->permissionsHasn = new PermissionsHashGenerator($this->privateKey, new \Drupal\Core\Cache\MemoryBackend('test'), $this->cache); + $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->account1); + } + + /** * Tests the generate method with no cache returned. */ public function testGenerateNoCache() {