You are here

protected function DateTimeItemTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/datetime/src/Tests/DateTimeItemTest.php \Drupal\datetime\Tests\DateTimeItemTest::setUp()

Set the default field storage backend for fields created during tests.

Overrides FieldUnitTestBase::setUp

File

core/modules/datetime/src/Tests/DateTimeItemTest.php, line 28
Contains \Drupal\datetime\Tests\DateTimeItemTest.

Class

DateTimeItemTest
Tests the new entity API for the date field type.

Namespace

Drupal\datetime\Tests

Code

protected function setUp() {
  parent::setUp();

  // Create a field with settings to validate.
  $field_storage = entity_create('field_storage_config', array(
    'field_name' => 'field_datetime',
    'type' => 'datetime',
    'entity_type' => 'entity_test',
    'settings' => array(
      'datetime_type' => 'date',
    ),
  ));
  $field_storage
    ->save();
  $field = entity_create('field_config', array(
    'field_storage' => $field_storage,
    'bundle' => 'entity_test',
    'settings' => array(
      'default_value' => 'blank',
    ),
  ));
  $field
    ->save();
}