public function LibraryInclusionTranslationTest::test in Lightning Media 8.4
Same name in this branch
- 8.4 modules/lightning_media_image/tests/src/Kernel/LibraryInclusionTranslationTest.php \Drupal\Tests\lightning_media_image\Kernel\LibraryInclusionTranslationTest::test()
- 8.4 modules/lightning_media_audio/tests/src/Kernel/LibraryInclusionTranslationTest.php \Drupal\Tests\lightning_media_audio\Kernel\LibraryInclusionTranslationTest::test()
- 8.4 modules/lightning_media_instagram/tests/src/Functional/LibraryInclusionTranslationTest.php \Drupal\Tests\lightning_media_instagram\Functional\LibraryInclusionTranslationTest::test()
- 8.4 modules/lightning_media_twitter/tests/src/Kernel/LibraryInclusionTranslationTest.php \Drupal\Tests\lightning_media_twitter\Kernel\LibraryInclusionTranslationTest::test()
Same name and namespace in other branches
- 8.3 modules/lightning_media_audio/tests/src/Kernel/LibraryInclusionTranslationTest.php \Drupal\Tests\lightning_media_audio\Kernel\LibraryInclusionTranslationTest::test()
Tests that field_media_in_library is not translatable.
File
- modules/
lightning_media_audio/ tests/ src/ Kernel/ LibraryInclusionTranslationTest.php, line 40
Class
- LibraryInclusionTranslationTest
- Tests that field_media_in_library is not translatable.
Namespace
Drupal\Tests\lightning_media_audio\KernelCode
public function test() {
$uri = uniqid('public://') . '.mp3';
$this
->assertGreaterThan(0, file_put_contents($uri, $this
->getRandomGenerator()
->paragraphs()));
$file = File::create([
'uri' => $uri,
]);
$file
->save();
$media = Media::create([
'bundle' => 'audio',
'name' => $this
->randomString(),
'field_media_audio_file' => $file
->id(),
'field_media_in_library' => TRUE,
]);
$media
->addTranslation('hu', [
'field_media_in_library' => FALSE,
]);
$this
->assertSame(SAVED_NEW, $media
->save());
$this
->assertTrue($media->field_media_in_library->value);
$this
->assertTrue($media
->getTranslation('hu')->field_media_in_library->value);
}