You are here

public function Update8001Test::testUpdate in Lightning Media 8.4

Tests the update function.

File

modules/lightning_media_audio/tests/src/Kernel/Update/Update8001Test.php, line 34

Class

Update8001Test
Tests Lightning Media Audio's update path.

Namespace

Drupal\Tests\lightning_media_audio\Kernel\Update

Code

public function testUpdate() {
  $this
    ->createMediaType('test', [
    'id' => 'audio_file',
  ]);
  EntityFormMode::create([
    'targetEntityType' => 'media',
    'id' => 'media.media_library',
  ])
    ->save();
  module_load_install('lightning_media_audio');
  lightning_media_audio_update_8001();
  $form_display = $this->container
    ->get('entity_display.repository')
    ->getFormDisplay('media', 'audio_file', 'media_library');
  $this
    ->assertFalse($form_display
    ->isNew());
  $this
    ->assertSame('media.audio_file.media_library', $form_display
    ->id());
  $this
    ->assertSame('audio_file', $form_display
    ->getTargetBundle());
  $hidden_components = $form_display
    ->get('hidden');
  $this
    ->assertArrayNotHasKey('field_media_audio_file', $hidden_components);
  $this
    ->assertTrue($hidden_components['field_media_test']);
}