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 @@
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(
......
......@@ -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',
......
......@@ -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'
......
......@@ -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',
......
......@@ -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',
......
......@@ -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,
......
......@@ -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',
......
......@@ -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',
......
......@@ -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',
......
......@@ -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()
......
......@@ -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',
......
......@@ -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',
......
......@@ -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')
......
......@@ -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',
......
......@@ -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',
......
......@@ -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,
......
......@@ -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',
......
......@@ -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',
......
......@@ -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'
......
......@@ -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',
......
......@@ -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,
......
......@@ -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',
......
......@@ -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,
......
......@@ -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();
......
......@@ -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',
......
......@@ -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',
......
......@@ -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',
......
......@@ -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(<