summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-01-01 04:26:26 (GMT)
committerNathaniel Catchpole2016-01-01 04:26:26 (GMT)
commit7a4f6f580220ab82298cf000b9fb4b98b06eff12 (patch)
tree9784bc0e763973e937c8b70dd93f23fe5cae759c
parent9b2f974fe690b35131d7aaac6a01e3f08049dfc5 (diff)
Issue #2494775 by DuaelFr: Replace deprecated usage of entity_create('action') with a direct call to Action::create()
-rw-r--r--core/modules/comment/src/Tests/CommentActionsTest.php3
-rw-r--r--core/modules/system/src/Tests/Action/ActionUnitTest.php3
-rw-r--r--core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php3
-rw-r--r--core/modules/user/user.module5
4 files changed, 9 insertions, 5 deletions
diff --git a/core/modules/comment/src/Tests/CommentActionsTest.php b/core/modules/comment/src/Tests/CommentActionsTest.php
index 5cf7ead..51fbd36 100644
--- a/core/modules/comment/src/Tests/CommentActionsTest.php
+++ b/core/modules/comment/src/Tests/CommentActionsTest.php
@@ -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 @@ class CommentActionsTest extends CommentTestBase {
$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',
diff --git a/core/modules/system/src/Tests/Action/ActionUnitTest.php b/core/modules/system/src/Tests/Action/ActionUnitTest.php
index 7bc57b5..6de447f 100644
--- a/core/modules/system/src/Tests/Action/ActionUnitTest.php
+++ b/core/modules/system/src/Tests/Action/ActionUnitTest.php
@@ -9,6 +9,7 @@ namespace Drupal\system\Tests\Action;
use Drupal\simpletest\KernelTestBase;
use Drupal\Core\Action\ActionInterface;
+use Drupal\system\Entity\Action;
use Drupal\user\RoleInterface;
/**
@@ -80,7 +81,7 @@ class ActionUnitTest extends KernelTestBase {
*/
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'),
diff --git a/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php b/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php
index f7fbe1c..1dae804 100644
--- a/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php
+++ b/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php
@@ -10,6 +10,7 @@ namespace Drupal\system\Tests\Entity;
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 @@ class ConfigEntityImportTest extends WebTestBase {
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',
));
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 3d76074..f7b3968 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -13,6 +13,7 @@ use Drupal\Core\Session\AccountInterface;
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())),