You are here

public function CalculatedGroupPermissionsItemTest::testHasPermissionWithAdminFlag in Group 8

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

Tests the permission check when the admin flag is set.

@covers ::hasPermission @depends testConstructor

File

tests/src/Unit/CalculatedGroupPermissionsItemTest.php, line 54

Class

CalculatedGroupPermissionsItemTest
Tests the CalculatedGroupPermissionsItem value object.

Namespace

Drupal\Tests\group\Unit

Code

public function testHasPermissionWithAdminFlag() {
  $scope = CalculatedGroupPermissionsItemInterface::SCOPE_GROUP_TYPE;
  $item = new CalculatedGroupPermissionsItem($scope, 'foo', [
    'bar',
  ], TRUE);
  $this
    ->assertTrue($item
    ->hasPermission('baz'), 'Missing permission was found.');
  $this
    ->assertTrue($item
    ->hasPermission('bar'), 'Existing permission was found.');
}