You are here

public function ChainGroupPermissionCalculatorTest::testCalculateAuthenticatedPermissions in Group 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Kernel/ChainGroupPermissionCalculatorTest.php \Drupal\Tests\group\Kernel\ChainGroupPermissionCalculatorTest::testCalculateAuthenticatedPermissions()

Tests the calculation of the authenticated permissions.

@covers ::calculateAuthenticatedPermissions @depends testCalculateOutsiderPermissions @depends testCalculateMemberPermissions

File

tests/src/Kernel/ChainGroupPermissionCalculatorTest.php, line 217

Class

ChainGroupPermissionCalculatorTest
Tests the calculation of group permissions.

Namespace

Drupal\Tests\group\Kernel

Code

public function testCalculateAuthenticatedPermissions() {
  $account = $this
    ->createUser();
  $group = $this
    ->createGroup([
    'type' => 'default',
  ]);
  $group
    ->addMember($account);
  $calculated_permissions = new RefinableCalculatedGroupPermissions();
  $calculated_permissions
    ->merge($this->permissionCalculator
    ->calculateOutsiderPermissions($account))
    ->merge($this->permissionCalculator
    ->calculateMemberPermissions($account));
  $calculated_permissions = new CalculatedGroupPermissions($calculated_permissions);
  $this
    ->assertEquals($calculated_permissions, $this->permissionCalculator
    ->calculateAuthenticatedPermissions($account), 'Authenticated permissions are returned as a merge of outsider and member permissions.');
}