You are here

public function CalculatedGroupPermissionsItemTest::testHasPermission in Group 8

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

Tests the permission check when the admin flag is not set.

@covers ::hasPermission @depends testConstructor

File

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

Class

CalculatedGroupPermissionsItemTest
Tests the CalculatedGroupPermissionsItem value object.

Namespace

Drupal\Tests\group\Unit

Code

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