function AccessPolicyProcessorTest::testAlterPermissionsNoApply

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

Tests that alters that do not apply are not processed.

File

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

Class

AccessPolicyProcessorTest
Tests the AccessPolicyProcessor service.

Namespace

Drupal\Tests\Core\Session

Code

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

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