function MediaTranslationTest::setUp

Same name in other branches
  1. 9 core/modules/media/tests/src/Kernel/MediaTranslationTest.php \Drupal\Tests\media\Kernel\MediaTranslationTest::setUp()
  2. 8.9.x core/modules/media/tests/src/Kernel/MediaTranslationTest.php \Drupal\Tests\media\Kernel\MediaTranslationTest::setUp()
  3. 11.x 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 32

Class

MediaTranslationTest
Tests multilingual fields logic.

Namespace

Drupal\Tests\media\Kernel

Code

protected function setUp() : void {
    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', '');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.