You are here

public function CalculatedGroupPermissionsItemTest::testConstructor in Group 8

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

Tests that the object values were set in the constructor.

@covers ::__construct @covers ::getIdentifier @covers ::getScope @covers ::getPermissions @covers ::isAdmin

File

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

Class

CalculatedGroupPermissionsItemTest
Tests the CalculatedGroupPermissionsItem value object.

Namespace

Drupal\Tests\group\Unit

Code

public function testConstructor() {
  $scope = CalculatedGroupPermissionsItemInterface::SCOPE_GROUP_TYPE;
  $item = new CalculatedGroupPermissionsItem($scope, 'foo', [
    'bar',
    'baz',
    'bar',
  ], FALSE);
  $this
    ->assertEquals($scope, $item
    ->getScope(), 'Scope name was set correctly.');
  $this
    ->assertEquals('foo', $item
    ->getIdentifier(), 'Scope identifier was set correctly.');
  $this
    ->assertEquals([
    'bar',
    'baz',
  ], $item
    ->getPermissions(), 'Permissions were made unique and set correctly.');
  $this
    ->assertFalse($item
    ->isAdmin(), 'Admin flag was set correctly');
}