summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-01-04 06:02:02 (GMT)
committerNathaniel Catchpole2016-01-04 06:02:02 (GMT)
commit27daa8c3b6227b21a2adf5120f945e90781a7082 (patch)
tree859ba30aab8164a41efe61c7cc6bd23b25025eee
parentc3c53eacf37ea407c8decfc8bcb40442f9ff99ca (diff)
Issue #2641692 by Mac_Weber: Replace deprecated usage of entity_create('user_role') with a direct call to UserRole::create()
-rw-r--r--core/modules/simpletest/src/BrowserTestBase.php3
-rw-r--r--core/modules/system/src/Tests/Entity/EntityUnitTestBase.php3
-rw-r--r--core/modules/user/src/Tests/UserEntityReferenceTest.php5
3 files changed, 7 insertions, 4 deletions
diff --git a/core/modules/simpletest/src/BrowserTestBase.php b/core/modules/simpletest/src/BrowserTestBase.php
index d93ed8b..4f8c3fa 100644
--- a/core/modules/simpletest/src/BrowserTestBase.php
+++ b/core/modules/simpletest/src/BrowserTestBase.php
@@ -25,6 +25,7 @@ use Drupal\Core\Site\Settings;
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 @@ abstract class BrowserTestBase extends \PHPUnit_Framework_TestCase {
// Create new role.
/* @var \Drupal\user\RoleInterface $role */
- $role = entity_create('user_role', array(
+ $role = Role::create(array(
'id' => $rid,
'label' => $name,
));
diff --git a/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php b/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php
index 8940f0f..255765c 100644
--- a/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php
+++ b/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php
@@ -9,6 +9,7 @@ namespace Drupal\system\Tests\Entity;
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 @@ abstract class EntityUnitTestBase extends KernelTestBase {
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),
));
diff --git a/core/modules/user/src/Tests/UserEntityReferenceTest.php b/core/modules/user/src/Tests/UserEntityReferenceTest.php
index 65b92e5..8e21255 100644
--- a/core/modules/user/src/Tests/UserEntityReferenceTest.php
+++ b/core/modules/user/src/Tests/UserEntityReferenceTest.php
@@ -10,6 +10,7 @@ namespace Drupal\user\Tests;
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),
));