function AccessPolicyProcessorTest::testAlterPermissions
Same name in other branches
- 11.x core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php \Drupal\Tests\Core\Session\AccessPolicyProcessorTest::testAlterPermissions()
Tests that access policies can alter the final result.
File
-
core/
tests/ Drupal/ Tests/ Core/ Session/ AccessPolicyProcessorTest.php, line 82
Class
- AccessPolicyProcessorTest
- Tests the AccessPolicyProcessor service.
Namespace
Drupal\Tests\Core\SessionCode
public function testAlterPermissions() : void {
$account = $this->prophesize(AccountInterface::class)
->reveal();
$processor = $this->setUpAccessPolicyProcessor();
$processor->addAccessPolicy(new BarAccessPolicy());
$processor->addAccessPolicy(new BarAlterAccessPolicy());
$actual_permissions = $processor->processAccessPolicies($account, 'bar')
->getItem('bar', 1)
->getPermissions();
$this->assertEquals([
'foo',
'baz',
], $actual_permissions);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.