X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fuser%2Ftests%2Fsrc%2FKernel%2FPlugin%2Fmigrate%2Fsource%2Fd6%2FRoleTest.php;fp=web%2Fcore%2Fmodules%2Fuser%2Ftests%2Fsrc%2FKernel%2FPlugin%2Fmigrate%2Fsource%2Fd6%2FRoleTest.php;h=1a841d32dfa53a97c063f5ed53dab1a99cb8512c;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/user/tests/src/Kernel/Plugin/migrate/source/d6/RoleTest.php b/web/core/modules/user/tests/src/Kernel/Plugin/migrate/source/d6/RoleTest.php new file mode 100644 index 000000000..1a841d32d --- /dev/null +++ b/web/core/modules/user/tests/src/Kernel/Plugin/migrate/source/d6/RoleTest.php @@ -0,0 +1,87 @@ + [], + 'expected_data' => [], + ], + ]; + + $roles = [ + [ + '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', + ], + ], + ]; + + // The source data. + foreach ($roles as $role) { + $tests[0]['source_data']['permission'][] = [ + 'rid' => $role['rid'], + 'perm' => implode(', ', $role['permissions']), + ]; + unset($role['permissions']); + $tests[0]['source_data']['role'][] = $role; + } + + $tests[0]['source_data']['filter_formats'] = [ + [ + 'format' => 1, + 'roles' => '', + ], + ]; + + // The expected results. + $tests[0]['expected_data'] = $roles; + + return $tests; + } + +}