function UserRolesAccessPolicyTest::testAlterPermissions
Same name in other branches
- 11.x core/tests/Drupal/Tests/Core/Session/UserRolesAccessPolicyTest.php \Drupal\Tests\Core\Session\UserRolesAccessPolicyTest::testAlterPermissions()
Tests the alterPermissions method.
@covers ::alterPermissions
File
-
core/
tests/ Drupal/ Tests/ Core/ Session/ UserRolesAccessPolicyTest.php, line 166
Class
- UserRolesAccessPolicyTest
- @coversDefaultClass \Drupal\Core\Session\UserRolesAccessPolicy @group Session
Namespace
Drupal\Tests\Core\SessionCode
public function testAlterPermissions() : void {
$account = $this->prophesize(AccountInterface::class);
$calculated_permissions = new RefinableCalculatedPermissions();
$calculated_permissions->addItem(new CalculatedPermissionsItem([
'foo',
]));
$calculated_permissions->addCacheTags([
'bar',
]);
$calculated_permissions->addCacheContexts([
'baz',
]);
$this->accessPolicy
->alterPermissions($account->reveal(), AccessPolicyInterface::SCOPE_DRUPAL, $calculated_permissions);
$this->assertSame([
'foo',
], $calculated_permissions->getItem()
->getPermissions());
$this->assertSame([
'bar',
], $calculated_permissions->getCacheTags());
$this->assertSame([
'baz',
], $calculated_permissions->getCacheContexts());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.