function MigrateUserRoleTest::assertRole
Same name in other branches
- 9 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserRoleTest::assertRole()
- 10 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserRoleTest::assertRole()
- 11.x 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\d6Code
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,
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.