You are here

protected function EntityDisplaySetupTrait::setupEntityDisplays in Video Embed Field 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/EntityDisplaySetupTrait.php \Drupal\Tests\video_embed_field\Functional\EntityDisplaySetupTrait::setupEntityDisplays()

Setup the entity displays with required fields.

5 calls to EntityDisplaySetupTrait::setupEntityDisplays()
AutoplayPermissionTest::testAutoplay in tests/src/Functional/AutoplayPermissionTest.php
Test the autoplay permission works.
ColorboxFormatterTest::setUp in tests/src/FunctionalJavascript/ColorboxFormatterTest.php
FormatterConfigurationTest::setUp in tests/src/Functional/FormatterConfigurationTest.php
LazyLoadFormatterTest::setUp in tests/src/FunctionalJavascript/LazyLoadFormatterTest.php
WidgetTest::testVideoEmbedFieldDefaultWidget in tests/src/Functional/WidgetTest.php
Test the input widget.

File

tests/src/Functional/EntityDisplaySetupTrait.php, line 48

Class

EntityDisplaySetupTrait
A trait for manipulating entity display.

Namespace

Drupal\Tests\video_embed_field\Functional

Code

protected function setupEntityDisplays() {
  $this->fieldName = 'field_test_video_field';
  $this->contentTypeName = 'test_content_type_name';
  $this
    ->createContentType([
    'type' => $this->contentTypeName,
  ]);
  $field_storage = FieldStorageConfig::create([
    'field_name' => $this->fieldName,
    'entity_type' => 'node',
    'type' => 'video_embed_field',
    'settings' => [
      'allowed_providers' => [],
    ],
  ]);
  $field_storage
    ->save();
  FieldConfig::create([
    'field_storage' => $field_storage,
    'bundle' => $this->contentTypeName,
    'settings' => [],
  ])
    ->save();
  $this->entityDisplay = $this->container
    ->get('entity_display.repository')
    ->getViewDisplay('node', $this->contentTypeName, 'default');
  $this->entityFormDisplay = $this->container
    ->get('entity_display.repository')
    ->getFormDisplay('node', $this->contentTypeName, 'default');
}