function MediaEmbedFilterTranslationTest::setUp
Same name in other branches
- 9 core/modules/media/tests/src/Kernel/MediaEmbedFilterTranslationTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTranslationTest::setUp()
- 10 core/modules/media/tests/src/Kernel/MediaEmbedFilterTranslationTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTranslationTest::setUp()
- 11.x core/modules/media/tests/src/Kernel/MediaEmbedFilterTranslationTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTranslationTest::setUp()
Overrides MediaEmbedFilterTestBase::setUp
File
-
core/
modules/ media/ tests/ src/ Kernel/ MediaEmbedFilterTranslationTest.php, line 25
Class
- MediaEmbedFilterTranslationTest
- Tests that media embeds are translated based on text (host entity) language.
Namespace
Drupal\Tests\media\KernelCode
protected function setUp() {
parent::setUp();
ConfigurableLanguage::createFromLangcode('pt-br')->save();
// Reload the entity to ensure it is aware of the newly created language.
$this->embeddedEntity = $this->container
->get('entity_type.manager')
->getStorage('media')
->load($this->embeddedEntity
->id());
$this->embeddedEntity
->addTranslation('pt-br')
->set('field_media_image', [
'target_id' => $this->image
->id(),
'alt' => 'pt-br alt',
'title' => 'pt-br title',
])
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.