You are here

protected function MigrateUserRoleTest::assertRole in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserRoleTest::assertRole()

Helper function to perform assertions on a user role.

Parameters

string $id: The role ID.

string[] $permissions: An array of user permissions.

int $lookupId: The original numeric ID of the role in the source database.

\Drupal\migrate\Plugin\MigrateIdMapInterface $id_map: The map table plugin.

2 calls to MigrateUserRoleTest::assertRole()
MigrateUserRoleTest::assertRoles in core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php
Helper function to test the migration of the user roles. The user roles will be re-imported and the tests here will be repeated.
MigrateUserRoleTest::testUserRole in core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php
Tests user role migration.

File

core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php, line 37

Class

MigrateUserRoleTest
Upgrade user roles to user.role.*.yml.

Namespace

Drupal\Tests\user\Kernel\Migrate\d6

Code

protected function assertRole($id, array $permissions, $lookupId, MigrateIdMapInterface $id_map) {

  /** @var \Drupal\user\RoleInterface $role */
  $role = Role::load($id);
  $this
    ->assertInstanceOf(RoleInterface::class, $role);
  sort($permissions);
  $this
    ->assertSame($permissions, $role
    ->getPermissions());
  $this
    ->assertSame([
    [
      $id,
    ],
  ], $id_map
    ->lookupDestinationIds([
    'rid' => $lookupId,
  ]));
}