function PermissionHandlerTest::assertPermissions

Same name in other branches
  1. 9 core/modules/user/tests/src/Unit/PermissionHandlerTest.php \Drupal\Tests\user\Unit\PermissionHandlerTest::assertPermissions()
  2. 8.9.x core/modules/user/tests/src/Unit/PermissionHandlerTest.php \Drupal\Tests\user\Unit\PermissionHandlerTest::assertPermissions()
  3. 11.x 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

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 330

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']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.