public function Update8004Test::testUpdate in Lightning Media 8.4
Tests the update function.
File
- modules/
lightning_media_video/ tests/ src/ Kernel/ Update8004Test.php, line 35
Class
- Update8004Test
- Tests Lightning Media Video's update path.
Namespace
Drupal\Tests\lightning_media_video\KernelCode
public function testUpdate() {
$this
->createMediaType('test', [
'id' => 'video',
]);
$this
->createMediaType('test', [
'id' => 'video_file',
]);
EntityFormMode::create([
'targetEntityType' => 'media',
'id' => 'media.media_library',
])
->save();
module_load_install('lightning_media_video');
lightning_media_video_update_8004();
$form_display = $this->container
->get('entity_display.repository')
->getFormDisplay('media', 'video', 'media_library');
$this
->assertFalse($form_display
->isNew());
$this
->assertSame('media.video.media_library', $form_display
->id());
$this
->assertSame('video', $form_display
->getTargetBundle());
$hidden_components = $form_display
->get('hidden');
$this
->assertArrayNotHasKey('field_media_oembed_video', $hidden_components);
$this
->assertTrue($hidden_components['field_media_test']);
$form_display = $this->container
->get('entity_display.repository')
->getFormDisplay('media', 'video_file', 'media_library');
$this
->assertFalse($form_display
->isNew());
$this
->assertSame('media.video_file.media_library', $form_display
->id());
$this
->assertSame('video_file', $form_display
->getTargetBundle());
$hidden_components = $form_display
->get('hidden');
$this
->assertArrayNotHasKey('field_media_video_file', $hidden_components);
$this
->assertTrue($hidden_components['field_media_test_1']);
}