function PermissionsHashGeneratorTest::testGenerateNoCache

Same name in other branches
  1. 9 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 224

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

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