You are here

protected function ChainGroupPermissionCalculatorTest::convertCalculatedPermissionsToArray in Group 8

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

Converts a calculated permissions object into an array.

This is done to make comparison assertions easier. Make sure you use the canonicalize option of assertEquals.

Parameters

\Drupal\group\Access\CalculatedGroupPermissionsInterface $calculated_permissions: The calculated permissions object to convert.

Return value

string[] The permissions, keyed by scope identifier.

5 calls to ChainGroupPermissionCalculatorTest::convertCalculatedPermissionsToArray()
ChainGroupPermissionCalculatorTest::testAnonymousAuthenticatedSameResult in tests/src/Kernel/ChainGroupPermissionCalculatorTest.php
Tests whether anonymous users and 'pure' outsiders can get the same result.
ChainGroupPermissionCalculatorTest::testCalculateAnonymousPermissions in tests/src/Kernel/ChainGroupPermissionCalculatorTest.php
Tests the calculation of the anonymous permissions.
ChainGroupPermissionCalculatorTest::testCalculateMemberPermissions in tests/src/Kernel/ChainGroupPermissionCalculatorTest.php
Tests the calculation of the member permissions.
ChainGroupPermissionCalculatorTest::testCalculateMultipleMembersPermissions in tests/src/Kernel/ChainGroupPermissionCalculatorTest.php
Test members permissions with multiple users, groups and group roles.
ChainGroupPermissionCalculatorTest::testCalculateOutsiderPermissions in tests/src/Kernel/ChainGroupPermissionCalculatorTest.php
Tests the calculation of the outsider permissions.

File

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

Class

ChainGroupPermissionCalculatorTest
Tests the calculation of group permissions.

Namespace

Drupal\Tests\group\Kernel

Code

protected function convertCalculatedPermissionsToArray(CalculatedGroupPermissionsInterface $calculated_permissions) {
  $permissions = [];
  foreach ($calculated_permissions
    ->getItems() as $item) {
    $permissions[$item
      ->getIdentifier()] = $item
      ->getPermissions();
  }
  return $permissions;
}