3 namespace Drupal\Tests\system\Functional\Rest;
5 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
6 use Drupal\system\Entity\Action;
7 use Drupal\user\RoleInterface;
9 abstract class ActionResourceTestBase extends EntityResourceTestBase {
14 public static $modules = ['user'];
19 protected static $entityTypeId = 'action';
22 * @var \Drupal\system\ActionConfigEntityInterface
29 protected function setUpAuthorization($method) {
30 $this->grantPermissionsToTestedRole(['administer actions']);
36 protected function createEntity() {
37 $action = Action::create([
38 'id' => 'user_add_role_action.' . RoleInterface::ANONYMOUS_ID,
40 'label' => t('Add the anonymous role to the selected users'),
42 'rid' => RoleInterface::ANONYMOUS_ID,
44 'plugin' => 'user_add_role_action',
54 protected function getExpectedNormalizedEntity() {
60 'config' => ['user.role.anonymous'],
63 'id' => 'user_add_role_action.anonymous',
64 'label' => 'Add the anonymous role to the selected users',
66 'plugin' => 'user_add_role_action',
69 'uuid' => $this->entity->uuid(),
76 protected function getExpectedCacheContexts() {
85 protected function getNormalizedPostEntity() {
86 // @todo Update in https://www.drupal.org/node/2300677.