You are here

protected function FormatterTestBase::setUp in Facebook Instant Articles 3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/Plugin/Field/FieldFormatter/FormatterTestBase.php \Drupal\Tests\fb_instant_articles\Kernel\Plugin\Field\FieldFormatter\FormatterTestBase::setUp()

Overrides KernelTestBase::setUp

14 calls to FormatterTestBase::setUp()
AdFormatterTest::setUp in tests/src/Kernel/Plugin/Field/FieldFormatter/AdFormatterTest.php
AnalyticsFormatterTest::setUp in tests/src/Kernel/Plugin/Field/FieldFormatter/AnalyticsFormatterTest.php
AuthorFormatterTest::setUp in tests/src/Kernel/Plugin/Field/FieldFormatter/AuthorFormatterTest.php
AuthorReferenceFormatterTest::setUp in tests/src/Kernel/Plugin/Field/FieldFormatter/AuthorReferenceFormatterTest.php
CopyrightFormatterTest::setUp in tests/src/Kernel/Plugin/Field/FieldFormatter/CopyrightFormatterTest.php

... See full list

14 methods override FormatterTestBase::setUp()
AdFormatterTest::setUp in tests/src/Kernel/Plugin/Field/FieldFormatter/AdFormatterTest.php
AnalyticsFormatterTest::setUp in tests/src/Kernel/Plugin/Field/FieldFormatter/AnalyticsFormatterTest.php
AuthorFormatterTest::setUp in tests/src/Kernel/Plugin/Field/FieldFormatter/AuthorFormatterTest.php
AuthorReferenceFormatterTest::setUp in tests/src/Kernel/Plugin/Field/FieldFormatter/AuthorReferenceFormatterTest.php
CopyrightFormatterTest::setUp in tests/src/Kernel/Plugin/Field/FieldFormatter/CopyrightFormatterTest.php

... See full list

File

tests/src/Kernel/Plugin/Field/FieldFormatter/FormatterTestBase.php, line 69

Class

FormatterTestBase
Base class for common functionality between field formatter tests.

Namespace

Drupal\Tests\fb_instant_articles\Kernel\Plugin\Field\FieldFormatter

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installConfig([
    'system',
    'field',
  ]);
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('entity_test');
  $this
    ->installEntitySchema('user');
  $this->normalizerMock = $this
    ->createMock(NormalizerInterface::class);
  $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' => $this
      ->getFieldType(),
  ]);
  $field_storage
    ->save();
  $instance = FieldConfig::create([
    'field_storage' => $field_storage,
    'bundle' => $this->bundle,
    'label' => $this
      ->randomMachineName(),
  ]);
  $instance
    ->save();
  $this->display = EntityViewDisplay::create([
    'targetEntityType' => $this->entityType,
    'bundle' => $this->bundle,
    'mode' => 'default',
    'status' => TRUE,
  ]);
}