public function LayoutBuilderTranslationTest::testLayoutTranslationNoOverride in Layout Builder Symmetric Translations 8
Tests that access is denied to a layout translation if there is override.
File
- tests/
src/ Functional/ LayoutBuilderTranslationTest.php, line 131
Class
- LayoutBuilderTranslationTest
- Tests that the Layout Builder UI works with translated content.
Namespace
Drupal\Tests\layout_builder_st\FunctionalCode
public function testLayoutTranslationNoOverride() {
$assert_session = $this
->assertSession();
$entity_url = $this->entity
->toUrl('canonical')
->toString();
$language = \Drupal::languageManager()
->getLanguage($this->langcodes[2]);
$translated_entity_url = $this->entity
->toUrl('canonical', [
'language' => $language,
])
->toString();
$translated_layout_url = $translated_entity_url . '/layout';
$this
->drupalGet($entity_url);
$assert_session
->pageTextNotContains('The translated field value');
$assert_session
->pageTextContains('The untranslated field value');
$this
->drupalGet($translated_entity_url);
$assert_session
->pageTextNotContains('The untranslated field value');
$assert_session
->pageTextContains('The translated field value');
// If there is not a layout override the layout translation is not
// accessible.
$this
->drupalGet($translated_layout_url);
$assert_session
->pageTextContains('Access denied');
}