You are here

public function EntityFormDisplayPresaveTest::testOverride in Lightning Media 8.3

Tests that components are overridden by default.

File

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

Class

EntityFormDisplayPresaveTest
Tests presave operations on entity form displays.

Namespace

Drupal\Tests\lightning_media\Kernel

Code

public function testOverride() {

  // Configure the component to use Select list.
  $display = EntityFormDisplay::load('node.page.default');
  $display
    ->setComponent('field_media', [
    'type' => 'options_select',
  ]);
  $display
    ->save();

  // Assert the configuration was overridden.
  $display = EntityFormDisplay::load('node.page.default');
  $component = $display
    ->getComponent('field_media');
  $this
    ->assertSame('array', gettype($component));
  $this
    ->assertSame('entity_browser_entity_reference', $component['type']);
}