Commit f0e50041 authored by alexpott's avatar alexpott

Issue #2723521 by valthebald: Remove entity_load* usage for action entity type

parent 26761757
......@@ -25,7 +25,9 @@ class ActionUninstallTest extends WebTestBase {
public function testActionUninstall() {
\Drupal::service('module_installer')->uninstall(array('action'));
$this->assertTrue(entity_load('action', 'user_block_user_action', TRUE), 'Configuration entity \'user_block_user_action\' still exists after uninstalling action module.' );
$storage = $this->container->get('entity_type.manager')->getStorage('action');
$storage->resetCache(['user_block_user_action']);
$this->assertTrue($storage->load('user_block_user_action'), 'Configuration entity \'user_block_user_action\' still exists after uninstalling action module.' );
$admin_user = $this->drupalCreateUser(array('administer users'));
$this->drupalLogin($admin_user);
......
......@@ -4,6 +4,7 @@
use Drupal\Component\Utility\Crypt;
use Drupal\simpletest\WebTestBase;
use Drupal\system\Entity\Action;
/**
* Tests complex actions configuration by adding, editing, and deleting a
......@@ -81,7 +82,7 @@ function testActionConfiguration() {
$this->assertResponse(200);
$this->assertNoText($new_action_label, "Make sure the action label does not appear on the overview page after we've deleted the action.");
$action = entity_load('action', $aid);
$action = Action::load($aid);
$this->assertFalse($action, 'Make sure the action is gone after being deleted.');
}
......
......@@ -29,12 +29,12 @@ function testCommentPublishUnpublishActions() {
$comment = $this->postComment($this->node, $comment_text, $subject);
// Unpublish a comment.
$action = entity_load('action', 'comment_unpublish_action');
$action = Action::load('comment_unpublish_action');
$action->execute(array($comment));
$this->assertTrue($comment->isPublished() === FALSE, 'Comment was unpublished');
// Publish a comment.
$action = entity_load('action', 'comment_publish_action');
$action = Action::load('comment_publish_action');
$action->execute(array($comment));
$this->assertTrue($comment->isPublished() === TRUE, 'Comment was published');
}
......
......@@ -984,7 +984,7 @@ function user_user_role_insert(RoleInterface $role) {
}
$add_id = 'user_add_role_action.' . $role->id();
if (!entity_load('action', $add_id)) {
if (!Action::load($add_id)) {
$action = Action::create(array(
'id' => $add_id,
'type' => 'user',
......@@ -997,7 +997,7 @@ function user_user_role_insert(RoleInterface $role) {
$action->trustData()->save();
}
$remove_id = 'user_remove_role_action.' . $role->id();
if (!entity_load('action', $remove_id)) {
if (!Action::load($remove_id)) {
$action = Action::create(array(
'id' => $remove_id,
'type' => 'user',
......@@ -1024,10 +1024,10 @@ function user_user_role_delete(RoleInterface $role) {
return;
}
$actions = entity_load_multiple('action', array(
$actions = Action::loadMultiple([
'user_add_role_action.' . $role->id(),
'user_remove_role_action.' . $role->id(),
));
]);
foreach ($actions as $action) {
$action->delete();
}
......
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