Commit 7a4f6f58 authored by catch's avatar catch

Issue #2494775 by DuaelFr: Replace deprecated usage of entity_create('action')...

Issue #2494775 by DuaelFr: Replace deprecated usage of entity_create('action') with a direct call to Action::create()
parent 9b2f974f
......@@ -8,6 +8,7 @@
namespace Drupal\comment\Tests;
use Drupal\comment\Entity\Comment;
use Drupal\system\Entity\Action;
/**
* Tests actions provided by the Comment module.
......@@ -50,7 +51,7 @@ function testCommentUnpublishByKeyword() {
$this->drupalLogin($this->adminUser);
$keyword_1 = $this->randomMachineName();
$keyword_2 = $this->randomMachineName();
$action = entity_create('action', array(
$action = Action::create(array(
'id' => 'comment_unpublish_by_keyword_action',
'label' => $this->randomMachineName(),
'type' => 'comment',
......
......@@ -9,6 +9,7 @@
use Drupal\simpletest\KernelTestBase;
use Drupal\Core\Action\ActionInterface;
use Drupal\system\Entity\Action;
use Drupal\user\RoleInterface;
/**
......@@ -80,7 +81,7 @@ public function testOperations() {
*/
public function testDependencies() {
// Create a new action that depends on a user role.
$action = entity_create('action', array(
$action = Action::create(array(
'id' => 'user_add_role_action.' . RoleInterface::ANONYMOUS_ID,
'type' => 'user',
'label' => t('Add the anonymous role to the selected users'),
......
......@@ -10,6 +10,7 @@
use Drupal\Core\Entity\EntityWithPluginCollectionInterface;
use Drupal\image\Entity\ImageStyle;
use Drupal\simpletest\WebTestBase;
use Drupal\system\Entity\Action;
/**
* Tests ConfigEntity importing.
......@@ -50,7 +51,7 @@ public function testConfigUpdateImport() {
protected function doActionUpdate() {
// Create a test action with a known label.
$name = 'system.action.apple';
$entity = entity_create('action', array(
$entity = Action::create(array(
'id' => 'apple',
'plugin' => 'action_message_action',
));
......
......@@ -13,6 +13,7 @@
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\Core\Site\Settings;
use Drupal\Core\Url;
use Drupal\system\Entity\Action;
use Drupal\user\Entity\Role;
use Drupal\user\Entity\User;
use Drupal\user\RoleInterface;
......@@ -985,7 +986,7 @@ function user_user_role_insert(RoleInterface $role) {
$add_id = 'user_add_role_action.' . $role->id();
if (!entity_load('action', $add_id)) {
$action = entity_create('action', array(
$action = Action::create(array(
'id' => $add_id,
'type' => 'user',
'label' => t('Add the @label role to the selected users', array('@label' => $role->label())),
......@@ -998,7 +999,7 @@ function user_user_role_insert(RoleInterface $role) {
}
$remove_id = 'user_remove_role_action.' . $role->id();
if (!entity_load('action', $remove_id)) {
$action = entity_create('action', array(
$action = Action::create(array(
'id' => $remove_id,
'type' => 'user',
'label' => t('Remove the @label role from the selected users', array('@label' => $role->label())),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment