function RoleTest::providerSource
Same name in this branch
- 9 core/modules/user/tests/src/Kernel/Plugin/migrate/source/d6/RoleTest.php \Drupal\Tests\user\Kernel\Plugin\migrate\source\d6\RoleTest::providerSource()
Same name in other branches
- 8.9.x core/modules/user/tests/src/Kernel/Plugin/migrate/source/d6/RoleTest.php \Drupal\Tests\user\Kernel\Plugin\migrate\source\d6\RoleTest::providerSource()
- 8.9.x core/modules/user/tests/src/Kernel/Plugin/migrate/source/d7/RoleTest.php \Drupal\Tests\user\Kernel\Plugin\migrate\source\d7\RoleTest::providerSource()
- 10 core/modules/user/tests/src/Kernel/Plugin/migrate/source/d6/RoleTest.php \Drupal\Tests\user\Kernel\Plugin\migrate\source\d6\RoleTest::providerSource()
- 10 core/modules/user/tests/src/Kernel/Plugin/migrate/source/d7/RoleTest.php \Drupal\Tests\user\Kernel\Plugin\migrate\source\d7\RoleTest::providerSource()
- 11.x core/modules/user/tests/src/Kernel/Plugin/migrate/source/d6/RoleTest.php \Drupal\Tests\user\Kernel\Plugin\migrate\source\d6\RoleTest::providerSource()
- 11.x core/modules/user/tests/src/Kernel/Plugin/migrate/source/d7/RoleTest.php \Drupal\Tests\user\Kernel\Plugin\migrate\source\d7\RoleTest::providerSource()
Overrides MigrateSourceTestBase::providerSource
File
-
core/
modules/ user/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d7/ RoleTest.php, line 23
Class
- RoleTest
- Tests the d7_user_role source plugin.
Namespace
Drupal\Tests\user\Kernel\Plugin\migrate\source\d7Code
public function providerSource() {
$expected = [
[
'rid' => 1,
'name' => 'anonymous user',
'permissions' => [
'access content',
],
],
[
'rid' => 2,
'name' => 'authenticated user',
'permissions' => [
'access comments',
'access content',
'post comments',
'post comments without approval',
],
],
[
'rid' => 3,
'name' => 'administrator',
'permissions' => [
'access comments',
'administer comments',
'post comments',
'post comments without approval',
'access content',
'administer content types',
'administer nodes',
],
],
];
$data = [
[
[],
$expected,
],
];
foreach ($expected as $row) {
foreach ($row['permissions'] as $permission) {
$data[0][0]['role_permission'][] = [
'permission' => $permission,
'rid' => $row['rid'],
];
}
unset($row['permissions']);
$data[0][0]['role'][] = $row;
}
return $data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.