diff --git a/core/modules/comment/src/Tests/CommentStringIdEntitiesTest.php b/core/modules/comment/src/Tests/CommentStringIdEntitiesTest.php index 028543288933f14b241f3895cd9582f01630295d..ef7f48d2e42c77bf2bc138329a6cbb8a2e1a785a 100644 --- a/core/modules/comment/src/Tests/CommentStringIdEntitiesTest.php +++ b/core/modules/comment/src/Tests/CommentStringIdEntitiesTest.php @@ -9,6 +9,7 @@ use Drupal\comment\Entity\CommentType; use Drupal\simpletest\KernelTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests that comment fields cannot be added to entities with non-integer IDs. @@ -51,7 +52,7 @@ public function testCommentFieldNonStringId() { 'target_entity_type_id' => 'entity_test_string_id', )); $bundle->save(); - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'foo', 'entity_type' => 'entity_test_string_id', 'settings' => array( diff --git a/core/modules/config/src/Tests/ConfigExportImportUITest.php b/core/modules/config/src/Tests/ConfigExportImportUITest.php index d72c718e8cdf1e2d1b219d7cdd21bcb15c478d4d..4dd6d8f7d28c308835340fae46440d5053c9e6a3 100644 --- a/core/modules/config/src/Tests/ConfigExportImportUITest.php +++ b/core/modules/config/src/Tests/ConfigExportImportUITest.php @@ -108,7 +108,7 @@ public function testExportImport() { // Create a field. $this->fieldName = Unicode::strtolower($this->randomMachineName()); - $this->fieldStorage = entity_create('field_storage_config', array( + $this->fieldStorage = FieldStorageConfig::create(array( 'field_name' => $this->fieldName, 'entity_type' => 'node', 'type' => 'text', diff --git a/core/modules/contact/src/Tests/Views/ContactFieldsTest.php b/core/modules/contact/src/Tests/Views/ContactFieldsTest.php index 014e9689858321996cbfd92819c0bbfd59039266..c04a145dbe1169f7513d8a9d7a52a5ad80bd18b0 100644 --- a/core/modules/contact/src/Tests/Views/ContactFieldsTest.php +++ b/core/modules/contact/src/Tests/Views/ContactFieldsTest.php @@ -8,6 +8,7 @@ namespace Drupal\contact\Tests\Views; use Drupal\views\Tests\ViewTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests which checks that no fieldapi fields are added on contact. @@ -33,7 +34,7 @@ class ContactFieldsTest extends ViewTestBase { protected function setUp() { parent::setUp(); - $this->fieldStorage = entity_create('field_storage_config', array( + $this->fieldStorage = FieldStorageConfig::create(array( 'field_name' => strtolower($this->randomMachineName()), 'entity_type' => 'contact_message', 'type' => 'text' diff --git a/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php index edccaf06278f466ebc2ca837adc72c71a0658ed5..ae0a8885bdf8d451396e25353e23f40e78624be5 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php @@ -11,6 +11,7 @@ use Drupal\language\Entity\ConfigurableLanguage; use Drupal\node\Entity\NodeType; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests that contextual links are available for content translation. @@ -72,7 +73,7 @@ protected function setUp() { $this->contentType = $this->drupalCreateContentType(array('type' => $this->bundle)); // Add a field to the content type. The field is not yet translatable. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'field_test_text', 'entity_type' => 'node', 'type' => 'text', diff --git a/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php index 56b1ed5af33ebdd585bac025a29a77d3dfbf8d6d..ea80e271a6301427a9864f186f2b5a463482cb40 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php @@ -8,6 +8,7 @@ namespace Drupal\content_translation\Tests; use Drupal\Core\Entity\EntityInterface; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the field synchronization behavior for the image field. @@ -49,7 +50,7 @@ protected function setupTestFields() { $this->fieldName = 'field_test_et_ui_image'; $this->cardinality = 3; - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $this->fieldName, 'entity_type' => $this->entityTypeId, 'type' => 'image', diff --git a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php index d00b3789a29a0416badb84a8fe2698e62c12a99d..f7a4d65186e832cf9e1fc8773c2a87cf213bb664 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php @@ -10,6 +10,7 @@ use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Base class for content translation tests. @@ -183,7 +184,7 @@ protected function setupTestFields() { if (empty($this->fieldName)) { $this->fieldName = 'field_test_et_ui_test'; } - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $this->fieldName, 'type' => 'string', 'entity_type' => $this->entityTypeId, diff --git a/core/modules/datetime/src/Tests/DateTimeFieldTest.php b/core/modules/datetime/src/Tests/DateTimeFieldTest.php index 14ad1900c8cc3a59d9f398baadff43809a9fd3e7..0aa39fc35a088fba882d3a76bbe58a2a3278143a 100644 --- a/core/modules/datetime/src/Tests/DateTimeFieldTest.php +++ b/core/modules/datetime/src/Tests/DateTimeFieldTest.php @@ -12,6 +12,7 @@ use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Core\Datetime\DrupalDateTime; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests Datetime field functionality. @@ -77,7 +78,7 @@ protected function setUp() { // Create a field with settings to validate. $field_name = Unicode::strtolower($this->randomMachineName()); - $this->fieldStorage = entity_create('field_storage_config', array( + $this->fieldStorage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'datetime', @@ -624,7 +625,7 @@ function testDefaultValue() { // Create a field storage with settings to validate. $field_name = Unicode::strtolower($this->randomMachineName()); - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'node', 'type' => 'datetime', diff --git a/core/modules/datetime/src/Tests/DateTimeItemTest.php b/core/modules/datetime/src/Tests/DateTimeItemTest.php index d83d2a2ad1d4a7965d4aaeeecca0e329c2525fa1..658e0fb9c7a8c08bdaaeb3100a6e56245de11037 100644 --- a/core/modules/datetime/src/Tests/DateTimeItemTest.php +++ b/core/modules/datetime/src/Tests/DateTimeItemTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemInterface; use Drupal\field\Tests\FieldUnitTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the new entity API for the date field type. @@ -29,7 +30,7 @@ protected function setUp() { parent::setUp(); // Create a field with settings to validate. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_datetime', 'type' => 'datetime', 'entity_type' => 'entity_test', diff --git a/core/modules/datetime/src/Tests/Views/DateTimeHandlerTestBase.php b/core/modules/datetime/src/Tests/Views/DateTimeHandlerTestBase.php index 068f7184da4d69cba31c33f2a855397956b599bb..b563f045c325b8c681eb982edc8f0b7e0eae4f40 100644 --- a/core/modules/datetime/src/Tests/Views/DateTimeHandlerTestBase.php +++ b/core/modules/datetime/src/Tests/Views/DateTimeHandlerTestBase.php @@ -10,6 +10,7 @@ use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem; use Drupal\views\Tests\Handler\HandlerTestBase; use Drupal\views\Tests\ViewTestData; +use Drupal\field\Entity\FieldStorageConfig; /** * Base class for testing datetime handlers. @@ -49,7 +50,7 @@ protected function setUp() { 'name' => 'page' ]); $node_type->save(); - $fieldStorage = entity_create('field_storage_config', [ + $fieldStorage = FieldStorageConfig::create([ 'field_name' => static::$field_name, 'entity_type' => 'node', 'type' => 'datetime', diff --git a/core/modules/field/src/Entity/FieldStorageConfig.php b/core/modules/field/src/Entity/FieldStorageConfig.php index d4c29221f0ed90733df1ff83a0b278e32010b91e..eaf14c6b3e1c5e597f59bb96e5c1f2260fa64e15 100644 --- a/core/modules/field/src/Entity/FieldStorageConfig.php +++ b/core/modules/field/src/Entity/FieldStorageConfig.php @@ -15,6 +15,7 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\TypedData\OptionsProviderInterface; use Drupal\field\FieldStorageConfigInterface; +use Drupal\field\Entity\FieldStorageConfig; /** * Defines the Field storage configuration entity. @@ -238,7 +239,7 @@ class FieldStorageConfig extends ConfigEntityBase implements FieldStorageConfigI * - type: required. * * In most cases, Field entities are created via - * entity_create('field_storage_config', $values)), where $values is the same + * FieldStorageConfig::create($values)), where $values is the same * parameter as in this constructor. * * @see entity_create() diff --git a/core/modules/field/src/Tests/Boolean/BooleanItemTest.php b/core/modules/field/src/Tests/Boolean/BooleanItemTest.php index e9d76052d7391c27deaf96d6406b68624d7c5960..5647073d7bc4ff61ac59f64615bf69864fd07fdf 100644 --- a/core/modules/field/src/Tests/Boolean/BooleanItemTest.php +++ b/core/modules/field/src/Tests/Boolean/BooleanItemTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemInterface; use Drupal\field\Tests\FieldUnitTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the new entity API for the boolean field type. @@ -25,7 +26,7 @@ protected function setUp() { parent::setUp(); // Create a boolean field and storage for validation. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'field_boolean', 'entity_type' => 'entity_test', 'type' => 'boolean', diff --git a/core/modules/field/src/Tests/BulkDeleteTest.php b/core/modules/field/src/Tests/BulkDeleteTest.php index d7e1aca32896c1c068d27c59b77a08ea6dbd7c84..3a9f5b86617bff11ccde2e1c3c84336888f0fd88 100644 --- a/core/modules/field/src/Tests/BulkDeleteTest.php +++ b/core/modules/field/src/Tests/BulkDeleteTest.php @@ -9,6 +9,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; /** * Bulk delete storages and fields, and clean up afterwards. @@ -105,7 +106,7 @@ protected function setUp() { } // Create two field storages. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'bf_1', 'entity_type' => $this->entityTypeId, 'type' => 'test_field', @@ -113,7 +114,7 @@ protected function setUp() { )); $field_storage->save(); $this->fieldStorages[] = $field_storage; - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'bf_2', 'entity_type' => $this->entityTypeId, 'type' => 'test_field', diff --git a/core/modules/field/src/Tests/DisplayApiTest.php b/core/modules/field/src/Tests/DisplayApiTest.php index 0ad584dded5d1de4e7d2df3349a5ff732d2931ad..f06f7829d23cf55fef5cab1d866c794c4d979936 100644 --- a/core/modules/field/src/Tests/DisplayApiTest.php +++ b/core/modules/field/src/Tests/DisplayApiTest.php @@ -8,6 +8,7 @@ namespace Drupal\field\Tests; use Drupal\Core\Entity\Entity\EntityViewMode; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the field display API. @@ -94,7 +95,7 @@ protected function setUp() { ), ); - entity_create('field_storage_config', $field_storage)->save(); + FieldStorageConfig::create($field_storage)->save(); entity_create('field_config', $field)->save(); // Create a display for the default view mode. entity_get_display($field['entity_type'], $field['bundle'], 'default') diff --git a/core/modules/field/src/Tests/Email/EmailFieldTest.php b/core/modules/field/src/Tests/Email/EmailFieldTest.php index b916ed0c86a6c45b9e92c4dad58419859bd578cd..1bbd0f658fa380dc6b1a5c493b60a800d0e65df0 100644 --- a/core/modules/field/src/Tests/Email/EmailFieldTest.php +++ b/core/modules/field/src/Tests/Email/EmailFieldTest.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\Unicode; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests email field functionality. @@ -54,7 +55,7 @@ protected function setUp() { function testEmailField() { // Create a field with settings to validate. $field_name = Unicode::strtolower($this->randomMachineName()); - $this->fieldStorage = entity_create('field_storage_config', array( + $this->fieldStorage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'email', diff --git a/core/modules/field/src/Tests/Email/EmailItemTest.php b/core/modules/field/src/Tests/Email/EmailItemTest.php index b6a148f30a824ef1ecc6aa0f9410a9726dbfb8db..58c1e290718d74ed7f2cc779b7348540d1635860 100644 --- a/core/modules/field/src/Tests/Email/EmailItemTest.php +++ b/core/modules/field/src/Tests/Email/EmailItemTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemInterface; use Drupal\field\Tests\FieldUnitTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the new entity API for the email field type. @@ -22,7 +23,7 @@ protected function setUp() { parent::setUp(); // Create an email field storage and field for validation. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'field_email', 'entity_type' => 'entity_test', 'type' => 'email', diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceAutoCreateTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceAutoCreateTest.php index 77bede957311f626277e62d2d09aeee88617b245..9279dc0f23e973cc32893e34b8c11725d90b2fbe 100644 --- a/core/modules/field/src/Tests/EntityReference/EntityReferenceAutoCreateTest.php +++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceAutoCreateTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\simpletest\WebTestBase; use Drupal\node\Entity\Node; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests creating new entity (e.g. taxonomy-term) from an autocomplete widget. @@ -44,7 +45,7 @@ protected function setUp() { $referenced = $this->drupalCreateContentType(); $this->referencedType = $referenced->id(); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'test_field', 'entity_type' => 'node', 'translatable' => FALSE, diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldDefaultValueTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldDefaultValueTest.php index ae6fec74a75632f246e21a238540abfb94b3c8c9..473f9e0682311692e51f83b0376813ec05949688 100644 --- a/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldDefaultValueTest.php +++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldDefaultValueTest.php @@ -55,7 +55,7 @@ function testEntityReferenceDefaultValue() { $referenced_node = $this->drupalCreateNode(array('type' => 'referenced_content')); $field_name = Unicode::strtolower($this->randomMachineName()); - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'node', 'type' => 'entity_reference', @@ -118,7 +118,7 @@ function testEntityReferenceDefaultConfigValue() { $referenced_node_type2 = $this->drupalCreateContentType(array('type' => 'referenced_config_to_preserve')); $field_name = Unicode::strtolower($this->randomMachineName()); - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'node', 'type' => 'entity_reference', diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php index 7b3568c1ad6673669b173dde98e515324739878b..bad3d98d6bfc63fabe5a03ea2e6d94b113938fb5 100644 --- a/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php +++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php @@ -10,6 +10,7 @@ use Drupal\language\Entity\ConfigurableLanguage; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the translation of entity reference field display on nodes. @@ -206,7 +207,7 @@ protected function enableTranslation() { * Adds term reference field for the article content type. */ protected function setUpEntityReferenceField() { - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $this->referenceFieldName, 'entity_type' => $this->testEntityTypeName, 'type' => 'entity_reference', diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceFileUploadTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFileUploadTest.php index eb9f6404066d48060c8daf64c6b6c5916a1ec971..922b865c6c3dfaa2bcce73326f094632cbde4751 100644 --- a/core/modules/field/src/Tests/EntityReference/EntityReferenceFileUploadTest.php +++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFileUploadTest.php @@ -9,6 +9,7 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests an autocomplete widget with file upload. @@ -51,7 +52,7 @@ protected function setUp() { $this->referencedType = $referenced->id(); $this->nodeId = $this->drupalCreateNode(array('type' => $referenced->id()))->id(); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'test_field', 'entity_type' => 'node', 'translatable' => FALSE, @@ -83,7 +84,7 @@ protected function setUp() { // Create a file field. $file_field_name = 'file_field'; - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $file_field_name, 'entity_type' => 'node', 'type' => 'file' diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php index 87da3ec1a596a9dfc191a3195093d6282b22ed48..5654f706be22597adaa77e8b37b9bdc360f8a62a 100644 --- a/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php +++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php @@ -82,7 +82,7 @@ protected function setUp() { // Set up a field, so that the entity that'll be referenced bubbles up a // cache tag when rendering it entirely. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'body', 'entity_type' => $this->entityType, 'type' => 'text', diff --git a/core/modules/field/src/Tests/EntityReference/Views/SelectionTest.php b/core/modules/field/src/Tests/EntityReference/Views/SelectionTest.php index c5db78b724b965b0dd8b1f0e64845cbf928d967d..69986d84fbbf53e09515b60b4a62737f1be92300 100644 --- a/core/modules/field/src/Tests/EntityReference/Views/SelectionTest.php +++ b/core/modules/field/src/Tests/EntityReference/Views/SelectionTest.php @@ -9,6 +9,7 @@ use Drupal\simpletest\WebTestBase; use Drupal\views\Views; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests entity reference selection handler. @@ -50,7 +51,7 @@ protected function setUp() { } // Create a field. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'test_field', 'entity_type' => 'entity_test', 'translatable' => FALSE, diff --git a/core/modules/field/src/Tests/FieldAccessTest.php b/core/modules/field/src/Tests/FieldAccessTest.php index 3617364dd72b0035c27d0eb33e7726a868e359b9..d00ce9205166a2d39cd6f720da13108a24fcdac5 100644 --- a/core/modules/field/src/Tests/FieldAccessTest.php +++ b/core/modules/field/src/Tests/FieldAccessTest.php @@ -7,6 +7,8 @@ namespace Drupal\field\Tests; +use Drupal\field\Entity\FieldStorageConfig; + /** * Tests Field access. * @@ -50,7 +52,7 @@ protected function setUp() { 'entity_type' => 'node', 'type' => 'text', ); - entity_create('field_storage_config', $field_storage)->save(); + FieldStorageConfig::create($field_storage)->save(); $field = array( 'field_name' => $field_storage['field_name'], 'entity_type' => 'node', diff --git a/core/modules/field/src/Tests/FieldAttachStorageTest.php b/core/modules/field/src/Tests/FieldAttachStorageTest.php index a7c72178e8712c08a8f30fbf6f2b0e9b751751ed..31c11d90cf450bff6aff0651eed1bb13f0a0fa67 100644 --- a/core/modules/field/src/Tests/FieldAttachStorageTest.php +++ b/core/modules/field/src/Tests/FieldAttachStorageTest.php @@ -8,6 +8,7 @@ namespace Drupal\field\Tests; use Drupal\Component\Utility\Unicode; use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests storage-related Field Attach API functions. @@ -95,7 +96,7 @@ function testFieldAttachLoadMultiple() { ); for ($i = 1; $i <= 3; $i++) { $field_names[$i] = 'field_' . $i; - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $field_names[$i], 'entity_type' => $entity_type, 'type' => 'test_field', @@ -323,7 +324,7 @@ function testEntityDeleteBundle() { 'type' => 'test_field', 'cardinality' => 1, ); - entity_create('field_storage_config', $field_storage)->save(); + FieldStorageConfig::create($field_storage)->save(); $field = array( 'field_name' => $field_name, 'entity_type' => $entity_type, diff --git a/core/modules/field/src/Tests/FieldCrudTest.php b/core/modules/field/src/Tests/FieldCrudTest.php index d6e9994d3a4625c2a12399ed6ee4ec3dea99f0b8..621f58ee1b09e7e5b2e4cc298228ee08e89a3bde 100644 --- a/core/modules/field/src/Tests/FieldCrudTest.php +++ b/core/modules/field/src/Tests/FieldCrudTest.php @@ -50,7 +50,7 @@ function setUp() { 'entity_type' => 'entity_test', 'type' => 'test_field', ); - $this->fieldStorage = entity_create('field_storage_config', $this->fieldStorageDefinition); + $this->fieldStorage = FieldStorageConfig::create($this->fieldStorageDefinition); $this->fieldStorage->save(); $this->fieldDefinition = array( 'field_name' => $this->fieldStorage->getName(), @@ -262,7 +262,7 @@ function testDeleteFieldCrossDeletion() { $this->assertFalse(FieldConfig::loadByName('entity_test', $field_definition_2['bundle'], $field_storage->getName())); // Check that deletion of the last field deletes the storage. - $field_storage = entity_create('field_storage_config', $this->fieldStorageDefinition); + $field_storage = FieldStorageConfig::create($this->fieldStorageDefinition); $field_storage->save(); $field = entity_create('field_config', $this->fieldDefinition); $field->save(); @@ -275,7 +275,7 @@ function testDeleteFieldCrossDeletion() { // Check that deletion of all fields using a storage simultaneously deletes // the storage. - $field_storage = entity_create('field_storage_config', $this->fieldStorageDefinition); + $field_storage = FieldStorageConfig::create($this->fieldStorageDefinition); $field_storage->save(); $field = entity_create('field_config', $this->fieldDefinition); $field->save(); diff --git a/core/modules/field/src/Tests/FieldDataCountTest.php b/core/modules/field/src/Tests/FieldDataCountTest.php index bbb0cd914b004531607fcb31d41ae8b2d8ea6225..76dc6a030288d7528fc8da93959b5ddee3bf1109 100644 --- a/core/modules/field/src/Tests/FieldDataCountTest.php +++ b/core/modules/field/src/Tests/FieldDataCountTest.php @@ -54,7 +54,7 @@ public function testEntityCountAndHasData() { // Create a field with a cardinality of 2 to show that we are counting // entities and not rows in a table. /** @var \Drupal\field\Entity\FieldStorageConfig $field_storage */ - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_int', 'entity_type' => 'entity_test', 'type' => 'integer', diff --git a/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php b/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php index b5b2d1576ee92d812f49088bb363cf51b453966a..04547a8093bd60babff008ef760b1a4b7105afb7 100644 --- a/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php +++ b/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php @@ -7,6 +7,8 @@ namespace Drupal\field\Tests; +use Drupal\field\Entity\FieldStorageConfig; + /** * Delete field storages and fields during config synchronization and uninstall * module that provides the field type. @@ -39,7 +41,7 @@ public function testImportDeleteUninstall() { // Create a field to delete to prove that // \Drupal\field\ConfigImporterFieldPurger does not purge fields that are // not related to the configuration synchronization. - $unrelated_field_storage = entity_create('field_storage_config', array( + $unrelated_field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_int', 'entity_type' => 'entity_test', 'type' => 'integer', @@ -51,7 +53,7 @@ public function testImportDeleteUninstall() { ))->save(); // Create a telephone field for validation. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_test', 'entity_type' => 'entity_test', 'type' => 'telephone', @@ -113,7 +115,7 @@ public function testImportDeleteUninstall() { */ public function testImportAlreadyDeletedUninstall() { // Create a telephone field for validation. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_test', 'entity_type' => 'entity_test', 'type' => 'telephone', diff --git a/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php b/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php index 58766e88af8e71678c640a0e1972edd7743533b6..3d602ba9ced7e79cfc650e3ce1359619a2729fdc 100644 --- a/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php +++ b/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php @@ -7,6 +7,8 @@ namespace Drupal\field\Tests; +use Drupal\field\Entity\FieldStorageConfig; + /** * Delete field storages and fields during config synchronization and uninstall * module that provides the field type through the UI. @@ -36,7 +38,7 @@ protected function setUp() { */ public function testImportDeleteUninstall() { // Create a telephone field. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_tel', 'entity_type' => 'entity_test', 'type' => 'telephone', @@ -48,7 +50,7 @@ public function testImportDeleteUninstall() { ))->save(); // Create a text field. - $date_field_storage = entity_create('field_storage_config', array( + $date_field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_date', 'entity_type' => 'entity_test', 'type' => 'datetime', diff --git a/core/modules/field/src/Tests/FieldStorageCrudTest.php b/core/modules/field/src/Tests/FieldStorageCrudTest.php index 8912783e2b19dad59221953632cb5e550dd06ed5..0def12ca52cd84669bfb40f4861f914638791bba 100644 --- a/core/modules/field/src/Tests/FieldStorageCrudTest.php +++ b/core/modules/field/src/Tests/FieldStorageCrudTest.php @@ -42,7 +42,7 @@ function testCreate() { 'type' => 'test_field', ); field_test_memorize(); - $field_storage = entity_create('field_storage_config', $field_storage_definition); + $field_storage = FieldStorageConfig::create($field_storage_definition); $field_storage->save(); $field_storage = FieldStorageConfig::load($field_storage->id()); @@ -81,7 +81,7 @@ function testCreate() { // Guarantee that the name is unique. try { - entity_create('field_storage_config', $field_storage_definition)->save(); + FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create two fields with the same name.')); } catch (EntityStorageException $e) { @@ -94,7 +94,7 @@ function testCreate() { 'field_name' => 'field_1', 'entity_type' => 'entity_type', ); - entity_create('field_storage_config', $field_storage_definition)->save(); + FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field with no type.')); } catch (FieldException $e) { @@ -107,7 +107,7 @@ function testCreate() { 'type' => 'test_field', 'entity_type' => 'entity_test', ); - entity_create('field_storage_config', $field_storage_definition)->save(); + FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create an unnamed field.')); } catch (FieldException $e) { @@ -119,7 +119,7 @@ function testCreate() { 'field_name' => 'test_field', 'type' => 'test_field' ); - entity_create('field_storage_config', $field_storage_definition)->save(); + FieldStorageConfig::create($field_storage_definition)->save(); $this->fail('Cannot create a field without an entity type.'); } catch (FieldException $e) { @@ -133,7 +133,7 @@ function testCreate() { 'entity_type' => 'entity_test', 'type' => 'test_field', ); - entity_create('field_storage_config', $field_storage_definition)->save(); + FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field with a name starting with a digit.')); } catch (FieldException $e) { @@ -147,7 +147,7 @@ function testCreate() { 'entity_type' => 'entity_test', 'type' => 'test_field', ); - entity_create('field_storage_config', $field_storage_definition)->save(); + FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field with a name containing an illegal character.')); } catch (FieldException $e) { @@ -161,7 +161,7 @@ function testCreate() { 'entity_type' => 'entity_test', 'type' => 'test_field', ); - entity_create('field_storage_config', $field_storage_definition)->save(); + FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field with a name longer than 32 characters.')); } catch (FieldException $e) { @@ -176,7 +176,7 @@ function testCreate() { 'field_name' => 'id', 'entity_type' => 'entity_test', ); - entity_create('field_storage_config', $field_storage_definition)->save(); + FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field bearing the name of an entity key.')); } catch (FieldException $e) { @@ -194,7 +194,7 @@ function testCreateWithExplicitSchema() { $schema = array( 'dummy' => 'foobar' ); - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_2', 'entity_type' => 'entity_test', 'type' => 'test_field', @@ -212,7 +212,7 @@ function testRead() { 'entity_type' => 'entity_test', 'type' => 'test_field', ); - $field_storage = entity_create('field_storage_config', $field_storage_definition); + $field_storage = FieldStorageConfig::create($field_storage_definition); $field_storage->save(); $id = $field_storage->id(); @@ -240,7 +240,7 @@ function testRead() { */ function testIndexes() { // Check that indexes specified by the field type are used by default. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_1', 'entity_type' => 'entity_test', 'type' => 'test_field', @@ -253,7 +253,7 @@ function testIndexes() { // Check that indexes specified by the field definition override the field // type indexes. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_2', 'entity_type' => 'entity_test', 'type' => 'test_field', @@ -269,7 +269,7 @@ function testIndexes() { // Check that indexes specified by the field definition add to the field // type indexes. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_3', 'entity_type' => 'entity_test', 'type' => 'test_field', @@ -297,13 +297,13 @@ function testDelete() { 'type' => 'test_field', 'entity_type' => 'entity_test', ); - entity_create('field_storage_config', $field_storage_definition)->save(); + FieldStorageConfig::create($field_storage_definition)->save(); $another_field_storage_definition = array( 'field_name' => 'field_2', 'type' => 'test_field', 'entity_type' => 'entity_test', ); - entity_create('field_storage_config', $another_field_storage_definition)->save(); + FieldStorageConfig::create($another_field_storage_definition)->save(); // Create fields for each. $field_definition = array( @@ -347,7 +347,7 @@ function testDelete() { // Try to create a new field the same name as a deleted field and // write data into it. - entity_create('field_storage_config', $field_storage_definition)->save(); + FieldStorageConfig::create($field_storage_definition)->save(); entity_create('field_config', $field_definition)->save(); $field_storage = FieldStorageConfig::load('entity_test.' . $field_storage_definition['field_name']); $this->assertTrue(!empty($field_storage) && !$field_storage->isDeleted(), 'A new storage with a previously used name is created.'); @@ -368,7 +368,7 @@ function testDelete() { } function testUpdateFieldType() { - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_type', 'entity_type' => 'entity_test', 'type' => 'decimal', @@ -393,7 +393,7 @@ function testUpdate() { // respected. Since cardinality enforcement is consistent across database // systems, it makes a good test case. $cardinality = 4; - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_update', 'entity_type' => 'entity_test', 'type' => 'test_field', @@ -431,7 +431,7 @@ function testUpdate() { * Test field type modules forbidding an update. */ function testUpdateForbid() { - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'forbidden', 'entity_type' => 'entity_test', 'type' => 'test_field', diff --git a/core/modules/field/src/Tests/FieldUnitTestBase.php b/core/modules/field/src/Tests/FieldUnitTestBase.php index ddcf3f936753b84cabb99a8a23371aeccabb2c3d..c8a62c8a5d360a3d70a19ef4ace53c0a6a46e43d 100644 --- a/core/modules/field/src/Tests/FieldUnitTestBase.php +++ b/core/modules/field/src/Tests/FieldUnitTestBase.php @@ -11,6 +11,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\KernelTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Parent class for Field API unit tests. @@ -91,7 +92,7 @@ protected function createFieldWithStorage($suffix = '', $entity_type = 'entity_t $field_definition = 'field_definition' . $suffix; $this->fieldTestData->$field_name = Unicode::strtolower($this->randomMachineName() . '_field_name' . $suffix); - $this->fieldTestData->$field_storage = entity_create('field_storage_config', array( + $this->fieldTestData->$field_storage = FieldStorageConfig::create(array( 'field_name' => $this->fieldTestData->$field_name, 'entity_type' => $entity_type, 'type' => 'test_field', diff --git a/core/modules/field/src/Tests/FormTest.php b/core/modules/field/src/Tests/FormTest.php index dbdc71a4f7636c5f5a386b7d3580df5238a3d379..c7d305bed7143faa0808bdff1484676c5e771936 100644 --- a/core/modules/field/src/Tests/FormTest.php +++ b/core/modules/field/src/Tests/FormTest.php @@ -99,7 +99,7 @@ function testFieldFormSingle() { $field_storage = $this->fieldStorageSingle; $field_name = $field_storage['field_name']; $this->field['field_name'] = $field_name; - entity_create('field_storage_config', $field_storage)->save(); + FieldStorageConfig::create($field_storage)->save(); entity_create('field_config', $this->field)->save(); entity_get_form_display($this->field['entity_type'], $this->field['bundle'], 'default') ->setComponent($field_name) @@ -175,7 +175,7 @@ function testFieldFormDefaultValue() { $this->field['field_name'] = $field_name; $default = rand(1, 127); $this->field['default_value'] = array(array('value' => $default)); - entity_create('field_storage_config', $field_storage)->save(); + FieldStorageConfig::create($field_storage)->save(); entity_create('field_config', $this->field)->save(); entity_get_form_display($this->field['entity_type'], $this->field['bundle'], 'default') ->setComponent($field_name) @@ -203,7 +203,7 @@ function testFieldFormSingleRequired() { $field_name = $field_storage['field_name']; $this->field['field_name'] = $field_name; $this->field['required'] = TRUE; - entity_create('field_storage_config', $field_storage)->save(); + FieldStorageConfig::create($field_storage)->save(); entity_create('field_config', $this->field)->save(); entity_get_form_display($this->field['entity_type'], $this->field['bundle'], 'default') ->setComponent($field_name) @@ -239,7 +239,7 @@ function testFieldFormSingleRequired() { // $this->field = $this->field_multiple; // $field_name = $this->field['field_name']; // $this->instance['field_name'] = $field_name; -// entity_create('field_storage_config', $this->field)->save(); +// FieldStorageConfig::create($this->field)->save(); // entity_create('field_config', $this->instance)->save(); // } @@ -247,7 +247,7 @@ function testFieldFormUnlimited() { $field_storage = $this->fieldStorageUnlimited; $field_name = $field_storage['field_name']; $this->field['field_name'] = $field_name; - entity_create('field_storage_config', $field_storage)->save(); + FieldStorageConfig::create($field_storage)->save(); entity_create('field_config', $this->field)->save(); entity_get_form_display($this->field['entity_type'], $this->field['bundle'], 'default') ->setComponent($field_name) @@ -358,14 +358,14 @@ function testFieldFormMultivalueWithRequiredRadio() { $field_storage = $this->fieldStorageUnlimited; $field_name = $field_storage['field_name']; $this->field['field_name'] = $field_name; - entity_create('field_storage_config', $field_storage)->save(); + FieldStorageConfig::create($field_storage)->save(); entity_create('field_config', $this->field)->save(); entity_get_form_display($this->field['entity_type'], $this->field['bundle'], 'default') ->setComponent($field_name) ->save(); // Add a required radio field. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'required_radio_test', 'entity_type' => 'entity_test', 'type' => 'list_string', @@ -405,7 +405,7 @@ function testFieldFormJSAddMore() { $field_storage = $this->fieldStorageUnlimited; $field_name = $field_storage['field_name']; $this->field['field_name'] = $field_name; - entity_create('field_storage_config', $field_storage)->save(); + FieldStorageConfig::create($field_storage)->save(); entity_create('field_config', $this->field)->save(); entity_get_form_display($this->field['entity_type'], $this->field['bundle'], 'default') ->setComponent($field_name) @@ -466,7 +466,7 @@ function testFieldFormMultipleWidget() { $field_storage = $this->fieldStorageMultiple; $field_name = $field_storage['field_name']; $this->field['field_name'] = $field_name; - entity_create('field_storage_config', $field_storage)->save(); + FieldStorageConfig::create($field_storage)->save(); entity_create('field_config', $this->field)->save(); entity_get_form_display($this->field['entity_type'], $this->field['bundle'], 'default') ->setComponent($field_name, array( @@ -515,7 +515,7 @@ function testFieldFormAccess() { $field['field_name'] = $field_name; $field['entity_type'] = $entity_type; $field['bundle'] = $entity_type; - entity_create('field_storage_config', $field_storage)->save(); + FieldStorageConfig::create($field_storage)->save(); entity_create('field_config', $field)->save(); entity_get_form_display($entity_type, $entity_type, 'default') ->setComponent($field_name) @@ -535,7 +535,7 @@ function testFieldFormAccess() { 'bundle' => $entity_type, 'default_value' => array(0 => array('value' => 99)), ); - entity_create('field_storage_config', $field_storage_no_access)->save(); + FieldStorageConfig::create($field_storage_no_access)->save(); entity_create('field_config', $field_no_access)->save(); entity_get_form_display($field_no_access['entity_type'], $field_no_access['bundle'], 'default') ->setComponent($field_name_no_access) @@ -600,7 +600,7 @@ function testHiddenField() { $this->field['default_value'] = array(0 => array('value' => 99)); $this->field['entity_type'] = $entity_type; $this->field['bundle'] = $entity_type; - entity_create('field_storage_config', $field_storage)->save(); + FieldStorageConfig::create($field_storage)->save(); $this->field = entity_create('field_config', $this->field); $this->field->save(); // We explicitly do not assign a widget in a form display, so the field diff --git a/core/modules/field/src/Tests/NestedFormTest.php b/core/modules/field/src/Tests/NestedFormTest.php index 5067b976f59e5f176532270cd098e4f9a65cfb25..cc21fabd98f1c374d523244bab33f79a0cc60588 100644 --- a/core/modules/field/src/Tests/NestedFormTest.php +++ b/core/modules/field/src/Tests/NestedFormTest.php @@ -7,6 +7,7 @@ namespace Drupal\field\Tests; use Drupal\Core\Field\FieldStorageDefinitionInterface; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests field elements in nested forms. @@ -57,8 +58,8 @@ protected function setUp() { */ function testNestedFieldForm() { // Add two fields on the 'entity_test' - entity_create('field_storage_config', $this->fieldStorageSingle)->save(); - entity_create('field_storage_config', $this->fieldStorageUnlimited)->save(); + FieldStorageConfig::create($this->fieldStorageSingle)->save(); + FieldStorageConfig::create($this->fieldStorageUnlimited)->save(); $this->field['field_name'] = 'field_single'; $this->field['label'] = 'Single field'; entity_create('field_config', $this->field)->save(); diff --git a/core/modules/field/src/Tests/Number/NumberFieldTest.php b/core/modules/field/src/Tests/Number/NumberFieldTest.php index 953717024295c943076e4907e5220af44ececd4d..1e75068fec8d0026371f14c8b5468aec7281e7bd 100644 --- a/core/modules/field/src/Tests/Number/NumberFieldTest.php +++ b/core/modules/field/src/Tests/Number/NumberFieldTest.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\Unicode; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the creation of numeric fields. @@ -43,7 +44,7 @@ protected function setUp() { function testNumberDecimalField() { // Create a field with settings to validate. $field_name = Unicode::strtolower($this->randomMachineName()); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'decimal', @@ -133,7 +134,7 @@ function testNumberIntegerField() { // Create a field with settings to validate. $field_name = Unicode::strtolower($this->randomMachineName()); - $storage = entity_create('field_storage_config', array( + $storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'integer', @@ -276,7 +277,7 @@ function testNumberIntegerField() { function testNumberFloatField() { // Create a field with settings to validate. $field_name = Unicode::strtolower($this->randomMachineName()); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'float', @@ -377,13 +378,13 @@ function testNumberFormatter() { // Create a content type containing float and integer fields. $this->drupalCreateContentType(array('type' => $type)); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $float_field, 'entity_type' => 'node', 'type' => 'float', ))->save(); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $integer_field, 'entity_type' => 'node', 'type' => 'integer', @@ -501,7 +502,7 @@ function testNumberFormatter() { function testCreateNumberFloatField() { // Create a float field. $field_name = Unicode::strtolower($this->randomMachineName()); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'float', @@ -526,7 +527,7 @@ function testCreateNumberFloatField() { function testCreateNumberDecimalField() { // Create a decimal field. $field_name = Unicode::strtolower($this->randomMachineName()); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'decimal', diff --git a/core/modules/field/src/Tests/Number/NumberItemTest.php b/core/modules/field/src/Tests/Number/NumberItemTest.php index e7eac30d4ba14ae03de581121e900ed09b3a8e1c..0e8042866847924d0c2a58e42ed44220f0bdf44b 100644 --- a/core/modules/field/src/Tests/Number/NumberItemTest.php +++ b/core/modules/field/src/Tests/Number/NumberItemTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemListInterface; use Drupal\field\Tests\FieldUnitTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the new entity API for the number field type. @@ -30,7 +31,7 @@ protected function setUp() { // Create number field storages and fields for validation. foreach (array('integer', 'float', 'decimal') as $type) { - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'entity_type' => 'entity_test', 'field_name' => 'field_' . $type, 'type' => $type, diff --git a/core/modules/field/src/Tests/ShapeItemTest.php b/core/modules/field/src/Tests/ShapeItemTest.php index 9f7df3b43406ce9742d642844ee49e8e0ceb0411..0e20aabbd9c57af19850cd09181c8559fc7f434a 100644 --- a/core/modules/field/src/Tests/ShapeItemTest.php +++ b/core/modules/field/src/Tests/ShapeItemTest.php @@ -9,6 +9,7 @@ use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemListInterface; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the new entity API for the shape field type. @@ -35,7 +36,7 @@ protected function setUp() { parent::setUp(); // Create a 'shape' field and storage for validation. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $this->fieldName, 'entity_type' => 'entity_test', 'type' => 'shape', diff --git a/core/modules/field/src/Tests/String/StringFieldTest.php b/core/modules/field/src/Tests/String/StringFieldTest.php index 31144909fa0c559ad6c9f1031a363172c1bcaa03..cb8e26a2144c0002edbad169f32e0965ec4afc3a 100644 --- a/core/modules/field/src/Tests/String/StringFieldTest.php +++ b/core/modules/field/src/Tests/String/StringFieldTest.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\Unicode; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the creation of string fields. @@ -54,7 +55,7 @@ function testTextfieldWidgets() { function _testTextfieldWidgets($field_type, $widget_type) { // Create a field. $field_name = Unicode::strtolower($this->randomMachineName()); - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => $field_type diff --git a/core/modules/field/src/Tests/TestItemTest.php b/core/modules/field/src/Tests/TestItemTest.php index 7aa46791a820ddfa260f0f8fd7293f5d7ae9db9c..3743967a03c805de11764fc0f8896e9903268fa0 100644 --- a/core/modules/field/src/Tests/TestItemTest.php +++ b/core/modules/field/src/Tests/TestItemTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemListInterface; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the new entity API for the test field type. @@ -36,7 +37,7 @@ protected function setUp() { parent::setUp(); // Create a 'test_field' field and storage for validation. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $this->fieldName, 'entity_type' => 'entity_test', 'type' => 'test_field', diff --git a/core/modules/field/src/Tests/TestItemWithDependenciesTest.php b/core/modules/field/src/Tests/TestItemWithDependenciesTest.php index a3be92b215ffabfe2f6425288aff04aa98187b18..48adb751999efc9282b2919d70ea637957fd9c4c 100644 --- a/core/modules/field/src/Tests/TestItemWithDependenciesTest.php +++ b/core/modules/field/src/Tests/TestItemWithDependenciesTest.php @@ -7,6 +7,8 @@ namespace Drupal\field\Tests; +use Drupal\field\Entity\FieldStorageConfig; + /** * Tests the new entity API for the test field with dependencies type. * @@ -33,7 +35,7 @@ class TestItemWithDependenciesTest extends FieldUnitTestBase { */ public function testTestItemWithDepenencies() { // Create a 'test_field_with_dependencies' field and storage for validation. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $this->fieldName, 'entity_type' => 'entity_test', 'type' => 'test_field_with_dependencies', diff --git a/core/modules/field/src/Tests/TranslationTest.php b/core/modules/field/src/Tests/TranslationTest.php index 83289512f6bcfade7e2586eb0270ef5640f374af..9f3d698d0494e75eb5a042bcf3fb88c59c9350dd 100644 --- a/core/modules/field/src/Tests/TranslationTest.php +++ b/core/modules/field/src/Tests/TranslationTest.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\Unicode; use Drupal\language\Entity\ConfigurableLanguage; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests multilanguage fields logic. @@ -88,7 +89,7 @@ protected function setUp() { 'type' => 'test_field', 'cardinality' => 4, ); - $this->fieldStorage = entity_create('field_storage_config', $this->fieldStorageDefinition); + $this->fieldStorage = FieldStorageConfig::create($this->fieldStorageDefinition); $this->fieldStorage->save(); $this->fieldDefinition = array( @@ -144,7 +145,7 @@ function testTranslatableFieldSaveLoad() { $field_name_default = Unicode::strtolower($this->randomMachineName() . '_field_name'); $field_storage_definition = $this->fieldStorageDefinition; $field_storage_definition['field_name'] = $field_name_default; - $field_storage = entity_create('field_storage_config', $field_storage_definition); + $field_storage = FieldStorageConfig::create($field_storage_definition); $field_storage->save(); $field_definition = $this->fieldDefinition; diff --git a/core/modules/field/src/Tests/TranslationWebTest.php b/core/modules/field/src/Tests/TranslationWebTest.php index 8350285c152c564ae005e6a988f6c724418ce0e8..a24dda1d9136eb4366247119de533fdea7ab5d35 100644 --- a/core/modules/field/src/Tests/TranslationWebTest.php +++ b/core/modules/field/src/Tests/TranslationWebTest.php @@ -65,7 +65,7 @@ protected function setUp() { 'type' => 'test_field', 'cardinality' => 4, ); - entity_create('field_storage_config', $field_storage)->save(); + FieldStorageConfig::create($field_storage)->save(); $this->fieldStorage = FieldStorageConfig::load($this->entityTypeId . '.' . $this->fieldName); $field = array( diff --git a/core/modules/field/src/Tests/Views/FieldTestBase.php b/core/modules/field/src/Tests/Views/FieldTestBase.php index 0425c29edab70216cbbaabcf3791f99f80bd33a1..9019f03ae0beb45d481765cfaff021b519e68f2b 100644 --- a/core/modules/field/src/Tests/Views/FieldTestBase.php +++ b/core/modules/field/src/Tests/Views/FieldTestBase.php @@ -21,6 +21,7 @@ use Drupal\views\Tests\ViewTestBase; use Drupal\views\Tests\ViewTestData; +use Drupal\field\Entity\FieldStorageConfig; /** * Provides some helper methods for testing fieldapi integration into views. @@ -66,7 +67,7 @@ function setUpFieldStorages($amount = 3, $type = 'string') { $field_names = array(); for ($i = 0; $i < $amount; $i++) { $field_names[$i] = 'field_name_' . $i; - $this->fieldStorages[$i] = entity_create('field_storage_config', array( + $this->fieldStorages[$i] = FieldStorageConfig::create(array( 'field_name' => $field_names[$i], 'entity_type' => 'node', 'type' => $type, diff --git a/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php b/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php index f3be4294713b4d838afc0fccf390916af8c7bdbb..552484396224184bc1e63333775e88a58f43e384 100644 --- a/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php +++ b/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\views\ViewExecutable; use Drupal\views\Views; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the field itself of the Field integration. @@ -52,7 +53,7 @@ protected function setUp() { $this->setUpFieldStorages(3); // Setup a field with cardinality > 1. - $this->fieldStorages[3] = entity_create('field_storage_config', array( + $this->fieldStorages[3] = FieldStorageConfig::create(array( 'field_name' => 'field_name_3', 'entity_type' => 'node', 'type' => 'string', @@ -60,7 +61,7 @@ protected function setUp() { )); $this->fieldStorages[3]->save(); // Setup a field that will have no value. - $this->fieldStorages[4] = entity_create('field_storage_config', array( + $this->fieldStorages[4] = FieldStorageConfig::create(array( 'field_name' => 'field_name_4', 'entity_type' => 'node', 'type' => 'string', @@ -69,7 +70,7 @@ protected function setUp() { $this->fieldStorages[4]->save(); // Setup a text field. - $this->fieldStorages[5] = entity_create('field_storage_config', array( + $this->fieldStorages[5] = FieldStorageConfig::create(array( 'field_name' => 'field_name_5', 'entity_type' => 'node', 'type' => 'text', @@ -78,7 +79,7 @@ protected function setUp() { // Setup a text field with access control. // @see field_test_entity_field_access() - $this->fieldStorages[6] = entity_create('field_storage_config', array( + $this->fieldStorages[6] = FieldStorageConfig::create(array( 'field_name' => 'field_no_view_access', 'entity_type' => 'node', 'type' => 'text', diff --git a/core/modules/field/src/Tests/reEnableModuleFieldTest.php b/core/modules/field/src/Tests/reEnableModuleFieldTest.php index b339618675f527c770539cc8e9ff7414ee6b296a..9046350f315fbb8bfc104109ff05d5d705275452 100644 --- a/core/modules/field/src/Tests/reEnableModuleFieldTest.php +++ b/core/modules/field/src/Tests/reEnableModuleFieldTest.php @@ -8,6 +8,7 @@ namespace Drupal\field\Tests; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the behavior of a field module after being disabled and re-enabled. @@ -47,7 +48,7 @@ protected function setUp() { function testReEnabledField() { // Add a telephone field to the article content type. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_telephone', 'entity_type' => 'node', 'type' => 'telephone', diff --git a/core/modules/field/tests/modules/field_test/field_test.module b/core/modules/field/tests/modules/field_test/field_test.module index c86a7b9b74702570f4b36d4f727becb60e2b2874..058380a8d4ef95e4959a29a6689fec1e7981f8c3 100644 --- a/core/modules/field/tests/modules/field_test/field_test.module +++ b/core/modules/field/tests/modules/field_test/field_test.module @@ -2,6 +2,7 @@ use Drupal\field\FieldStorageConfigInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\field\Entity\FieldStorageConfig; /** * @file @@ -42,7 +43,7 @@ * field_test_memorize(); * * // call some Field API functions that invoke field_test hooks - * entity_create('field_storage_config', $field_definition)->save(); + * FieldStorageConfig::create($field_definition)->save(); * * // retrieve and reset the memorized hook call data * $mem = field_test_memorize(); diff --git a/core/modules/file/src/Tests/FileFieldTestBase.php b/core/modules/file/src/Tests/FileFieldTestBase.php index 5874cf5dba77e12076d10f4e13644d86eb6e942b..ae1507c422a6561370d2db5101f1af56cd993821 100644 --- a/core/modules/file/src/Tests/FileFieldTestBase.php +++ b/core/modules/file/src/Tests/FileFieldTestBase.php @@ -77,7 +77,7 @@ function getLastFileId() { * A list of widget settings that will be added to the widget defaults. */ function createFileField($name, $entity_type, $bundle, $storage_settings = array(), $field_settings = array(), $widget_settings = array()) { - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'entity_type' => $entity_type, 'field_name' => $name, 'type' => 'file', diff --git a/core/modules/file/src/Tests/FileItemTest.php b/core/modules/file/src/Tests/FileItemTest.php index 9337ca0d8cb16133ca2af2562f3b97a8cf792bc9..2279fa24423995ddb800ccb8bdae0511d0d48d51 100644 --- a/core/modules/file/src/Tests/FileItemTest.php +++ b/core/modules/file/src/Tests/FileItemTest.php @@ -12,6 +12,7 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\field\Entity\FieldConfig; use Drupal\field\Tests\FieldUnitTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests using entity fields of the file field type. @@ -47,7 +48,7 @@ protected function setUp() { $this->installEntitySchema('file'); $this->installSchema('file', array('file_usage')); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'file_test', 'entity_type' => 'entity_test', 'type' => 'file', diff --git a/core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php b/core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php index 8cdc9033d0889dbf037c454876002ec187c0e56e..0045f59a59fecf0cca1dcf8ccc42141ab3f890f7 100644 --- a/core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php +++ b/core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php @@ -10,6 +10,7 @@ use Drupal\views\Tests\ViewTestBase; use Drupal\views\Views; use Drupal\views\Tests\ViewTestData; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests file on user relationship handler. @@ -36,7 +37,7 @@ protected function setUp() { parent::setUp(); // Create the user profile field and instance. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'entity_type' => 'user', 'field_name' => 'user_file', 'type' => 'file', diff --git a/core/modules/hal/src/Tests/NormalizerTestBase.php b/core/modules/hal/src/Tests/NormalizerTestBase.php index 104a5e2e645ecd7df0ba4c6120948f396a0717e2..7aed3cfe139bb3a35728564685a5cb85c6073b84 100644 --- a/core/modules/hal/src/Tests/NormalizerTestBase.php +++ b/core/modules/hal/src/Tests/NormalizerTestBase.php @@ -22,6 +22,7 @@ use Drupal\serialization\EntityResolver\UuidResolver; use Drupal\simpletest\KernelTestBase; use Symfony\Component\Serializer\Serializer; +use Drupal\field\Entity\FieldStorageConfig; /** * Test the HAL normalizer. @@ -93,7 +94,7 @@ protected function setUp() { ))->save(); // Create the test text field. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'field_test_text', 'entity_type' => 'entity_test', 'type' => 'text', @@ -106,7 +107,7 @@ protected function setUp() { ))->save(); // Create the test translatable field. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'field_test_translatable_text', 'entity_type' => 'entity_test', 'type' => 'text', @@ -119,7 +120,7 @@ protected function setUp() { ))->save(); // Create the test entity reference field. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'field_test_entity_reference', 'entity_type' => 'entity_test', 'type' => 'entity_reference', diff --git a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php index ee47e3069890e4db8897f045fd9ac392f6cc22ae..30a22fe8539bf9ad3fc4f1026c874f2f8bed9648 100644 --- a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php +++ b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\Unicode; use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\file\Entity\File; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests setting up default images both to the field and field field. @@ -319,7 +320,7 @@ public function testDefaultImages() { * Tests image field and field having an invalid default image. */ public function testInvalidDefaultImage() { - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => Unicode::strtolower($this->randomMachineName()), 'entity_type' => 'node', 'type' => 'image', diff --git a/core/modules/image/src/Tests/ImageFieldTestBase.php b/core/modules/image/src/Tests/ImageFieldTestBase.php index 9984a76a7da5288a45c07dc9b0356ea767abc569..2b645dd18860c4fb28af41b8386c39b5002ff0e3 100644 --- a/core/modules/image/src/Tests/ImageFieldTestBase.php +++ b/core/modules/image/src/Tests/ImageFieldTestBase.php @@ -8,6 +8,7 @@ namespace Drupal\image\Tests; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * TODO: Test the following functions. @@ -71,7 +72,7 @@ protected function setUp() { * Formatter settings to be added to the formatter defaults. */ function createImageField($name, $type_name, $storage_settings = array(), $field_settings = array(), $widget_settings = array(), $formatter_settings = array()) { - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $name, 'entity_type' => 'node', 'type' => 'image', diff --git a/core/modules/image/src/Tests/ImageItemTest.php b/core/modules/image/src/Tests/ImageItemTest.php index fddbd3f05f11b9ecaed5cb0d0f8c092a8b3bc3ec..c5ee59461a678dd01fec79d433e423a24086478e 100644 --- a/core/modules/image/src/Tests/ImageItemTest.php +++ b/core/modules/image/src/Tests/ImageItemTest.php @@ -11,6 +11,7 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\field\Tests\FieldUnitTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests using entity fields of the image field type. @@ -44,7 +45,7 @@ protected function setUp() { $this->installEntitySchema('file'); $this->installSchema('file', array('file_usage')); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'entity_type' => 'entity_test', 'field_name' => 'image_test', 'type' => 'image', diff --git a/core/modules/image/src/Tests/ImageThemeFunctionTest.php b/core/modules/image/src/Tests/ImageThemeFunctionTest.php index 44f649ef679f732e83ea4bdee90a1a6bd75dba05..d64899bae53cf01df623a7d3e1bb4764e94184f6 100644 --- a/core/modules/image/src/Tests/ImageThemeFunctionTest.php +++ b/core/modules/image/src/Tests/ImageThemeFunctionTest.php @@ -11,6 +11,7 @@ use Drupal\Core\Url; use Drupal\image\Entity\ImageStyle; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests image theme functions. @@ -41,7 +42,7 @@ class ImageThemeFunctionTest extends WebTestBase { protected function setUp() { parent::setUp(); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'entity_type' => 'entity_test', 'field_name' => 'image_test', 'type' => 'image', diff --git a/core/modules/image/src/Tests/Views/RelationshipUserImageDataTest.php b/core/modules/image/src/Tests/Views/RelationshipUserImageDataTest.php index 4ef06269ecfeb93e221e02fe94aedab6f4eae7d7..3df5e1f93f55bd463edfa651deeac944faead91f 100644 --- a/core/modules/image/src/Tests/Views/RelationshipUserImageDataTest.php +++ b/core/modules/image/src/Tests/Views/RelationshipUserImageDataTest.php @@ -10,6 +10,7 @@ use Drupal\views\Tests\ViewTestBase; use Drupal\views\Views; use Drupal\views\Tests\ViewTestData; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests image on user relationship handler. @@ -36,7 +37,7 @@ protected function setUp() { parent::setUp(); // Create the user profile field and instance. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'entity_type' => 'user', 'field_name' => 'user_picture', 'type' => 'image', diff --git a/core/modules/link/src/Tests/LinkFieldTest.php b/core/modules/link/src/Tests/LinkFieldTest.php index 79c2cbba5856550f342d6eeabfbbc65143456fa2..c2256868955214fa5695fc8bfecec2e4ac69945b 100644 --- a/core/modules/link/src/Tests/LinkFieldTest.php +++ b/core/modules/link/src/Tests/LinkFieldTest.php @@ -12,6 +12,7 @@ use Drupal\Core\Url; use Drupal\link\LinkItemInterface; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests link field widgets and formatters. @@ -57,7 +58,7 @@ protected function setUp() { function testURLValidation() { $field_name = Unicode::strtolower($this->randomMachineName()); // Create a field with settings to validate. - $this->fieldStorage = entity_create('field_storage_config', array( + $this->fieldStorage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'link', @@ -222,7 +223,7 @@ protected function assertInvalidEntries($field_name, array $invalid_entries) { function testLinkTitle() { $field_name = Unicode::strtolower($this->randomMachineName()); // Create a field with settings to validate. - $this->fieldStorage = entity_create('field_storage_config', array( + $this->fieldStorage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'link', @@ -336,7 +337,7 @@ function testLinkTitle() { function testLinkFormatter() { $field_name = Unicode::strtolower($this->randomMachineName()); // Create a field with settings to validate. - $this->fieldStorage = entity_create('field_storage_config', array( + $this->fieldStorage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'link', @@ -476,7 +477,7 @@ function testLinkFormatter() { function testLinkSeparateFormatter() { $field_name = Unicode::strtolower($this->randomMachineName()); // Create a field with settings to validate. - $this->fieldStorage = entity_create('field_storage_config', array( + $this->fieldStorage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'link', diff --git a/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php b/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php index 84ffbe2e8646e61c4cd45cdaa66732e776bfc1c5..496994b2a9069abc9782c7529f1d109e999366b2 100644 --- a/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php +++ b/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php @@ -7,6 +7,7 @@ namespace Drupal\node\Tests; use Drupal\Component\Utility\Unicode; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the persistence of basic options through multiple steps. @@ -32,7 +33,7 @@ function testMultiStepNodeFormBasicOptions() { // Create an unlimited cardinality field. $this->fieldName = Unicode::strtolower($this->randomMachineName()); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $this->fieldName, 'entity_type' => 'node', 'type' => 'text', diff --git a/core/modules/node/src/Tests/NodeAccessFieldTest.php b/core/modules/node/src/Tests/NodeAccessFieldTest.php index ab490bbe96dc185fb3e4427e906a16d6116311ec..02ef26f6a5db99de161c89f3390c418434b87fa0 100644 --- a/core/modules/node/src/Tests/NodeAccessFieldTest.php +++ b/core/modules/node/src/Tests/NodeAccessFieldTest.php @@ -7,6 +7,7 @@ namespace Drupal\node\Tests; use Drupal\Component\Utility\Unicode; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the interaction of the node access system with fields. @@ -54,7 +55,7 @@ protected function setUp() { // Add a custom field to the page content type. $this->fieldName = Unicode::strtolower($this->randomMachineName() . '_field_name'); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $this->fieldName, 'entity_type' => 'node', 'type' => 'text' diff --git a/core/modules/node/src/Tests/NodeAccessLanguageAwareCombinationTest.php b/core/modules/node/src/Tests/NodeAccessLanguageAwareCombinationTest.php index 3051af1d48f405274fcec4dd47e4519bb03dd0a0..25cba8801a47b878ad7def64a47819d77d77af46 100644 --- a/core/modules/node/src/Tests/NodeAccessLanguageAwareCombinationTest.php +++ b/core/modules/node/src/Tests/NodeAccessLanguageAwareCombinationTest.php @@ -11,6 +11,7 @@ use Drupal\language\Entity\ConfigurableLanguage; use Drupal\node\Entity\NodeType; use Drupal\user\Entity\User; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests node access functionality with multiple languages and two node access @@ -55,7 +56,7 @@ protected function setUp() { // Create the 'private' field, which allows the node to be marked as private // (restricted access) in a given translation. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_private', 'entity_type' => 'node', 'type' => 'boolean', diff --git a/core/modules/node/src/Tests/NodeAccessLanguageAwareTest.php b/core/modules/node/src/Tests/NodeAccessLanguageAwareTest.php index 57707463da354a64f7ab2c037da346f1894641f9..a72f62bfcb5abc722786dc4eb6633ebf1631d5c1 100644 --- a/core/modules/node/src/Tests/NodeAccessLanguageAwareTest.php +++ b/core/modules/node/src/Tests/NodeAccessLanguageAwareTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Language\LanguageInterface; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\user\Entity\User; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests node_access and db_select() with node_access tag functionality with @@ -52,7 +53,7 @@ protected function setUp() { // Create the 'private' field, which allows the node to be marked as private // (restricted access) in a given translation. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'field_private', 'entity_type' => 'node', 'type' => 'boolean', diff --git a/core/modules/options/src/Tests/OptionsDynamicValuesTestBase.php b/core/modules/options/src/Tests/OptionsDynamicValuesTestBase.php index 0bc99f0abfdfd27fd1ce61cdb3302d216b67064d..16451d5f2b8271d46e4279a2e14040ac25f8edb2 100644 --- a/core/modules/options/src/Tests/OptionsDynamicValuesTestBase.php +++ b/core/modules/options/src/Tests/OptionsDynamicValuesTestBase.php @@ -8,6 +8,7 @@ namespace Drupal\options\Tests; use Drupal\field\Tests\FieldTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Base class for testing allowed values of options fields. @@ -39,7 +40,7 @@ protected function setUp() { parent::setUp(); $field_name = 'test_options'; - $this->fieldStorage = entity_create('field_storage_config', [ + $this->fieldStorage = FieldStorageConfig::create([ 'field_name' => $field_name, 'entity_type' => 'entity_test_rev', 'type' => 'list_string', diff --git a/core/modules/options/src/Tests/OptionsFieldTest.php b/core/modules/options/src/Tests/OptionsFieldTest.php index a7d3ffe57cefd965d30b4fe5e2aa3c3da76b8945..fdf1f6d69be5a019d395a87e21cc344dc99651ab 100644 --- a/core/modules/options/src/Tests/OptionsFieldTest.php +++ b/core/modules/options/src/Tests/OptionsFieldTest.php @@ -8,6 +8,7 @@ namespace Drupal\options\Tests; use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests for the 'Options' field types. @@ -75,7 +76,7 @@ function testUpdateAllowedValues() { // Options are reset when a new field with the same name is created. $this->fieldStorage->delete(); - entity_create('field_storage_config', $this->fieldStorageDefinition)->save(); + FieldStorageConfig::create($this->fieldStorageDefinition)->save(); entity_create('field_config', array( 'field_name' => $this->fieldName, 'entity_type' => 'entity_test', diff --git a/core/modules/options/src/Tests/OptionsFieldUITest.php b/core/modules/options/src/Tests/OptionsFieldUITest.php index d4219c6e3ca39efc009e9a925f842f5c934f981e..48a5b9a5e818fc0173d34964e7e924f6f8fa0dfa 100644 --- a/core/modules/options/src/Tests/OptionsFieldUITest.php +++ b/core/modules/options/src/Tests/OptionsFieldUITest.php @@ -267,7 +267,7 @@ function testOptionsTrimmedValuesText() { */ protected function createOptionsField($type) { // Create a field. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $this->fieldName, 'entity_type' => 'node', 'type' => $type, diff --git a/core/modules/options/src/Tests/OptionsFieldUnitTestBase.php b/core/modules/options/src/Tests/OptionsFieldUnitTestBase.php index fcfe4f8acd2e6b40710f8ebe7fd66243ee6b9b03..8349384260ee3d77c86eb41ea6476bdddd7c3b42 100644 --- a/core/modules/options/src/Tests/OptionsFieldUnitTestBase.php +++ b/core/modules/options/src/Tests/OptionsFieldUnitTestBase.php @@ -9,6 +9,7 @@ namespace Drupal\options\Tests; use Drupal\field\Tests\FieldUnitTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Base class for Options module integration tests. @@ -66,7 +67,7 @@ protected function setUp() { 'allowed_values' => array(1 => 'One', 2 => 'Two', 3 => 'Three'), ), ); - $this->fieldStorage = entity_create('field_storage_config', $this->fieldStorageDefinition); + $this->fieldStorage = FieldStorageConfig::create($this->fieldStorageDefinition); $this->fieldStorage->save(); $this->field = entity_create('field_config', array( diff --git a/core/modules/options/src/Tests/OptionsWidgetsTest.php b/core/modules/options/src/Tests/OptionsWidgetsTest.php index 93293cac3873873367f2b610c3d066e2da52e048..d1624428eab7c6f0f92d73110175ac1c953f7ce3 100644 --- a/core/modules/options/src/Tests/OptionsWidgetsTest.php +++ b/core/modules/options/src/Tests/OptionsWidgetsTest.php @@ -8,6 +8,7 @@ namespace Drupal\options\Tests; use Drupal\field\Tests\FieldTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the Options widgets. @@ -42,7 +43,7 @@ protected function setUp() { parent::setUp(); // Field storage with cardinality 1. - $this->card1 = entity_create('field_storage_config', [ + $this->card1 = FieldStorageConfig::create([ 'field_name' => 'card_1', 'entity_type' => 'entity_test', 'type' => 'list_integer', @@ -62,7 +63,7 @@ protected function setUp() { $this->card1->save(); // Field storage with cardinality 2. - $this->card2 = entity_create('field_storage_config', [ + $this->card2 = FieldStorageConfig::create([ 'field_name' => 'card_2', 'entity_type' => 'entity_test', 'type' => 'list_integer', diff --git a/core/modules/options/src/Tests/Views/ViewsDataTest.php b/core/modules/options/src/Tests/Views/ViewsDataTest.php index f743f4ca1615ed384166906c1ff5a478fb99d45a..eb814962cccb6848bbe448c906e9757e2666482b 100644 --- a/core/modules/options/src/Tests/Views/ViewsDataTest.php +++ b/core/modules/options/src/Tests/Views/ViewsDataTest.php @@ -6,6 +6,8 @@ namespace Drupal\options\Tests\Views; +use Drupal\field\Entity\FieldStorageConfig; + /** * Test to ensure views data is properly created for the Options module. * @@ -32,7 +34,7 @@ protected function setUp() { parent::setUp(); $field_name = 'test_options'; - $this->fieldStorage = entity_create('field_storage_config', [ + $this->fieldStorage = FieldStorageConfig::create([ 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'list_string', diff --git a/core/modules/quickedit/src/Tests/QuickEditTestBase.php b/core/modules/quickedit/src/Tests/QuickEditTestBase.php index eb779ad0380d33091132d626c7505cc98a3ba14c..1b75bd368e2ae5d30666a9d8fc8439ece02849b5 100644 --- a/core/modules/quickedit/src/Tests/QuickEditTestBase.php +++ b/core/modules/quickedit/src/Tests/QuickEditTestBase.php @@ -8,6 +8,7 @@ namespace Drupal\quickedit\Tests; use Drupal\simpletest\KernelTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Base class for testing Quick Edit functionality. @@ -70,7 +71,7 @@ protected function setUp() { */ protected function createFieldWithStorage($field_name, $type, $cardinality, $label, $field_settings, $widget_type, $widget_settings, $formatter_type, $formatter_settings) { $field_storage = $field_name . '_field_storage'; - $this->fields->$field_storage = entity_create('field_storage_config', array( + $this->fields->$field_storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => $type, diff --git a/core/modules/rdf/src/Tests/Field/FieldRdfaTestBase.php b/core/modules/rdf/src/Tests/Field/FieldRdfaTestBase.php index cb8f58496def25ad00b4c65f2fcaa0a7697ca654..2696d178a35eb6b89bbeb2fe8e8d7fac28f3d774 100644 --- a/core/modules/rdf/src/Tests/Field/FieldRdfaTestBase.php +++ b/core/modules/rdf/src/Tests/Field/FieldRdfaTestBase.php @@ -7,6 +7,7 @@ namespace Drupal\rdf\Tests\Field; use Drupal\field\Tests\FieldUnitTestBase; +use Drupal\field\Entity\FieldStorageConfig; abstract class FieldRdfaTestBase extends FieldUnitTestBase { @@ -114,7 +115,7 @@ protected function assertFormatterRdfa($formatter, $property, $expected_rdf_valu * (optional) An array of field settings. */ protected function createTestField($field_settings = array()) { - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $this->fieldName, 'entity_type' => 'entity_test', 'type' => $this->fieldType, diff --git a/core/modules/serialization/src/Tests/EntityResolverTest.php b/core/modules/serialization/src/Tests/EntityResolverTest.php index e362b8d24e7eeaee63f0c2b4e88fc16c48a32166..6bc9fb8360680aa5465085bf09303f31b7c1bfd3 100644 --- a/core/modules/serialization/src/Tests/EntityResolverTest.php +++ b/core/modules/serialization/src/Tests/EntityResolverTest.php @@ -8,6 +8,7 @@ use Drupal\Core\Url; use Drupal\entity_test\Entity\EntityTestMulRev; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests that entities references can be resolved. @@ -36,7 +37,7 @@ protected function setUp() { \Drupal::service('router.builder')->rebuild(); // Create the test field storage. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'entity_type' => 'entity_test_mulrev', 'field_name' => 'field_test_entity_reference', 'type' => 'entity_reference', diff --git a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php index 2187cccb3917f5bfde52e46c43dadbde9405984d..1c2ae55f9e9bb5764ab59c02750a6c57727255f6 100644 --- a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php +++ b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php @@ -9,6 +9,7 @@ use Drupal\Core\Database\Database; use Drupal\simpletest\KernelTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests KernelTestBase functionality. @@ -277,7 +278,7 @@ function testEnableModulesFixedList() { 'bundle' => 'entity_test', 'mode' => 'default', )); - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'test_field', 'entity_type' => 'entity_test', 'type' => 'test_field' diff --git a/core/modules/system/src/Tests/Ajax/MultiFormTest.php b/core/modules/system/src/Tests/Ajax/MultiFormTest.php index f87100de1037ca040c4cfc3fb355b41012346f1d..c9bfa1e4cebfb1094a4379c73c4b0252e8222464 100644 --- a/core/modules/system/src/Tests/Ajax/MultiFormTest.php +++ b/core/modules/system/src/Tests/Ajax/MultiFormTest.php @@ -8,6 +8,7 @@ namespace Drupal\system\Tests\Ajax; use Drupal\Core\Field\FieldStorageDefinitionInterface; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests that AJAX-enabled forms work when multiple instances of the same form @@ -31,7 +32,7 @@ protected function setUp() { // Create a multi-valued field for 'page' nodes to use for Ajax testing. $field_name = 'field_ajax_test'; - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'entity_type' => 'node', 'field_name' => $field_name, 'type' => 'text', diff --git a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php index dd35bbdef5c54f6c2b46ef026b28aab77c6e2dd5..07d82ac73a0b3dd4fba6be3e87e14706c85c6b8a 100644 --- a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php @@ -73,7 +73,7 @@ protected function setUp() { if ($this->entity->getEntityType()->get('field_ui_base_route')) { // Add field, so we can modify the field storage and field entities to // verify that changes to those indeed clear cache tags. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'configurable_field', 'entity_type' => $this->entity->getEntityTypeId(), 'type' => 'test_field', @@ -246,7 +246,7 @@ protected function createReferenceTestEntities($referenced_entity) { // Add a field of the given type to the given entity type's "foo" bundle. $field_name = $referenced_entity->getEntityTypeId() . '_reference'; - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => $entity_type, 'type' => 'entity_reference', diff --git a/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php b/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php index 61a5ad2c9603d761290e1d4bfd1f80e6cdf38925..33a084553a3a891d596645bf106645ec14103eed 100644 --- a/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php @@ -10,6 +10,7 @@ use Drupal\Component\Utility\Unicode; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; /** * Base class for language-aware entity tests. @@ -75,7 +76,7 @@ protected function setUp() { // Create field fields in all entity variations. foreach (entity_test_entity_types() as $entity_type) { - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $this->fieldName, 'entity_type' => $entity_type, 'type' => 'text', @@ -89,7 +90,7 @@ protected function setUp() { ))->save(); $this->field[$entity_type] = FieldConfig::load($entity_type . '.' . $entity_type . '.' . $this->fieldName); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $this->untranslatableFieldName, 'entity_type' => $entity_type, 'type' => 'text', diff --git a/core/modules/system/src/Tests/Entity/EntityQueryAggregateTest.php b/core/modules/system/src/Tests/Entity/EntityQueryAggregateTest.php index a3262eaba3d3a2edd5f456a76b0f44eb7176a420..77b7c7e6544a1bb5e20aa719857a0cb938c585f5 100644 --- a/core/modules/system/src/Tests/Entity/EntityQueryAggregateTest.php +++ b/core/modules/system/src/Tests/Entity/EntityQueryAggregateTest.php @@ -6,6 +6,8 @@ */ namespace Drupal\system\Tests\Entity; +use Drupal\field\Entity\FieldStorageConfig; + /** * Tests the Entity Query Aggregation API. * @@ -51,7 +53,7 @@ protected function setUp() { // Add some fieldapi fields to be used in the test. for ($i = 1; $i <= 2; $i++) { $field_name = 'field_test_' . $i; - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'integer', diff --git a/core/modules/system/src/Tests/Entity/EntityQueryTest.php b/core/modules/system/src/Tests/Entity/EntityQueryTest.php index 932e5fb8d8ba80d559c56c4d9910ce4d6dee3cb9..0d4b641ad8690658b38b379b9fe90fd086f12732 100644 --- a/core/modules/system/src/Tests/Entity/EntityQueryTest.php +++ b/core/modules/system/src/Tests/Entity/EntityQueryTest.php @@ -71,7 +71,7 @@ protected function setUp() { $figures = Unicode::strtolower($this->randomMachineName()); $greetings = Unicode::strtolower($this->randomMachineName()); foreach (array($figures => 'shape', $greetings => 'text') as $field_name => $field_type) { - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test_mulrev', 'type' => $field_type, @@ -458,7 +458,7 @@ public function testTableSort() { public function testCount() { // Create a field with the same name in a different entity type. $field_name = $this->figures; - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'shape', diff --git a/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php b/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php index 3d0d4d1037fb1fcdac48ee4dba2e3a203e4c25ed..80b56e5df6056a9f4c593c4e7eaff618946e4ff7 100644 --- a/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php +++ b/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php @@ -11,6 +11,7 @@ use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; use Drupal\system\Tests\Entity\EntityUnitTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests sorting referenced items. @@ -45,7 +46,7 @@ protected function setUp() { */ public function testSort() { // Add text field to entity, to sort by. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'field_text', 'entity_type' => 'node', 'type' => 'text', diff --git a/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php b/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php index 67b0e9490a355ca14fb44627b10105981a624d9f..582bf876e272228d76250885482d5cafe07ca01d 100644 --- a/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php +++ b/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php @@ -84,7 +84,7 @@ protected function setUp() { $this->fieldName = strtolower($this->randomMachineName()); $this->fieldCardinality = 4; - $this->fieldStorage = entity_create('field_storage_config', array( + $this->fieldStorage = FieldStorageConfig::create(array( 'field_name' => $this->fieldName, 'entity_type' => $entity_type, 'type' => 'test_field', @@ -282,7 +282,7 @@ function testLongNames() { $values = array(); for ($i = 0; $i < 2; $i++) { $field_names[$i] = $name_base . $i; - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $field_names[$i], 'entity_type' => $entity_type, 'type' => 'test_field', @@ -312,7 +312,7 @@ function testLongNames() { function testUpdateFieldSchemaWithData() { $entity_type = 'entity_test_rev'; // Create a decimal 5.2 field and add some data. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'decimal52', 'entity_type' => $entity_type, 'type' => 'decimal', @@ -347,7 +347,7 @@ function testUpdateFieldSchemaWithData() { */ function testFieldUpdateFailure() { // Create a text field. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'test_text', 'entity_type' => 'entity_test_rev', 'type' => 'text', @@ -387,7 +387,7 @@ function testFieldUpdateIndexesWithData() { // Create a decimal field. $field_name = 'testfield'; $entity_type = 'entity_test_rev'; - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => $entity_type, 'type' => 'text', @@ -443,7 +443,7 @@ function testFieldSqlStorageForeignKeys() { // field_test_field_schema()). $field_name = 'testfield'; $foreign_key_name = 'shape'; - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'shape', @@ -480,7 +480,7 @@ public function testTableNames() { // Short entity type and field name. $entity_type = 'short_entity_type'; $field_name = 'short_field_name'; - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'entity_type' => $entity_type, 'field_name' => $field_name, 'type' => 'test_field', @@ -493,7 +493,7 @@ public function testTableNames() { // Short entity type, long field name $entity_type = 'short_entity_type'; $field_name = 'long_field_name_abcdefghijklmnopqrstuvwxyz'; - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'entity_type' => $entity_type, 'field_name' => $field_name, 'type' => 'test_field', @@ -506,7 +506,7 @@ public function testTableNames() { // Long entity type, short field name $entity_type = 'long_entity_type_abcdefghijklmnopqrstuvwxyz'; $field_name = 'short_field_name'; - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'entity_type' => $entity_type, 'field_name' => $field_name, 'type' => 'test_field', @@ -519,7 +519,7 @@ public function testTableNames() { // Long entity type and field name. $entity_type = 'long_entity_type_abcdefghijklmnopqrstuvwxyz'; $field_name = 'long_field_name_abcdefghijklmnopqrstuvwxyz'; - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'entity_type' => $entity_type, 'field_name' => $field_name, 'type' => 'test_field', @@ -529,7 +529,7 @@ public function testTableNames() { $expected = 'long_entity_type_abcdefghijklmnopq_r__' . substr(hash('sha256', $field_storage->uuid()), 0, 10); $this->assertEqual($this->tableMapping->getDedicatedRevisionTableName($field_storage), $expected); // Try creating a second field and check there are no clashes. - $field_storage2 = entity_create('field_storage_config', array( + $field_storage2 = FieldStorageConfig::create(array( 'entity_type' => $entity_type, 'field_name' => $field_name . '2', 'type' => 'test_field', @@ -538,7 +538,7 @@ public function testTableNames() { $this->assertNotEqual($this->tableMapping->getDedicatedRevisionTableName($field_storage), $this->tableMapping->getDedicatedRevisionTableName($field_storage2)); // Deleted field. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'entity_type' => 'some_entity_type', 'field_name' => 'some_field_name', 'type' => 'test_field', diff --git a/core/modules/system/src/Tests/Form/ArbitraryRebuildTest.php b/core/modules/system/src/Tests/Form/ArbitraryRebuildTest.php index 09eba7b1b4236061b0084f856143043be0ebfc9f..da8d812c0fdda464fd83a3ad988e05ea5b1b3bab 100644 --- a/core/modules/system/src/Tests/Form/ArbitraryRebuildTest.php +++ b/core/modules/system/src/Tests/Form/ArbitraryRebuildTest.php @@ -8,6 +8,7 @@ namespace Drupal\system\Tests\Form; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests altering forms to be rebuilt so there are multiple steps. @@ -27,7 +28,7 @@ protected function setUp() { parent::setUp(); // Auto-create a field for testing. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'entity_type' => 'user', 'field_name' => 'test_multiple', 'type' => 'text', diff --git a/core/modules/system/src/Tests/Form/RebuildTest.php b/core/modules/system/src/Tests/Form/RebuildTest.php index 7674241aaba1f562d6bcfb051a5ba6cfd47078fb..161b1b70398edaf75966352bf7c0f5d2dfc8e6bd 100644 --- a/core/modules/system/src/Tests/Form/RebuildTest.php +++ b/core/modules/system/src/Tests/Form/RebuildTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Url; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests functionality of \Drupal\Core\Form\FormBuilderInterface::rebuildForm(). @@ -73,7 +74,7 @@ function testRebuildPreservesValues() { function testPreserveFormActionAfterAJAX() { // Create a multi-valued field for 'page' nodes to use for Ajax testing. $field_name = 'field_ajax_test'; - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'node', 'type' => 'text', diff --git a/core/modules/system/tests/modules/entity_test/entity_test.install b/core/modules/system/tests/modules/entity_test/entity_test.install index a9ff42331adfef258a12fdd34beb49d00799e287..b6369da8a0126299217062ea46945a705b2b73ac 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.install +++ b/core/modules/system/tests/modules/entity_test/entity_test.install @@ -6,6 +6,7 @@ */ use Drupal\system\Tests\Update\DbUpdatesTrait; +use Drupal\field\Entity\FieldStorageConfig; /** * Implements hook_install(). @@ -13,7 +14,7 @@ function entity_test_install() { foreach (entity_test_entity_types() as $entity_type) { // Auto-create fields for testing. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'entity_type' => $entity_type, 'field_name' => 'field_test_text', 'type' => 'text', diff --git a/core/modules/taxonomy/src/Tests/TaxonomyImageTest.php b/core/modules/taxonomy/src/Tests/TaxonomyImageTest.php index 550c5f53702e5d8d238c8e0b97d2c0d329c815b7..b4c9d788efc18b7356d1a0d8bd3c1a48535c1f0a 100644 --- a/core/modules/taxonomy/src/Tests/TaxonomyImageTest.php +++ b/core/modules/taxonomy/src/Tests/TaxonomyImageTest.php @@ -9,6 +9,7 @@ use Drupal\user\RoleInterface; use Drupal\file\Entity\File; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests access checks of private image fields. @@ -41,7 +42,7 @@ protected function setUp() { // Add a field to the vocabulary. $entity_type = 'taxonomy_term'; $name = 'field_test'; - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $name, 'entity_type' => $entity_type, 'type' => 'image', diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php index 5dec79626953326528e70a6fe49951e664af44be..446b2f053710708168d668e14012b0781ce20024 100644 --- a/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php +++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php @@ -12,6 +12,7 @@ use Drupal\views\Tests\ViewTestBase; use Drupal\views\Tests\ViewTestData; use Drupal\views\Views; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests taxonomy field filters with translations. @@ -68,7 +69,7 @@ function setUp() { $this->vocabulary->save(); // Add a translatable field to the vocabulary. - $field = entity_create('field_storage_config', array( + $field = FieldStorageConfig::create(array( 'field_name' => 'field_foo', 'entity_type' => 'taxonomy_term', 'type' => 'text', diff --git a/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php b/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php index 6596b8e2e45877af8e27e7cf2a20b5b98008ff29..cb967f0f43a3ac4299b100653474602ddcbc178a 100644 --- a/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php +++ b/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\Unicode; use Drupal\taxonomy\Entity\Vocabulary; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests loading, saving and deleting vocabularies. @@ -154,7 +155,7 @@ function testUninstallReinstall() { 'type' => 'text', 'cardinality' => 4 ); - entity_create('field_storage_config', $storage_definition)->save(); + FieldStorageConfig::create($storage_definition)->save(); $field_definition = array( 'field_name' => $field_name, 'entity_type' => 'taxonomy_term', @@ -178,7 +179,7 @@ function testUninstallReinstall() { // an instance of this field on the same bundle name should be successful. $this->vocabulary->enforceIsNew(); $this->vocabulary->save(); - entity_create('field_storage_config', $storage_definition)->save(); + FieldStorageConfig::create($storage_definition)->save(); entity_create('field_config', $field_definition)->save(); } } diff --git a/core/modules/telephone/src/Tests/TelephoneFieldTest.php b/core/modules/telephone/src/Tests/TelephoneFieldTest.php index 515d7e0d07f04ffe1a3e139e3e9fff10b705d36b..2942d1a9b691e5bcbaaf9b2ba2ce5b64b0cbfc29 100644 --- a/core/modules/telephone/src/Tests/TelephoneFieldTest.php +++ b/core/modules/telephone/src/Tests/TelephoneFieldTest.php @@ -8,6 +8,7 @@ namespace Drupal\telephone\Tests; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the creation of telephone fields. @@ -50,7 +51,7 @@ protected function setUp() { function testTelephoneField() { // Add the telephone field to the article content type. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'field_telephone', 'entity_type' => 'node', 'type' => 'telephone', diff --git a/core/modules/telephone/src/Tests/TelephoneItemTest.php b/core/modules/telephone/src/Tests/TelephoneItemTest.php index 42b7973f9bb2ffd14929195a8e7e9029a0b87f5c..d6b65494f4357e481d2bbca646abc7c16bafa8d8 100644 --- a/core/modules/telephone/src/Tests/TelephoneItemTest.php +++ b/core/modules/telephone/src/Tests/TelephoneItemTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemInterface; use Drupal\field\Tests\FieldUnitTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the new entity API for the telephone field type. @@ -29,7 +30,7 @@ protected function setUp() { parent::setUp(); // Create a telephone field storage and field for validation. - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'field_test', 'entity_type' => 'entity_test', 'type' => 'telephone', diff --git a/core/modules/text/src/Tests/Formatter/TextFormatterTest.php b/core/modules/text/src/Tests/Formatter/TextFormatterTest.php index 324f2cfeb27b5aee4ec37138ab8651d041fa427d..cd4a86c7e4718cc0f965b4f120017bd22c982ce8 100644 --- a/core/modules/text/src/Tests/Formatter/TextFormatterTest.php +++ b/core/modules/text/src/Tests/Formatter/TextFormatterTest.php @@ -9,6 +9,7 @@ use Drupal\filter\Entity\FilterFormat; use Drupal\system\Tests\Entity\EntityUnitTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the text formatters functionality. @@ -55,7 +56,7 @@ protected function setUp() { ), ))->save(); - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => 'formatted_text', 'entity_type' => $this->entityType, 'type' => 'text', diff --git a/core/modules/text/src/Tests/TextFieldTest.php b/core/modules/text/src/Tests/TextFieldTest.php index 8279a6ded7e414e66dcc034180814f5fabd4fc9e..cb46bea769ae4144db17f21bdc1036b211b47b3a 100644 --- a/core/modules/text/src/Tests/TextFieldTest.php +++ b/core/modules/text/src/Tests/TextFieldTest.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\Unicode; use Drupal\field\Tests\String\StringFieldTest; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the creation of text fields. @@ -39,7 +40,7 @@ function testTextFieldValidation() { // Create a field with settings to validate. $max_length = 3; $field_name = Unicode::strtolower($this->randomMachineName()); - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'text', @@ -73,7 +74,7 @@ function testTextFieldValidation() { function testRequiredLongTextWithFileUpload() { // Create a text field. $text_field_name = 'text_long'; - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $text_field_name, 'entity_type' => 'entity_test', 'type' => 'text_with_summary', @@ -88,7 +89,7 @@ function testRequiredLongTextWithFileUpload() { // Create a file field. $file_field_name = 'file_field'; - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $file_field_name, 'entity_type' => 'entity_test', 'type' => 'file' @@ -151,7 +152,7 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) { // Create a field. $field_name = Unicode::strtolower($this->randomMachineName()); - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => $field_type diff --git a/core/modules/text/src/Tests/TextWithSummaryItemTest.php b/core/modules/text/src/Tests/TextWithSummaryItemTest.php index e292ffd07cefc55dae220d3ed34494ae5ace2955..7e78980c280d73ed734f79e77245c2d6ad57bfdf 100644 --- a/core/modules/text/src/Tests/TextWithSummaryItemTest.php +++ b/core/modules/text/src/Tests/TextWithSummaryItemTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemInterface; use Drupal\field\Tests\FieldUnitTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests using entity fields of the text summary field type. @@ -98,7 +99,7 @@ public function testCrudAndUpdate() { */ protected function createField($entity_type) { // Create a field . - $this->fieldStorage = entity_create('field_storage_config', array( + $this->fieldStorage = FieldStorageConfig::create(array( 'field_name' => 'summary_field', 'entity_type' => $entity_type, 'type' => 'text_with_summary', diff --git a/core/modules/user/src/Tests/UserCreateTest.php b/core/modules/user/src/Tests/UserCreateTest.php index 2674f09bac1b99886ef47df21e5b5cfb790906f0..8ad3905b4b56c9af30159d9ee6fda9f8075ebc43 100644 --- a/core/modules/user/src/Tests/UserCreateTest.php +++ b/core/modules/user/src/Tests/UserCreateTest.php @@ -8,6 +8,7 @@ namespace Drupal\user\Tests; use Drupal\simpletest\WebTestBase; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the create user administration page. @@ -36,7 +37,7 @@ public function testUserAdd() { // Create a field. $field_name = 'test_field'; - entity_create('field_storage_config', array( + FieldStorageConfig::create(array( 'field_name' => $field_name, 'entity_type' => 'user', 'module' => 'image', diff --git a/core/modules/user/src/Tests/UserRegistrationTest.php b/core/modules/user/src/Tests/UserRegistrationTest.php index 1e16bc727e6c6b059ee7e520ddb64a066b6d0bc5..ad33d837846c3e5d32496722ec2b2b4a14ae8732 100644 --- a/core/modules/user/src/Tests/UserRegistrationTest.php +++ b/core/modules/user/src/Tests/UserRegistrationTest.php @@ -288,7 +288,7 @@ public function testUniqueFields() { */ function testRegistrationWithUserFields() { // Create a field on 'user' entity type. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => 'test_user_field', 'entity_type' => 'user', 'type' => 'test_field', diff --git a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php index 632be6a998d75ad783b50ba1abeca1174c450355..b86aade086a4278b0d9204ce321305394c95cd7c 100644 --- a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php +++ b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php @@ -57,7 +57,7 @@ protected function setUp() { 'name' => $this->randomString(), )); $content_type->save(); - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => Unicode::strtolower($this->randomMachineName()), 'entity_type' => 'node', 'type' => 'comment', diff --git a/core/modules/views/src/Tests/Handler/FieldGroupRowsTest.php b/core/modules/views/src/Tests/Handler/FieldGroupRowsTest.php index 9cfd854e414cf330b24574eedf8797fd5ffe5146..a7d278be8d8b44a55d060206cdf83f39e4e0146a 100644 --- a/core/modules/views/src/Tests/Handler/FieldGroupRowsTest.php +++ b/core/modules/views/src/Tests/Handler/FieldGroupRowsTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Render\RenderContext; use Drupal\views\Views; +use Drupal\field\Entity\FieldStorageConfig; /** * Tests the "Display all values in the same row" setting. @@ -48,7 +49,7 @@ protected function setUp() { $node_type = $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); // Create the unlimited text field. - $field_storage = entity_create('field_storage_config', array( + $field_storage = FieldStorageConfig::create(array( 'field_name' => $this->fieldName, 'entity_type' => 'node', 'type' => 'text',