function PermissionsHashGeneratorTest::testGenerateStaticCache

Same name in other branches
  1. 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\Session

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.