You are here

protected function AmpFormatterMediaImageTest::setUp in Accelerated Mobile Pages (AMP) 8.3

Overrides AmpFormatterTestBase::setUp

File

tests/src/Functional/AmpFormatterMediaImageTest.php, line 47

Class

AmpFormatterMediaImageTest
Tests AMP Media Image formatter.

Namespace

Drupal\Tests\amp\Functional

Code

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

  // Create an image media type.
  $values = [
    'id' => 'image',
    'label' => 'Image',
    'new_revision' => FALSE,
  ];
  $media_type = $this
    ->createMediaType('image', $values);
  drupal_flush_all_caches();

  // Create a media field.
  $target_entity_type = 'media';
  $target_bundles = [
    'image',
  ];
  $formatter_type = 'entity_reference_entity_view';
  $formatter_settings = [
    'view_mode' => 'full',
    'link' => FALSE,
  ];
  $this
    ->createEntityReferenceField($this->fieldName, $target_entity_type, $target_bundles, $formatter_type, $formatter_settings);
  $this
    ->configureDisplay();
}