You are here

protected function LinkItemTest::setUp in Zircon Profile 8

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

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

Overrides FieldUnitTestBase::setUp

File

core/modules/link/src/Tests/LinkItemTest.php, line 32
Contains \Drupal\link\Tests\LinkItemTest.

Class

LinkItemTest
Tests the new entity API for the link field type.

Namespace

Drupal\link\Tests

Code

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

  // Create a generic, external, and internal link fields for validation.
  FieldStorageConfig::create([
    'field_name' => 'field_test',
    'entity_type' => 'entity_test',
    'type' => 'link',
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => 'field_test',
    'bundle' => 'entity_test',
    'settings' => [
      'link_type' => LinkItemInterface::LINK_GENERIC,
    ],
  ])
    ->save();
  FieldStorageConfig::create([
    'field_name' => 'field_test_external',
    'entity_type' => 'entity_test',
    'type' => 'link',
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => 'field_test_external',
    'bundle' => 'entity_test',
    'settings' => [
      'link_type' => LinkItemInterface::LINK_EXTERNAL,
    ],
  ])
    ->save();
  FieldStorageConfig::create([
    'field_name' => 'field_test_internal',
    'entity_type' => 'entity_test',
    'type' => 'link',
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => 'field_test_internal',
    'bundle' => 'entity_test',
    'settings' => [
      'link_type' => LinkItemInterface::LINK_INTERNAL,
    ],
  ])
    ->save();
}