You are here

protected function LingotekSourceStatusFormatterTest::setUp in Lingotek Translation 3.6.x

Same name in this branch
  1. 3.6.x tests/src/Functional/FieldFormatters/LingotekSourceStatusFormatterTest.php \Drupal\Tests\lingotek\Functional\FieldFormatters\LingotekSourceStatusFormatterTest::setUp()
  2. 3.6.x src/Tests/Kernel/FieldFormatters/LingotekSourceStatusFormatterTest.php \Drupal\lingotek\Tests\Kernel\FieldFormatters\LingotekSourceStatusFormatterTest::setUp()
Same name and namespace in other branches
  1. 8.2 src/Tests/Kernel/FieldFormatters/LingotekSourceStatusFormatterTest.php \Drupal\lingotek\Tests\Kernel\FieldFormatters\LingotekSourceStatusFormatterTest::setUp()
  2. 4.0.x src/Tests/Kernel/FieldFormatters/LingotekSourceStatusFormatterTest.php \Drupal\lingotek\Tests\Kernel\FieldFormatters\LingotekSourceStatusFormatterTest::setUp()
  3. 3.0.x src/Tests/Kernel/FieldFormatters/LingotekSourceStatusFormatterTest.php \Drupal\lingotek\Tests\Kernel\FieldFormatters\LingotekSourceStatusFormatterTest::setUp()
  4. 3.1.x src/Tests/Kernel/FieldFormatters/LingotekSourceStatusFormatterTest.php \Drupal\lingotek\Tests\Kernel\FieldFormatters\LingotekSourceStatusFormatterTest::setUp()
  5. 3.2.x src/Tests/Kernel/FieldFormatters/LingotekSourceStatusFormatterTest.php \Drupal\lingotek\Tests\Kernel\FieldFormatters\LingotekSourceStatusFormatterTest::setUp()
  6. 3.3.x src/Tests/Kernel/FieldFormatters/LingotekSourceStatusFormatterTest.php \Drupal\lingotek\Tests\Kernel\FieldFormatters\LingotekSourceStatusFormatterTest::setUp()
  7. 3.4.x src/Tests/Kernel/FieldFormatters/LingotekSourceStatusFormatterTest.php \Drupal\lingotek\Tests\Kernel\FieldFormatters\LingotekSourceStatusFormatterTest::setUp()
  8. 3.5.x src/Tests/Kernel/FieldFormatters/LingotekSourceStatusFormatterTest.php \Drupal\lingotek\Tests\Kernel\FieldFormatters\LingotekSourceStatusFormatterTest::setUp()
  9. 3.7.x src/Tests/Kernel/FieldFormatters/LingotekSourceStatusFormatterTest.php \Drupal\lingotek\Tests\Kernel\FieldFormatters\LingotekSourceStatusFormatterTest::setUp()
  10. 3.8.x src/Tests/Kernel/FieldFormatters/LingotekSourceStatusFormatterTest.php \Drupal\lingotek\Tests\Kernel\FieldFormatters\LingotekSourceStatusFormatterTest::setUp()

Overrides KernelTestBase::setUp

File

src/Tests/Kernel/FieldFormatters/LingotekSourceStatusFormatterTest.php, line 55

Class

LingotekSourceStatusFormatterTest
Tests the Lingotek source status formatter.

Namespace

Drupal\lingotek\Tests\Kernel\FieldFormatters

Code

protected function setUp() : void {
  parent::setUp();
  $this->entityTypeManager = \Drupal::service('entity_type.manager');
  $this
    ->installConfig([
    'system',
  ]);
  $this
    ->installConfig([
    'field',
  ]);
  $this
    ->installConfig([
    'language',
  ]);
  $this
    ->installEntitySchema('entity_test');
  $this->entityType = 'entity_test';
  $this->bundle = $this->entityType;
  $this->fieldName = mb_strtolower($this
    ->randomMachineName());
  $field_storage = FieldStorageConfig::create([
    'field_name' => $this->fieldName,
    'entity_type' => $this->entityType,
    'type' => 'language',
  ]);
  $field_storage
    ->save();
  $instance = FieldConfig::create([
    'field_storage' => $field_storage,
    'bundle' => $this->bundle,
    'label' => $this
      ->randomMachineName(),
  ]);
  $instance
    ->save();
  $this->display = $this->entityTypeManager
    ->getStorage('entity_view_display')
    ->create([
    'targetEntityType' => $this->entityType,
    'bundle' => $this->bundle,
    'mode' => 'default',
    'status' => TRUE,
  ])
    ->setComponent($this->fieldName, []);
  $this->display
    ->save();
}