function AccessPolicyProcessorTest::testCalculatePermissionsNoApply

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

Tests that access policies that do not apply are not processed.

File

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

Class

AccessPolicyProcessorTest
Tests the AccessPolicyProcessor service.

Namespace

Drupal\Tests\Core\Session

Code

public function testCalculatePermissionsNoApply() : void {
    $account = $this->prophesize(AccountInterface::class)
        ->reveal();
    $access_policy = new BarAccessPolicy();
    $processor = $this->setUpAccessPolicyProcessor();
    $processor->addAccessPolicy($access_policy);
    $no_permissions = new RefinableCalculatedPermissions();
    $no_permissions->addCacheTags([
        'access_policies',
    ]);
    $calculated_permissions = $processor->processAccessPolicies($account, 'nothing');
    $this->assertEquals(new CalculatedPermissions($no_permissions), $calculated_permissions);
}

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