You are here

public function Update8003Test::testUpdate in Lightning Media 8.4

Tests the update function.

File

modules/lightning_media_video/tests/src/Kernel/Update8003Test.php, line 35

Class

Update8003Test
Tests Lightning Media Video's update path.

Namespace

Drupal\Tests\lightning_media_video\Kernel

Code

public function testUpdate() {
  $this
    ->createMediaType('test', [
    'id' => 'video',
  ]);
  EntityViewMode::create([
    'targetEntityType' => 'media',
    'id' => 'media.thumbnail',
  ])
    ->save();
  module_load_install('lightning_media_video');
  lightning_media_video_update_8003();
  $view_display = $this->container
    ->get('entity_display.repository')
    ->getViewDisplay('media', 'video', 'thumbnail');
  $this
    ->assertFalse($view_display
    ->isNew());
  $this
    ->assertSame('media.video.thumbnail', $view_display
    ->id());
  $this
    ->assertSame('video', $view_display
    ->getTargetBundle());
  $hidden_components = $view_display
    ->get('hidden');
  $this
    ->assertArrayNotHasKey('field_media_oembed_video', $hidden_components);
  $this
    ->assertTrue($hidden_components['field_media_test']);
}