function PermissionsHashGeneratorTest::setUp

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php \Drupal\Tests\Core\Session\PermissionsHashGeneratorTest::setUp()
  2. 8.9.x core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php \Drupal\Tests\Core\Session\PermissionsHashGeneratorTest::setUp()
  3. 11.x core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php \Drupal\Tests\Core\Session\PermissionsHashGeneratorTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Session/PermissionsHashGeneratorTest.php, line 65

Class

PermissionsHashGeneratorTest
@coversDefaultClass \Drupal\Core\Session\PermissionsHashGenerator @group Session

Namespace

Drupal\Tests\Core\Session

Code

protected function setUp() : void {
    parent::setUp();
    new Settings([
        'hash_salt' => 'test',
    ]);
    $this->account1 = $this->prophesize(AccountInterface::class);
    $this->account1
        ->id()
        ->willReturn(1);
    $this->account1 = $this->account1
        ->reveal();
    $this->account2 = $this->prophesize(AccountInterface::class);
    $this->account2
        ->id()
        ->willReturn(2);
    $this->account2 = $this->account2
        ->reveal();
    $private_key = $this->prophesize(PrivateKey::class);
    $private_key->get()
        ->willReturn(Crypt::randomBytesBase64(55));
    $this->staticCache = $this->prophesize(CacheBackendInterface::class);
    $this->staticCache
        ->get(Argument::any())
        ->willReturn(FALSE);
    $this->staticCache
        ->set(Argument::cetera())
        ->shouldBeCalled();
    $this->processor = $this->prophesize(AccessPolicyProcessorInterface::class);
    $this->permissionsHash = new PermissionsHashGenerator($private_key->reveal(), $this->staticCache
        ->reveal(), $this->processor
        ->reveal());
}

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