Commit be42f0e8 authored by catch's avatar catch

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

Issue #2641534 by Mac_Weber: Replace deprecated usage of  entity_create('entity_test_label') with a direct call to  EntityTestLabel::create()
parent 75128424
......@@ -15,6 +15,7 @@
use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;
use Drupal\entity_test\Entity\EntityTestLabel;
/**
* Tests the formatters functionality.
......@@ -259,7 +260,7 @@ public function testLabelFormatter() {
$field_storage_config->setSetting('target_type', 'entity_test_label');
$field_storage_config->save();
$referenced_entity_with_no_link_template = entity_create('entity_test_label', array(
$referenced_entity_with_no_link_template = EntityTestLabel::create(array(
'name' => $this->randomMachineName(),
));
$referenced_entity_with_no_link_template->save();
......
......@@ -10,6 +10,7 @@
use Drupal\Core\Entity\EntityMalformedException;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\simpletest\KernelTestBase;
use Drupal\entity_test\Entity\EntityTestLabel;
/**
* Tests KeyValueEntityStorage for content entities.
......@@ -39,7 +40,7 @@ protected function setUp() {
function testCRUD() {
$default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId();
// Verify default properties on a newly created empty entity.
$empty = entity_create('entity_test_label');
$empty = EntityTestLabel::create();
$this->assertIdentical($empty->id->value, NULL);
$this->assertIdentical($empty->name->value, NULL);
$this->assertTrue($empty->uuid->value);
......@@ -73,7 +74,7 @@ function testCRUD() {
}
// Verify that an entity with an empty ID string is considered empty, too.
$empty_id = entity_create('entity_test_label', array(
$empty_id = EntityTestLabel::create(array(
'id' => '',
));
$this->assertIdentical($empty_id->isNew(), TRUE);
......@@ -86,7 +87,7 @@ function testCRUD() {
}
// Verify properties on a newly created entity.
$entity_test = entity_create('entity_test_label', $expected = array(
$entity_test = EntityTestLabel::create($expected = array(
'id' => $this->randomMachineName(),
'name' => $this->randomString(),
));
......@@ -129,7 +130,7 @@ function testCRUD() {
// Ensure that creating an entity with the same id as an existing one is not
// possible.
$same_id = entity_create('entity_test_label', array(
$same_id = EntityTestLabel::create(array(
'id' => $entity_test->id(),
));
$this->assertIdentical($same_id->isNew(), TRUE);
......
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