You are here

protected function PermissionHandlerTest::assertPermissions in Drupal 9

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

Checks that the permissions are like expected.

Parameters

array $actual_permissions: The actual permissions

2 calls to PermissionHandlerTest::assertPermissions()
PermissionHandlerTest::testBuildPermissionsYaml in core/modules/user/tests/src/Unit/PermissionHandlerTest.php
Tests permissions provided by YML files.
PermissionHandlerTest::testBuildPermissionsYamlCallback in core/modules/user/tests/src/Unit/PermissionHandlerTest.php
Tests dynamic callback permissions provided by YML files.

File

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

Class

PermissionHandlerTest
Tests the permission handler.

Namespace

Drupal\Tests\user\Unit

Code

protected function assertPermissions(array $actual_permissions) {
  $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']);
}