You are here

protected function RawStringFormatterTest::setUp in Zircon Profile 8

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

Performs setup tasks before each individual test method is run.

Overrides KernelTestBase::setUp

File

core/modules/field/src/Tests/String/RawStringFormatterTest.php, line 56
Contains \Drupal\field\Tests\String\RawStringFormatterTest.

Class

RawStringFormatterTest
Tests the raw string formatter

Namespace

Drupal\field\Tests\String

Code

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

  // Configure the theme system.
  $this
    ->installConfig(array(
    'system',
    'field',
  ));
  $this
    ->installSchema('system', 'router');
  \Drupal::service('router.builder')
    ->rebuild();
  $this
    ->installEntitySchema('entity_test');
  $this->entityType = 'entity_test';
  $this->bundle = $this->entityType;
  $this->fieldName = Unicode::strtolower($this
    ->randomMachineName());
  $field_storage = FieldStorageConfig::create(array(
    'field_name' => $this->fieldName,
    'entity_type' => $this->entityType,
    'type' => 'string_long',
  ));
  $field_storage
    ->save();
  $instance = FieldConfig::create(array(
    'field_storage' => $field_storage,
    'bundle' => $this->bundle,
    'label' => $this
      ->randomMachineName(),
  ));
  $instance
    ->save();
  $this->display = entity_get_display($this->entityType, $this->bundle, 'default')
    ->setComponent($this->fieldName, array(
    'type' => 'string',
    'settings' => array(),
  ));
  $this->display
    ->save();
}