function AccessPolicyProcessorTest::testCalculatePermissions

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php \Drupal\Tests\Core\Session\AccessPolicyProcessorTest::testCalculatePermissions()

Tests that access policies are properly processed.

File

core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php, line 51

Class

AccessPolicyProcessorTest
Tests the AccessPolicyProcessor service.

Namespace

Drupal\Tests\Core\Session

Code

public function testCalculatePermissions() : void {
    $account = $this->prophesize(AccountInterface::class)
        ->reveal();
    $access_policy = new BarAccessPolicy();
    $processor = $this->setUpAccessPolicyProcessor();
    $processor->addAccessPolicy($access_policy);
    $access_policy_permissions = $access_policy->calculatePermissions($account, 'bar');
    $access_policy_permissions->addCacheTags([
        'access_policies',
    ]);
    $this->assertEquals(new CalculatedPermissions($access_policy_permissions), $processor->processAccessPolicies($account, 'bar'));
}

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