diff --git a/core/modules/config/src/Tests/ConfigEntityTest.php b/core/modules/config/src/Tests/ConfigEntityTest.php index 13ab721..dbc388d 100644 --- a/core/modules/config/src/Tests/ConfigEntityTest.php +++ b/core/modules/config/src/Tests/ConfigEntityTest.php @@ -8,6 +8,7 @@ namespace Drupal\config\Tests; use Drupal\Component\Utility\SafeMarkup; +use Drupal\config_test\Entity\ConfigTest; use Drupal\Core\Entity\EntityMalformedException; use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Config\Entity\ConfigEntityStorage; @@ -40,7 +41,7 @@ class ConfigEntityTest extends WebTestBase { function testCRUD() { $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId(); // Verify default properties on a newly created empty entity. - $empty = entity_create('config_test'); + $empty = ConfigTest::create(); $this->assertTrue($empty->uuid()); $this->assertIdentical($empty->label, NULL); $this->assertIdentical($empty->style, NULL); @@ -81,7 +82,7 @@ function testCRUD() { } // Verify that an entity with an empty ID string is considered empty, too. - $empty_id = entity_create('config_test', array( + $empty_id = ConfigTest::create(array( 'id' => '', )); $this->assertIdentical($empty_id->isNew(), TRUE); @@ -94,7 +95,7 @@ function testCRUD() { } // Verify properties on a newly created entity. - $config_test = entity_create('config_test', $expected = array( + $config_test = ConfigTest::create($expected = array( 'id' => $this->randomMachineName(), 'label' => $this->randomString(), 'style' => $this->randomMachineName(), @@ -146,7 +147,7 @@ function testCRUD() { // maximum allowed length, but not longer. // Test with a short ID. - $id_length_config_test = entity_create('config_test', array( + $id_length_config_test = ConfigTest::create(array( 'id' => $this->randomMachineName(8), )); try { @@ -160,7 +161,7 @@ function testCRUD() { } // Test with an ID of the maximum allowed length. - $id_length_config_test = entity_create('config_test', array( + $id_length_config_test = ConfigTest::create(array( 'id' => $this->randomMachineName(static::MAX_ID_LENGTH), )); try { @@ -174,7 +175,7 @@ function testCRUD() { } // Test with an ID exceeding the maximum allowed length. - $id_length_config_test = entity_create('config_test', array( + $id_length_config_test = ConfigTest::create(array( 'id' => $this->randomMachineName(static::MAX_ID_LENGTH + 1), )); try { @@ -193,7 +194,7 @@ function testCRUD() { // Ensure that creating an entity with the same id as an existing one is not // possible. - $same_id = entity_create('config_test', array( + $same_id = ConfigTest::create(array( 'id' => $config_test->id(), )); $this->assertIdentical($same_id->isNew(), TRUE); @@ -227,7 +228,7 @@ function testCRUD() { // Test config entity prepopulation. \Drupal::state()->set('config_test.prepopulate', TRUE); - $config_test = entity_create('config_test', array('foo' => 'bar')); + $config_test = ConfigTest::create(array('foo' => 'bar')); $this->assertEqual($config_test->get('foo'), 'baz', 'Initial value correctly populated'); } diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php index 13b56d5..2ad653b 100644 --- a/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php @@ -8,6 +8,7 @@ namespace Drupal\config_translation\Tests; use Drupal\Component\Utility\Html; +use Drupal\config_test\Entity\ConfigTest; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\simpletest\WebTestBase; @@ -95,7 +96,7 @@ public function testMapperListPage() { ); foreach ($labels as $label) { - $test_entity = entity_create('config_test', array( + $test_entity = ConfigTest::create(array( 'id' => $this->randomMachineName(), 'label' => $label, )); diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php index ef536f4..9022147 100644 --- a/core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php +++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\SafeMarkup; use Drupal\config\Tests\AssertConfigEntityImportTrait; +use Drupal\config_test\Entity\ConfigTest; use Drupal\entity_test\Entity\EntityTest; use Drupal\field\Entity\FieldConfig; use Drupal\simpletest\WebTestBase; @@ -198,9 +199,9 @@ protected function assertFieldValues($entity_name, $referenced_entities) { * An array of entity objects. */ protected function getTestEntities() { - $config_entity_1 = entity_create('config_test', array('id' => $this->randomMachineName(), 'label' => $this->randomMachineName())); + $config_entity_1 = ConfigTest::create(array('id' => $this->randomMachineName(), 'label' => $this->randomMachineName())); $config_entity_1->save(); - $config_entity_2 = entity_create('config_test', array('id' => $this->randomMachineName(), 'label' => $this->randomMachineName())); + $config_entity_2 = ConfigTest::create(array('id' => $this->randomMachineName(), 'label' => $this->randomMachineName())); $config_entity_2->save(); $content_entity_1 = EntityTest::create(array('name' => $this->randomMachineName())); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php index b6162a7..409b2f8 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php @@ -7,6 +7,7 @@ namespace Drupal\KernelTests\Core\Config; +use Drupal\config_test\Entity\ConfigTest; use Drupal\KernelTests\KernelTestBase; /** @@ -81,7 +82,7 @@ function testDiff() { // Test diffing a renamed config entity. $test_entity_id = $this->randomMachineName(); - $test_entity = entity_create('config_test', array( + $test_entity = ConfigTest::create(array( 'id' => $test_entity_id, 'label' => $this->randomMachineName(), )); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php index 65fe117..628279f 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php @@ -7,6 +7,7 @@ namespace Drupal\KernelTests\Core\Config; +use Drupal\config_test\Entity\ConfigTest; use Drupal\KernelTests\KernelTestBase; /** @@ -29,7 +30,7 @@ protected function setUp() { } public function testNormalize() { - $config_entity = entity_create('config_test', array('id' => 'system', 'label' => 'foobar', 'weight' => 1)); + $config_entity = ConfigTest::create(array('id' => 'system', 'label' => 'foobar', 'weight' => 1)); $config_entity->save(); // Modify stored config entity, this is comparable with a schema change. diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStatusTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStatusTest.php index 477fdf4..0367534 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStatusTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStatusTest.php @@ -7,6 +7,7 @@ namespace Drupal\KernelTests\Core\Config; +use Drupal\config_test\Entity\ConfigTest; use Drupal\KernelTests\KernelTestBase; /** @@ -27,7 +28,7 @@ class ConfigEntityStatusTest extends KernelTestBase { * Tests the enabling/disabling of entities. */ function testCRUD() { - $entity = entity_create('config_test', array( + $entity = ConfigTest::create(array( 'id' => strtolower($this->randomMachineName()), )); $this->assertTrue($entity->status(), 'Default status is enabled.'); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php index 80b4cb1..910f5db 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php @@ -10,6 +10,7 @@ use Drupal\Component\Utility\SafeMarkup; use Drupal\Component\Utility\Unicode; use Drupal\Component\Uuid\Php; +use Drupal\config_test\Entity\ConfigTest; use Drupal\Core\Config\ConfigImporter; use Drupal\Core\Config\ConfigImporterException; use Drupal\Core\Config\StorageComparer; @@ -72,7 +73,7 @@ protected function setUp() { public function testRenameValidation() { // Create a test entity. $test_entity_id = $this->randomMachineName(); - $test_entity = entity_create('config_test', array( + $test_entity = ConfigTest::create(array( 'id' => $test_entity_id, 'label' => $this->randomMachineName(), )); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php index 3687f34..24f909b 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php @@ -7,6 +7,7 @@ namespace Drupal\KernelTests\Core\Entity; +use Drupal\config_test\Entity\ConfigTest; use Drupal\Core\Config\Entity\Query\QueryFactory; use Drupal\config_test\Entity\ConfigQueryTest; use Drupal\KernelTests\KernelTestBase; @@ -604,7 +605,7 @@ public function testLookupKeys() { $key_value = $this->container->get('keyvalue')->get(QueryFactory::CONFIG_LOOKUP_PREFIX . 'config_test'); $test_entities = []; - $entity = entity_create('config_test', array( + $entity = ConfigTest::create(array( 'label' => $this->randomMachineName(), 'id' => '1', 'style' => 'test', @@ -617,7 +618,7 @@ public function testLookupKeys() { $expected[] = $entity->getConfigDependencyName(); $this->assertEqual($expected, $key_value->get('style:test')); - $entity = entity_create('config_test', array( + $entity = ConfigTest::create(array( 'label' => $this->randomMachineName(), 'id' => '2', 'style' => 'test', @@ -628,7 +629,7 @@ public function testLookupKeys() { $expected[] = $entity->getConfigDependencyName(); $this->assertEqual($expected, $key_value->get('style:test')); - $entity = entity_create('config_test', array( + $entity = ConfigTest::create(array( 'label' => $this->randomMachineName(), 'id' => '3', 'style' => 'blah',