protected function MigrateUserRoleTest::assertRole in Drupal 10
Same name and namespace in other branches
- 8 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserRoleTest::assertRole()
- 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.
@internal
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 39
Class
- MigrateUserRoleTest
- Upgrade user roles to user.role.*.yml.
Namespace
Drupal\Tests\user\Kernel\Migrate\d6Code
protected function assertRole(string $id, array $permissions, int $lookupId, MigrateIdMapInterface $id_map) : void {
/** @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,
]));
}