protected function LayoutBuilderTranslationTest::addEntityTranslation in Drupal 9
Same name and namespace in other branches
- 8 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 187 
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
    ->drupalGet($add_translation_url);
  $this
    ->submitForm([
    "{$this->fieldName}[0][value]" => 'The translated field value',
  ], 'Save');
  $this
    ->drupalLogin($user);
}