You are here

public function RefinableCalculatedGroupPermissionsTest::testRemoveItems in Group 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Unit/RefinableCalculatedGroupPermissionsTest.php \Drupal\Tests\group\Unit\RefinableCalculatedGroupPermissionsTest::testRemoveItems()

Tests the removal of all calculated permissions items.

@covers ::removeItems @depends testAddItem

File

tests/src/Unit/RefinableCalculatedGroupPermissionsTest.php, line 65

Class

RefinableCalculatedGroupPermissionsTest
Tests the RefinableCalculatedGroupPermissions class.

Namespace

Drupal\Tests\group\Unit

Code

public function testRemoveItems() {
  $item = new CalculatedGroupPermissionsItem(CGPII::SCOPE_GROUP_TYPE, 'foo', [
    'bar',
  ]);
  $calculated_permissions = new RefinableCalculatedGroupPermissions();
  $calculated_permissions
    ->addItem($item)
    ->removeItems();
  $this
    ->assertFalse($calculated_permissions
    ->getItem(CGPII::SCOPE_GROUP_TYPE, 'foo'), 'Could not retrieve a removed item.');
}