function RefinableCalculatedPermissionsTest::testRemoveItemsByScope
Same name in other branches
- 10 core/tests/Drupal/Tests/Core/Session/RefinableCalculatedPermissionsTest.php \Drupal\Tests\Core\Session\RefinableCalculatedPermissionsTest::testRemoveItemsByScope()
Tests the removal of calculated permissions items by scope.
@depends testAddItem
File
-
core/
tests/ Drupal/ Tests/ Core/ Session/ RefinableCalculatedPermissionsTest.php, line 97
Class
- RefinableCalculatedPermissionsTest
- Tests the RefinableCalculatedPermissions class.
Namespace
Drupal\Tests\Core\SessionCode
public function testRemoveItemsByScope() : void {
$scope_a = 'cat';
$scope_b = 'dog';
$item_a = new CalculatedPermissionsItem([
'bar',
], FALSE, $scope_a, 'foo');
$item_b = new CalculatedPermissionsItem([
'baz',
], FALSE, $scope_b, 1);
$calculated_permissions = (new RefinableCalculatedPermissions())->addItem($item_a)
->addItem($item_b);
$calculated_permissions->removeItemsByScope($scope_a);
$this->assertFalse($calculated_permissions->getItem($scope_a, 'foo'), 'Could not retrieve a removed item.');
$this->assertNotFalse($calculated_permissions->getItem($scope_b, 1), 'Untouched scope item was found.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.