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. 10 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.

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 357

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($actual_permissions['access_module_a']['title'], 'single_description');
    $this->assertEquals($actual_permissions['access_module_a']['provider'], 'module_a');
    $this->assertEquals($actual_permissions['access module b']['title'], 'Access B');
    $this->assertEquals($actual_permissions['access module b']['provider'], 'module_b');
    $this->assertEquals($actual_permissions['access_module_c']['title'], 'Access C');
    $this->assertEquals($actual_permissions['access_module_c']['provider'], 'module_c');
    $this->assertEquals($actual_permissions['access_module_c']['restrict access'], TRUE);
    $this->assertEquals($actual_permissions['access module a via module b']['provider'], 'module_a');
}

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