You are here

protected function LayoutBuilderTranslationTest::addLayoutOverride in Drupal 8

Same name and namespace in other branches
  1. 9 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 202

Class

LayoutBuilderTranslationTest
Tests that the Layout Builder works with translated content.

Namespace

Drupal\Tests\layout_builder\Functional

Code

protected function addLayoutOverride() {
  $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');
}