Update350Test.php in Lightning Media 8.3
File
modules/lightning_media_video/tests/src/Kernel/Update350Test.php
View source
<?php
namespace Drupal\Tests\lightning_media_video\Kernel;
use Drupal\field\Entity\FieldConfig;
use Drupal\KernelTests\KernelTestBase;
use Drupal\lightning_media_video\Update\Update350;
use Prophecy\Argument;
use Symfony\Component\Console\Style\StyleInterface;
class Update350Test extends KernelTestBase {
protected static $modules = [
'system',
'user',
];
protected function setUp() {
parent::setUp();
$this->container
->get('module_installer')
->install([
'lightning_media_video',
]);
FieldConfig::loadByName('media', 'video', 'field_media_in_library')
->setTranslatable(TRUE)
->save();
FieldConfig::loadByName('media', 'video_file', 'field_media_in_library')
->setTranslatable(TRUE)
->save();
}
public function test() {
$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());
}
}