You are here

protected function MediaTranslationTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media/tests/src/Kernel/MediaTranslationTest.php \Drupal\Tests\media\Kernel\MediaTranslationTest::setUp()

Overrides MediaKernelTestBase::setUp

File

core/modules/media/tests/src/Kernel/MediaTranslationTest.php, line 33

Class

MediaTranslationTest
Tests multilanguage fields logic.

Namespace

Drupal\Tests\media\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installConfig([
    'language',
  ]);

  // Create a test media type for translations.
  $this->testTranslationMediaType = $this
    ->createMediaType('test_translation');
  for ($i = 0; $i < 3; ++$i) {
    $language_id = 'l' . $i;
    ConfigurableLanguage::create([
      'id' => $language_id,
      'label' => $this
        ->randomString(),
    ])
      ->save();
    file_put_contents('public://' . $language_id . '.png', '');
  }
}