You are here

protected function PermissionHandlerTest::assertPermissions in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/user/tests/src/Unit/PermissionHandlerTest.php \Drupal\Tests\user\Unit\PermissionHandlerTest::assertPermissions()
  2. 9 core/modules/user/tests/src/Unit/PermissionHandlerTest.php \Drupal\Tests\user\Unit\PermissionHandlerTest::assertPermissions()

Checks that the permissions are like expected.

@internal

Parameters

array $actual_permissions: The actual permissions

File

core/modules/user/tests/src/Unit/PermissionHandlerTest.php, line 324
Contains \Drupal\Tests\user\Unit\PermissionHandlerTest.

Class

PermissionHandlerTest
Tests the permission handler.

Namespace

Drupal\Tests\user\Unit

Code

protected function assertPermissions(array $actual_permissions) : void {
  $this
    ->assertCount(4, $actual_permissions);
  $this
    ->assertEquals('single_description', $actual_permissions['access_module_a']['title']);
  $this
    ->assertEquals('module_a', $actual_permissions['access_module_a']['provider']);
  $this
    ->assertEquals('Access B', $actual_permissions['access module b']['title']);
  $this
    ->assertEquals('module_b', $actual_permissions['access module b']['provider']);
  $this
    ->assertEquals('Access C', $actual_permissions['access_module_c']['title']);
  $this
    ->assertEquals('module_c', $actual_permissions['access_module_c']['provider']);
  $this
    ->assertTrue($actual_permissions['access_module_c']['restrict access']);
  $this
    ->assertEquals('module_a', $actual_permissions['access module a via module b']['provider']);
}