protected function MigrateUserRoleTest::assertRoles in Drupal 8
Same name and namespace in other branches
- 9 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserRoleTest::assertRoles()
Helper function to test the migration of the user roles. The user roles will be re-imported and the tests here will be repeated.
Parameters
\Drupal\migrate\Plugin\MigrateIdMapInterface $id_map: The map table plugin.
1 call to MigrateUserRoleTest::assertRoles()
- 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 53
Class
- MigrateUserRoleTest
- Upgrade user roles to user.role.*.yml.
Namespace
Drupal\Tests\user\Kernel\Migrate\d6Code
protected function assertRoles(MigrateIdMapInterface $id_map) {
// The permissions for each role are found in the two tables in the Drupal 6
// source database. One is the permission table and the other is the
// filter_format table.
$permissions = [
// From permission table.
'access content',
'migrate test anonymous permission',
// From filter_format tables.
'use text format filtered_html',
];
$this
->assertRole('anonymous', $permissions, 1, $id_map);
$permissions = [
// From permission table.
'access comments',
'access content',
'migrate test authenticated permission',
'post comments',
'skip comment approval',
// From filter_format.
'use text format filtered_html',
];
$this
->assertRole('authenticated', $permissions, 2, $id_map);
$permissions = [
// From permission table.
'migrate test role 1 test permission',
// From filter format.
'use text format full_html',
'use text format php_code',
];
$this
->assertRole('migrate_test_role_1', $permissions, 3, $id_map);
$permissions = [
// From permission table.
'migrate test role 2 test permission',
'use PHP for settings',
'administer contact forms',
'skip comment approval',
'edit own blog content',
'edit any blog content',
'delete own blog content',
'delete any blog content',
'create forum content',
'delete any forum content',
'delete own forum content',
'edit any forum content',
'edit own forum content',
'administer nodes',
'access content overview',
// From filter format.
'use text format php_code',
];
$this
->assertRole('migrate_test_role_2', $permissions, 4, $id_map);
// The only permission for this role is a filter format.
$permissions = [
'use text format php_code',
];
$this
->assertRole('migrate_test_role_3_that_is_longer_than_thirty_two_characters', $permissions, 5, $id_map);
}