Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Commit

Permalink
Issue #3033639 by Neslee Canil Pinto, phenaproxima: Replace entity_lo…
Browse files Browse the repository at this point in the history
…ad() calls with entity load()
  • Loading branch information
Adam Hoenich committed Feb 19, 2019
1 parent f930942 commit f64d0ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lightning.profile
Expand Up @@ -8,6 +8,7 @@
use Drupal\lightning_core\ConfigHelper as Config;
use Drupal\node\Entity\NodeType;
use Drupal\user\RoleInterface;
use Drupal\user\Entity\User;

/**
* Implements hook_install_tasks().
Expand All @@ -31,7 +32,7 @@ function lightning_install_tasks() {
*/
function lightning_prepare_administrator() {
/** @var \Drupal\user\UserInterface $account */
$account = entity_load('user', 1);
$account = User::load(1);
if ($account) {
$account->addRole('administrator');
$account->save();
Expand Down
3 changes: 2 additions & 1 deletion tests/src/Functional/ConfigIntegrityTest.php
Expand Up @@ -5,6 +5,7 @@
use Drupal\Core\Entity\Entity\EntityViewMode;
use Drupal\Tests\BrowserTestBase;
use Drupal\user\Entity\Role;
use Drupal\user\Entity\User;
use Drupal\user\UserInterface;
use Drupal\workflows\Entity\Workflow;

Expand Down Expand Up @@ -36,7 +37,7 @@ public function testConfig() {

// Assert that all install tasks have done what they should do.
// @see lightning_install_tasks()
$account = entity_load('user', 1);
$account = User::load( 1);
$this->assertInstanceOf(UserInterface::class, $account);
/** @var UserInterface $account */
$this->assertTrue($account->hasRole('administrator'));
Expand Down

0 comments on commit f64d0ef

Please sign in to comment.