Commit 27daa8c3 authored by catch's avatar catch

Issue #2641692 by Mac_Weber: Replace deprecated usage of ...

Issue #2641692 by Mac_Weber: Replace deprecated usage of  entity_create('user_role') with a direct call to UserRole::create()
parent c3c53eac
......@@ -25,6 +25,7 @@
use Drupal\Core\StreamWrapper\StreamWrapperInterface;
use Drupal\Core\Test\TestRunnerKernel;
use Drupal\Core\Url;
use Drupal\user\Entity\Role;
use Drupal\user\UserInterface;
use Symfony\Component\HttpFoundation\Request;
......@@ -614,7 +615,7 @@ protected function drupalCreateRole(array $permissions, $rid = NULL, $name = NUL
// Create new role.
/* @var \Drupal\user\RoleInterface $role */
$role = entity_create('user_role', array(
$role = Role::create(array(
'id' => $rid,
'label' => $name,
));
......
......@@ -9,6 +9,7 @@
use Drupal\simpletest\KernelTestBase;
use Drupal\Core\Entity\EntityInterface;
use Drupal\user\Entity\Role;
/**
* Defines an abstract test base for entity unit tests.
......@@ -99,7 +100,7 @@ protected function setUp() {
protected function createUser($values = array(), $permissions = array()) {
if ($permissions) {
// Create a new role and apply permissions to it.
$role = entity_create('user_role', array(
$role = Role::create(array(
'id' => strtolower($this->randomMachineName(8)),
'label' => $this->randomMachineName(8),
));
......
......@@ -10,6 +10,7 @@
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\field\Entity\FieldConfig;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Drupal\user\Entity\Role;
/**
* Tests the user reference field functionality.
......@@ -40,13 +41,13 @@ class UserEntityReferenceTest extends EntityUnitTestBase {
protected function setUp() {
parent::setUp();
$this->role1 = entity_create('user_role', array(
$this->role1 = Role::create(array(
'id' => strtolower($this->randomMachineName(8)),
'label' => $this->randomMachineName(8),
));
$this->role1->save();
$this->role2 = entity_create('user_role', array(
$this->role2 = Role::create(array(
'id' => strtolower($this->randomMachineName(8)),
'label' => $this->randomMachineName(8),
));
......
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