protected function ParagraphsTranslationsTest::setUp in Paragraphs 8
Overrides ParagraphsTestBase::setUp
File
- tests/
src/ Functional/ WidgetStable/ ParagraphsTranslationsTest.php, line 43
Class
- ParagraphsTranslationsTest
- Test paragraphs with translations.
Namespace
Drupal\Tests\paragraphs\Functional\WidgetStableCode
protected function setUp() : void {
parent::setUp();
// Place the breadcrumb, tested in fieldUIAddNewField().
$this
->drupalPlaceBlock('system_breadcrumb_block');
$this
->drupalPlaceBlock('local_tasks_block');
$this
->drupalPlaceBlock('local_actions_block');
$this
->drupalPlaceBlock('page_title_block');
$this
->addParagraphedContentType('paragraphed_test', 'field_paragraphs', 'paragraphs');
ConfigurableLanguage::createFromLangcode('de')
->save();
$this
->loginAsAdmin([
'access administration pages',
'view all revisions',
'revert all revisions',
'administer nodes',
'bypass node access',
'administer content translation',
'translate any entity',
'create content translations',
'administer languages',
'administer content types',
'administer node form display',
'edit any paragraphed_test content',
'create paragraphed_test content',
'edit behavior plugin settings',
]);
$this->visitorUser = $this
->drupalCreateUser([
'access content',
'view all revisions',
]);
// Add a Paragraph type.
$this
->addParagraphsType('text_translatable');
$this
->addParagraphsType('text_untranslatable');
$this
->addParagraphsType('text_untranslatable_hide');
$this
->addParagraphsType('container');
$this
->addFieldtoParagraphType('text_translatable', 'field_text_translatable', 'text');
$this
->addFieldtoParagraphType('text_untranslatable', 'field_text_untranslatable', 'text');
$this
->addFieldtoParagraphType('text_untranslatable_hide', 'field_text_untranslatable_hide', 'text');
$this
->addParagraphsField('container', 'field_paragraphs', 'paragraph');
$this
->drupalGet('admin/config/regional/content-language');
$this
->assertSession()
->pageTextContains('Paragraph types that are used in moderated content requires non-translatable fields to be edited in the original language form and this must be checked.');
$edit = [
'entity_types[paragraph]' => TRUE,
'entity_types[node]' => TRUE,
'settings[node][paragraphed_test][translatable]' => TRUE,
'settings[node][paragraphed_test][fields][field_paragraphs]' => FALSE,
'settings[node][paragraphed_test][settings][language][language_alterable]' => TRUE,
'settings[paragraph][text_translatable][translatable]' => TRUE,
'settings[paragraph][text_untranslatable][translatable]' => TRUE,
'settings[paragraph][text_untranslatable_hide][translatable]' => TRUE,
'settings[paragraph][container][translatable]' => TRUE,
'settings[paragraph][text_translatable][settings][content_translation][untranslatable_fields_hide]' => TRUE,
'settings[paragraph][text_untranslatable][settings][content_translation][untranslatable_fields_hide]' => FALSE,
'settings[paragraph][text_untranslatable_hide][settings][content_translation][untranslatable_fields_hide]' => TRUE,
'settings[paragraph][container][settings][content_translation][untranslatable_fields_hide]' => TRUE,
'settings[paragraph][text_translatable][fields][field_text_translatable]' => TRUE,
'settings[paragraph][text_untranslatable][fields][field_text_untranslatable]' => FALSE,
'settings[paragraph][text_untranslatable_hide][fields][field_text_untranslatable_hide]' => FALSE,
'settings[paragraph][container][fields][field_paragraphs]' => FALSE,
];
$this
->submitForm($edit, 'Save configuration');
}