You are here

function FieldStorageCrudTest::testCreateWithExplicitSchema in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field/src/Tests/FieldStorageCrudTest.php \Drupal\field\Tests\FieldStorageCrudTest::testCreateWithExplicitSchema()

Tests that an explicit schema can be provided on creation.

This behavior is needed to allow field storage creation within updates, since plugin classes (and thus the field type schema) cannot be accessed.

File

core/modules/field/src/Tests/FieldStorageCrudTest.php, line 193
Contains \Drupal\field\Tests\FieldStorageCrudTest.

Class

FieldStorageCrudTest
Tests field storage create, read, update, and delete.

Namespace

Drupal\field\Tests

Code

function testCreateWithExplicitSchema() {
  $schema = array(
    'dummy' => 'foobar',
  );
  $field_storage = entity_create('field_storage_config', array(
    'field_name' => 'field_2',
    'entity_type' => 'entity_test',
    'type' => 'test_field',
    'schema' => $schema,
  ));
  $this
    ->assertEqual($field_storage
    ->getSchema(), $schema);
}