protected function LayoutBuilderTranslationTest::addEntityTranslation in Drupal 8
Same name and namespace in other branches
- 9 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTranslationTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTranslationTest::addEntityTranslation()
Adds an entity translation.
2 calls to LayoutBuilderTranslationTest::addEntityTranslation()
- LayoutBuilderTranslationTest::testLayoutOverrideBeforeTranslation in core/
modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderTranslationTest.php - Tests that layout overrides work when created before a translation.
- LayoutBuilderTranslationTest::testTranslationBeforeLayoutOverride in core/
modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderTranslationTest.php - Tests that layout overrides work when created after a translation.
File
- core/
modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderTranslationTest.php, line 185
Class
- LayoutBuilderTranslationTest
- Tests that the Layout Builder works with translated content.
Namespace
Drupal\Tests\layout_builder\FunctionalCode
protected function addEntityTranslation() {
$user = $this->loggedInUser;
$this
->drupalLogin($this->translator);
$add_translation_url = Url::fromRoute("entity.{$this->entityTypeId}.content_translation_add", [
$this->entityTypeId => $this->entity
->id(),
'source' => $this->langcodes[0],
'target' => $this->langcodes[2],
]);
$this
->drupalPostForm($add_translation_url, [
"{$this->fieldName}[0][value]" => 'The translated field value',
], 'Save');
$this
->drupalLogin($user);
}