X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FRest%2FActionResourceTestBase.php;fp=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FRest%2FActionResourceTestBase.php;h=5134e910a6743559b52df96a29a7171b588c5bde;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=0000000000000000000000000000000000000000;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/web/core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php b/web/core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php new file mode 100644 index 000000000..5134e910a --- /dev/null +++ b/web/core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php @@ -0,0 +1,89 @@ +grantPermissionsToTestedRole(['administer actions']); + } + + /** + * {@inheritdoc} + */ + protected function createEntity() { + $action = Action::create([ + 'id' => 'user_add_role_action.' . RoleInterface::ANONYMOUS_ID, + 'type' => 'user', + 'label' => t('Add the anonymous role to the selected users'), + 'configuration' => [ + 'rid' => RoleInterface::ANONYMOUS_ID, + ], + 'plugin' => 'user_add_role_action', + ]); + $action->save(); + + return $action; + } + + /** + * {@inheritdoc} + */ + protected function getExpectedNormalizedEntity() { + return [ + 'configuration' => [ + 'rid' => 'anonymous', + ], + 'dependencies' => [ + 'config' => ['user.role.anonymous'], + 'module' => ['user'], + ], + 'id' => 'user_add_role_action.anonymous', + 'label' => 'Add the anonymous role to the selected users', + 'langcode' => 'en', + 'plugin' => 'user_add_role_action', + 'status' => TRUE, + 'type' => 'user', + 'uuid' => $this->entity->uuid(), + ]; + } + + /** + * {@inheritdoc} + */ + protected function getExpectedCacheContexts() { + return [ + 'user.permissions', + ]; + } + + /** + * {@inheritdoc} + */ + protected function getNormalizedPostEntity() { + // @todo Update in https://www.drupal.org/node/2300677. + } + +}