You are here

public function EntityFormDisplayPresaveTest::testNoOverride in Lightning Media 8.3

Tests that components are not overridden if configured.

File

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

Class

EntityFormDisplayPresaveTest
Tests presave operations on entity form displays.

Namespace

Drupal\Tests\lightning_media\Kernel

Code

public function testNoOverride() {
  $this
    ->config('lightning_media.settings')
    ->set('entity_browser.override_widget', FALSE)
    ->save();

  // 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 not overridden.
  $display = EntityFormDisplay::load('node.page.default');
  $component = $display
    ->getComponent('field_media');
  $this
    ->assertSame('array', gettype($component));
  $this
    ->assertSame('options_select', $component['type']);
}