function LayoutBuilderTranslationTest::addLayoutOverride

Same name in other branches
  1. 9 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTranslationTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTranslationTest::addLayoutOverride()
  2. 8.9.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderTranslationTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTranslationTest::addLayoutOverride()
  3. 10 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTranslationTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTranslationTest::addLayoutOverride()

Adds a layout override.

2 calls to LayoutBuilderTranslationTest::addLayoutOverride()
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 195

Class

LayoutBuilderTranslationTest
Tests that the Layout Builder works with translated content.

Namespace

Drupal\Tests\layout_builder\Functional

Code

protected function addLayoutOverride() : void {
    $assert_session = $this->assertSession();
    $page = $this->getSession()
        ->getPage();
    $entity_url = $this->entity
        ->toUrl()
        ->toString();
    $layout_url = $entity_url . '/layout';
    $this->drupalGet($layout_url);
    $assert_session->pageTextNotContains('The translated field value');
    $assert_session->pageTextContains('The untranslated field value');
    // Adjust the layout.
    $assert_session->linkExists('Add block');
    $this->clickLink('Add block');
    $assert_session->linkExists('Powered by Drupal');
    $this->clickLink('Powered by Drupal');
    $page->pressButton('Add block');
    $assert_session->pageTextContains('Powered by Drupal');
    $assert_session->buttonExists('Save layout');
    $page->pressButton('Save layout');
}

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