You are here

protected function EntityFormDisplayPresaveTest::setUp in Lightning Media 8.3

Overrides KernelTestBase::setUp

File

tests/src/Kernel/EntityFormDisplayPresaveTest.php, line 28

Class

EntityFormDisplayPresaveTest
Tests presave operations on entity form displays.

Namespace

Drupal\Tests\lightning_media\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this->container
    ->get('module_installer')
    ->install([
    'lightning_media_image',
    'lightning_page',
  ]);

  // Add a media reference field to Basic page.
  $field_storage = FieldStorageConfig::create([
    'field_name' => 'field_media',
    'entity_type' => 'node',
    'type' => 'entity_reference',
    'settings' => [
      'target_type' => 'media',
    ],
  ]);
  $field_storage
    ->save();
  FieldConfig::create([
    'field_storage' => $field_storage,
    'bundle' => 'page',
    'label' => 'Media',
    'settings' => [
      'handler_settings' => [
        'target_bundles' => [
          'image' => 'image',
        ],
      ],
    ],
  ])
    ->save();
}