function ActionResourceTestBase::createEntity

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php \Drupal\Tests\system\Functional\Rest\ActionResourceTestBase::createEntity()
  2. 10 core/modules/action/tests/src/Functional/Rest/ActionResourceTestBase.php \Drupal\Tests\action\Functional\Rest\ActionResourceTestBase::createEntity()
  3. 11.x core/modules/action/tests/src/Functional/Rest/ActionResourceTestBase.php \Drupal\Tests\action\Functional\Rest\ActionResourceTestBase::createEntity()
  4. 11.x core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php \Drupal\Tests\system\Functional\Rest\ActionResourceTestBase::createEntity()
  5. 10 core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php \Drupal\Tests\system\Functional\Rest\ActionResourceTestBase::createEntity()

Overrides EntityResourceTestBase::createEntity

File

core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php, line 36

Class

ActionResourceTestBase

Namespace

Drupal\Tests\system\Functional\Rest

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.