function AccessPolicyProcessorTest::testEmptyCalculator

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

Tests that access policies which do nothing are properly processed.

File

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

Class

AccessPolicyProcessorTest
Tests the AccessPolicyProcessor service.

Namespace

Drupal\Tests\Core\Session

Code

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

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