Commit d4e7281f authored by catch's avatar catch

Issue #2641586 by Mac_Weber, marvin_B8: Replace deprecated usage of ...

Issue #2641586 by Mac_Weber, marvin_B8: Replace deprecated usage of  entity_create('field_storage_config') with a direct call to  FieldStorageConfig::create()
parent ea08d10e
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\comment\Entity\CommentType; use Drupal\comment\Entity\CommentType;
use Drupal\simpletest\KernelTestBase; use Drupal\simpletest\KernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests that comment fields cannot be added to entities with non-integer IDs. * Tests that comment fields cannot be added to entities with non-integer IDs.
...@@ -51,7 +52,7 @@ public function testCommentFieldNonStringId() { ...@@ -51,7 +52,7 @@ public function testCommentFieldNonStringId() {
'target_entity_type_id' => 'entity_test_string_id', 'target_entity_type_id' => 'entity_test_string_id',
)); ));
$bundle->save(); $bundle->save();
$field_storage = entity_create('field_storage_config', array( $field_storage = FieldStorageConfig::create(array(
'field_name' => 'foo', 'field_name' => 'foo',
'entity_type' => 'entity_test_string_id', 'entity_type' => 'entity_test_string_id',
'settings' => array( 'settings' => array(
......
...@@ -108,7 +108,7 @@ public function testExportImport() { ...@@ -108,7 +108,7 @@ public function testExportImport() {
// Create a field. // Create a field.
$this->fieldName = Unicode::strtolower($this->randomMachineName()); $this->fieldName = Unicode::strtolower($this->randomMachineName());
$this->fieldStorage = entity_create('field_storage_config', array( $this->fieldStorage = FieldStorageConfig::create(array(
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,
'entity_type' => 'node', 'entity_type' => 'node',
'type' => 'text', 'type' => 'text',
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\contact\Tests\Views; namespace Drupal\contact\Tests\Views;
use Drupal\views\Tests\ViewTestBase; use Drupal\views\Tests\ViewTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests which checks that no fieldapi fields are added on contact. * Tests which checks that no fieldapi fields are added on contact.
...@@ -33,7 +34,7 @@ class ContactFieldsTest extends ViewTestBase { ...@@ -33,7 +34,7 @@ class ContactFieldsTest extends ViewTestBase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$this->fieldStorage = entity_create('field_storage_config', array( $this->fieldStorage = FieldStorageConfig::create(array(
'field_name' => strtolower($this->randomMachineName()), 'field_name' => strtolower($this->randomMachineName()),
'entity_type' => 'contact_message', 'entity_type' => 'contact_message',
'type' => 'text' 'type' => 'text'
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
use Drupal\language\Entity\ConfigurableLanguage; use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\node\Entity\NodeType; use Drupal\node\Entity\NodeType;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests that contextual links are available for content translation. * Tests that contextual links are available for content translation.
...@@ -72,7 +73,7 @@ protected function setUp() { ...@@ -72,7 +73,7 @@ protected function setUp() {
$this->contentType = $this->drupalCreateContentType(array('type' => $this->bundle)); $this->contentType = $this->drupalCreateContentType(array('type' => $this->bundle));
// Add a field to the content type. The field is not yet translatable. // 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', 'field_name' => 'field_test_text',
'entity_type' => 'node', 'entity_type' => 'node',
'type' => 'text', 'type' => 'text',
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\content_translation\Tests; namespace Drupal\content_translation\Tests;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests the field synchronization behavior for the image field. * Tests the field synchronization behavior for the image field.
...@@ -49,7 +50,7 @@ protected function setupTestFields() { ...@@ -49,7 +50,7 @@ protected function setupTestFields() {
$this->fieldName = 'field_test_et_ui_image'; $this->fieldName = 'field_test_et_ui_image';
$this->cardinality = 3; $this->cardinality = 3;
entity_create('field_storage_config', array( FieldStorageConfig::create(array(
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,
'entity_type' => $this->entityTypeId, 'entity_type' => $this->entityTypeId,
'type' => 'image', 'type' => 'image',
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\language\Entity\ConfigurableLanguage; use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Base class for content translation tests. * Base class for content translation tests.
...@@ -183,7 +184,7 @@ protected function setupTestFields() { ...@@ -183,7 +184,7 @@ protected function setupTestFields() {
if (empty($this->fieldName)) { if (empty($this->fieldName)) {
$this->fieldName = 'field_test_et_ui_test'; $this->fieldName = 'field_test_et_ui_test';
} }
entity_create('field_storage_config', array( FieldStorageConfig::create(array(
'field_name' => $this->fieldName, 'field_name' => $this->fieldName,
'type' => 'string', 'type' => 'string',
'entity_type' => $this->entityTypeId, 'entity_type' => $this->entityTypeId,
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests Datetime field functionality. * Tests Datetime field functionality.
...@@ -77,7 +78,7 @@ protected function setUp() { ...@@ -77,7 +78,7 @@ protected function setUp() {
// Create a field with settings to validate. // Create a field with settings to validate.
$field_name = Unicode::strtolower($this->randomMachineName()); $field_name = Unicode::strtolower($this->randomMachineName());
$this->fieldStorage = entity_create('field_storage_config', array( $this->fieldStorage = FieldStorageConfig::create(array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'datetime', 'type' => 'datetime',
...@@ -624,7 +625,7 @@ function testDefaultValue() { ...@@ -624,7 +625,7 @@ function testDefaultValue() {
// Create a field storage with settings to validate. // Create a field storage with settings to validate.
$field_name = Unicode::strtolower($this->randomMachineName()); $field_name = Unicode::strtolower($this->randomMachineName());
$field_storage = entity_create('field_storage_config', array( $field_storage = FieldStorageConfig::create(array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',
'type' => 'datetime', 'type' => 'datetime',
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemInterface;
use Drupal\field\Tests\FieldUnitTestBase; use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests the new entity API for the date field type. * Tests the new entity API for the date field type.
...@@ -29,7 +30,7 @@ protected function setUp() { ...@@ -29,7 +30,7 @@ protected function setUp() {
parent::setUp(); parent::setUp();
// Create a field with settings to validate. // Create a field with settings to validate.
$field_storage = entity_create('field_storage_config', array( $field_storage = FieldStorageConfig::create(array(
'field_name' => 'field_datetime', 'field_name' => 'field_datetime',
'type' => 'datetime', 'type' => 'datetime',
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem; use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem;
use Drupal\views\Tests\Handler\HandlerTestBase; use Drupal\views\Tests\Handler\HandlerTestBase;
use Drupal\views\Tests\ViewTestData; use Drupal\views\Tests\ViewTestData;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Base class for testing datetime handlers. * Base class for testing datetime handlers.
...@@ -49,7 +50,7 @@ protected function setUp() { ...@@ -49,7 +50,7 @@ protected function setUp() {
'name' => 'page' 'name' => 'page'
]); ]);
$node_type->save(); $node_type->save();
$fieldStorage = entity_create('field_storage_config', [ $fieldStorage = FieldStorageConfig::create([
'field_name' => static::$field_name, 'field_name' => static::$field_name,
'entity_type' => 'node', 'entity_type' => 'node',
'type' => 'datetime', 'type' => 'datetime',
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\TypedData\OptionsProviderInterface; use Drupal\Core\TypedData\OptionsProviderInterface;
use Drupal\field\FieldStorageConfigInterface; use Drupal\field\FieldStorageConfigInterface;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Defines the Field storage configuration entity. * Defines the Field storage configuration entity.
...@@ -238,7 +239,7 @@ class FieldStorageConfig extends ConfigEntityBase implements FieldStorageConfigI ...@@ -238,7 +239,7 @@ class FieldStorageConfig extends ConfigEntityBase implements FieldStorageConfigI
* - type: required. * - type: required.
* *
* In most cases, Field entities are created via * 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. * parameter as in this constructor.
* *
* @see entity_create() * @see entity_create()
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemInterface;
use Drupal\field\Tests\FieldUnitTestBase; use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests the new entity API for the boolean field type. * Tests the new entity API for the boolean field type.
...@@ -25,7 +26,7 @@ protected function setUp() { ...@@ -25,7 +26,7 @@ protected function setUp() {
parent::setUp(); parent::setUp();
// Create a boolean field and storage for validation. // Create a boolean field and storage for validation.
entity_create('field_storage_config', array( FieldStorageConfig::create(array(
'field_name' => 'field_boolean', 'field_name' => 'field_boolean',
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'boolean', 'type' => 'boolean',
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Bulk delete storages and fields, and clean up afterwards. * Bulk delete storages and fields, and clean up afterwards.
...@@ -105,7 +106,7 @@ protected function setUp() { ...@@ -105,7 +106,7 @@ protected function setUp() {
} }
// Create two field storages. // Create two field storages.
$field_storage = entity_create('field_storage_config', array( $field_storage = FieldStorageConfig::create(array(
'field_name' => 'bf_1', 'field_name' => 'bf_1',
'entity_type' => $this->entityTypeId, 'entity_type' => $this->entityTypeId,
'type' => 'test_field', 'type' => 'test_field',
...@@ -113,7 +114,7 @@ protected function setUp() { ...@@ -113,7 +114,7 @@ protected function setUp() {
)); ));
$field_storage->save(); $field_storage->save();
$this->fieldStorages[] = $field_storage; $this->fieldStorages[] = $field_storage;
$field_storage = entity_create('field_storage_config', array( $field_storage = FieldStorageConfig::create(array(
'field_name' => 'bf_2', 'field_name' => 'bf_2',
'entity_type' => $this->entityTypeId, 'entity_type' => $this->entityTypeId,
'type' => 'test_field', 'type' => 'test_field',
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\field\Tests; namespace Drupal\field\Tests;
use Drupal\Core\Entity\Entity\EntityViewMode; use Drupal\Core\Entity\Entity\EntityViewMode;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests the field display API. * Tests the field display API.
...@@ -94,7 +95,7 @@ protected function setUp() { ...@@ -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(); entity_create('field_config', $field)->save();
// Create a display for the default view mode. // Create a display for the default view mode.
entity_get_display($field['entity_type'], $field['bundle'], 'default') entity_get_display($field['entity_type'], $field['bundle'], 'default')
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\Unicode;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests email field functionality. * Tests email field functionality.
...@@ -54,7 +55,7 @@ protected function setUp() { ...@@ -54,7 +55,7 @@ protected function setUp() {
function testEmailField() { function testEmailField() {
// Create a field with settings to validate. // Create a field with settings to validate.
$field_name = Unicode::strtolower($this->randomMachineName()); $field_name = Unicode::strtolower($this->randomMachineName());
$this->fieldStorage = entity_create('field_storage_config', array( $this->fieldStorage = FieldStorageConfig::create(array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'email', 'type' => 'email',
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemInterface;
use Drupal\field\Tests\FieldUnitTestBase; use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests the new entity API for the email field type. * Tests the new entity API for the email field type.
...@@ -22,7 +23,7 @@ protected function setUp() { ...@@ -22,7 +23,7 @@ protected function setUp() {
parent::setUp(); parent::setUp();
// Create an email field storage and field for validation. // Create an email field storage and field for validation.
entity_create('field_storage_config', array( FieldStorageConfig::create(array(
'field_name' => 'field_email', 'field_name' => 'field_email',
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'email', 'type' => 'email',
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\node\Entity\Node; use Drupal\node\Entity\Node;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests creating new entity (e.g. taxonomy-term) from an autocomplete widget. * Tests creating new entity (e.g. taxonomy-term) from an autocomplete widget.
...@@ -44,7 +45,7 @@ protected function setUp() { ...@@ -44,7 +45,7 @@ protected function setUp() {
$referenced = $this->drupalCreateContentType(); $referenced = $this->drupalCreateContentType();
$this->referencedType = $referenced->id(); $this->referencedType = $referenced->id();
entity_create('field_storage_config', array( FieldStorageConfig::create(array(
'field_name' => 'test_field', 'field_name' => 'test_field',
'entity_type' => 'node', 'entity_type' => 'node',
'translatable' => FALSE, 'translatable' => FALSE,
......
...@@ -55,7 +55,7 @@ function testEntityReferenceDefaultValue() { ...@@ -55,7 +55,7 @@ function testEntityReferenceDefaultValue() {
$referenced_node = $this->drupalCreateNode(array('type' => 'referenced_content')); $referenced_node = $this->drupalCreateNode(array('type' => 'referenced_content'));
$field_name = Unicode::strtolower($this->randomMachineName()); $field_name = Unicode::strtolower($this->randomMachineName());
$field_storage = entity_create('field_storage_config', array( $field_storage = FieldStorageConfig::create(array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',
'type' => 'entity_reference', 'type' => 'entity_reference',
...@@ -118,7 +118,7 @@ function testEntityReferenceDefaultConfigValue() { ...@@ -118,7 +118,7 @@ function testEntityReferenceDefaultConfigValue() {
$referenced_node_type2 = $this->drupalCreateContentType(array('type' => 'referenced_config_to_preserve')); $referenced_node_type2 = $this->drupalCreateContentType(array('type' => 'referenced_config_to_preserve'));
$field_name = Unicode::strtolower($this->randomMachineName()); $field_name = Unicode::strtolower($this->randomMachineName());
$field_storage = entity_create('field_storage_config', array( $field_storage = FieldStorageConfig::create(array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',
'type' => 'entity_reference', 'type' => 'entity_reference',
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\language\Entity\ConfigurableLanguage; use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests the translation of entity reference field display on nodes. * Tests the translation of entity reference field display on nodes.
...@@ -206,7 +207,7 @@ protected function enableTranslation() { ...@@ -206,7 +207,7 @@ protected function enableTranslation() {
* Adds term reference field for the article content type. * Adds term reference field for the article content type.
*/ */
protected function setUpEntityReferenceField() { protected function setUpEntityReferenceField() {
entity_create('field_storage_config', array( FieldStorageConfig::create(array(
'field_name' => $this->referenceFieldName, 'field_name' => $this->referenceFieldName,
'entity_type' => $this->testEntityTypeName, 'entity_type' => $this->testEntityTypeName,
'type' => 'entity_reference', 'type' => 'entity_reference',
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests an autocomplete widget with file upload. * Tests an autocomplete widget with file upload.
...@@ -51,7 +52,7 @@ protected function setUp() { ...@@ -51,7 +52,7 @@ protected function setUp() {
$this->referencedType = $referenced->id(); $this->referencedType = $referenced->id();
$this->nodeId = $this->drupalCreateNode(array('type' => $referenced->id()))->id(); $this->nodeId = $this->drupalCreateNode(array('type' => $referenced->id()))->id();
entity_create('field_storage_config', array( FieldStorageConfig::create(array(
'field_name' => 'test_field', 'field_name' => 'test_field',
'entity_type' => 'node', 'entity_type' => 'node',
'translatable' => FALSE, 'translatable' => FALSE,
...@@ -83,7 +84,7 @@ protected function setUp() { ...@@ -83,7 +84,7 @@ protected function setUp() {
// Create a file field. // Create a file field.
$file_field_name = '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, 'field_name' => $file_field_name,
'entity_type' => 'node', 'entity_type' => 'node',
'type' => 'file' 'type' => 'file'
......
...@@ -82,7 +82,7 @@ protected function setUp() { ...@@ -82,7 +82,7 @@ protected function setUp() {
// Set up a field, so that the entity that'll be referenced bubbles up a // Set up a field, so that the entity that'll be referenced bubbles up a
// cache tag when rendering it entirely. // cache tag when rendering it entirely.
entity_create('field_storage_config', array( FieldStorageConfig::create(array(
'field_name' => 'body', 'field_name' => 'body',
'entity_type' => $this->entityType, 'entity_type' => $this->entityType,
'type' => 'text', 'type' => 'text',
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Drupal\views\Views; use Drupal\views\Views;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests entity reference selection handler. * Tests entity reference selection handler.
...@@ -50,7 +51,7 @@ protected function setUp() { ...@@ -50,7 +51,7 @@ protected function setUp() {
} }
// Create a field. // Create a field.
$field_storage = entity_create('field_storage_config', array( $field_storage = FieldStorageConfig::create(array(
'field_name' => 'test_field', 'field_name' => 'test_field',
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'translatable' => FALSE, 'translatable' => FALSE,
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
namespace Drupal\field\Tests; namespace Drupal\field\Tests;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests Field access. * Tests Field access.
* *
...@@ -50,7 +52,7 @@ protected function setUp() { ...@@ -50,7 +52,7 @@ protected function setUp() {
'entity_type' => 'node', 'entity_type' => 'node',
'type' => 'text', 'type' => 'text',
); );
entity_create('field_storage_config', $field_storage)->save(); FieldStorageConfig::create($field_storage)->save();
$field = array( $field = array(
'field_name' => $field_storage['field_name'], 'field_name' => $field_storage['field_name'],
'entity_type' => 'node', 'entity_type' => 'node',
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\field\Tests; namespace Drupal\field\Tests;
use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\Unicode;
use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
/** /**
* Tests storage-related Field Attach API functions. * Tests storage-related Field Attach API functions.
...@@ -95,7 +96,7 @@ function testFieldAttachLoadMultiple() { ...@@ -95,7 +96,7 @@ function testFieldAttachLoadMultiple() {
); );
for ($i = 1; $i <= 3; $i++) { for ($i = 1; $i <= 3; $i++) {
$field_names[$i] = 'field_' . $i; $field_names[$i] = 'field_' . $i;
$field_storage = entity_create('field_storage_config', array( $field_storage = FieldStorageConfig::create(array(
'field_name' => $field_names[$i], 'field_name' => $field_names[$i],
'entity_type' => $entity_type, 'entity_type' => $entity_type,
'type' => 'test_field', 'type' => 'test_field',
...@@ -323,7 +324,7 @@ function testEntityDeleteBundle() { ...@@ -323,7 +324,7 @@ function testEntityDeleteBundle() {
'type' => 'test_field', 'type' => 'test_field',
'cardinality' => 1, 'cardinality' => 1,
); );
entity_create('field_storage_config', $field_storage)->save(); FieldStorageConfig::create($field_storage)->save();
$field = array( $field = array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => $entity_type, 'entity_type' => $entity_type,
......
...@@ -50,7 +50,7 @@ function setUp() { ...@@ -50,7 +50,7 @@ function setUp() {
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'test_field', 'type' => 'test_field',
); );
$this->fieldStorage = entity_create('field_storage_config', $this->fieldStorageDefinition); $this->fieldStorage = FieldStorageConfig::create($this->fieldStorageDefinition);
$this->fieldStorage->save(); $this->fieldStorage->save();
$this->fieldDefinition = array( $this->fieldDefinition = array(
'field_name' => $this->fieldStorage->getName(), 'field_name' => $this->fieldStorage->getName(),
...@@ -262,7 +262,7 @@ function testDeleteFieldCrossDeletion() { ...@@ -262,7 +262,7 @@ function testDeleteFieldCrossDeletion() {
$this->assertFalse(FieldConfig::loadByName('entity_test', $field_definition_2['bundle'], $field_storage->getName())); $this->assertFalse(FieldConfig::loadByName('entity_test', $field_definition_2['bundle'], $field_storage->getName()));
// Check that deletion of the last field deletes the storage. // Check that deletion of the last field deletes the storage.
$field_storage = entity_create('field_storage_config', $this->fieldStorageDefinition);