You are here

public function Update350Test::test in Lightning Media 8.4

Same name in this branch
  1. 8.4 modules/lightning_media_video/tests/src/Kernel/Update350Test.php \Drupal\Tests\lightning_media_video\Kernel\Update350Test::test()
  2. 8.4 modules/lightning_media_audio/tests/src/Kernel/Update/Update350Test.php \Drupal\Tests\lightning_media_audio\Kernel\Update\Update350Test::test()
Same name and namespace in other branches
  1. 8.3 modules/lightning_media_video/tests/src/Kernel/Update350Test.php \Drupal\Tests\lightning_media_video\Kernel\Update350Test::test()

@covers ::removeVideoFileLibraryFieldTranslatability @covers ::removeVideoLibraryFieldTranslatability

File

modules/lightning_media_video/tests/src/Kernel/Update350Test.php, line 40

Class

Update350Test
Tests configuration updates targeting Lightning Media Video 3.5.0.

Namespace

Drupal\Tests\lightning_media_video\Kernel

Code

public function test() {
  $this
    ->createMediaType('test', [
    'id' => 'video',
  ]);
  $this
    ->createMediaType('test', [
    'id' => 'video_file',
  ]);
  $field_storage = FieldStorageConfig::create([
    'type' => 'boolean',
    'entity_type' => 'media',
    'field_name' => 'field_media_in_library',
  ]);
  $field_storage
    ->save();
  FieldConfig::create([
    'field_storage' => $field_storage,
    'bundle' => 'video',
    'translatable' => TRUE,
  ])
    ->save();
  FieldConfig::create([
    'field_storage' => $field_storage,
    'bundle' => 'video_file',
    'translatable' => TRUE,
  ])
    ->save();
  $io = $this
    ->prophesize(StyleInterface::class);
  $io
    ->confirm(Argument::type('string'))
    ->willReturn(TRUE);
  $task = Update350::create($this->container);
  $task
    ->removeVideoFileLibraryFieldTranslatability($io
    ->reveal());
  $task
    ->removeVideoLibraryFieldTranslatability($io
    ->reveal());
  $this
    ->assertFalse(FieldConfig::loadByName('media', 'video_file', 'field_media_in_library')
    ->isTranslatable());
  $this
    ->assertFalse(FieldConfig::loadByName('media', 'video', 'field_media_in_library')
    ->isTranslatable());
}