You are here

public function RefinableCalculatedGroupPermissionsTest::testRemoveItem in Group 8

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

Tests the removal of a calculated permissions item.

@covers ::removeItem @depends testAddItem

File

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

Class

RefinableCalculatedGroupPermissionsTest
Tests the RefinableCalculatedGroupPermissions class.

Namespace

Drupal\Tests\group\Unit

Code

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