You are here

protected function ParagraphsAsymmetricTranslationTest::setUp in Paragraphs asymmetric translation widgets 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/ParagraphsAsymmetricTranslationTest.php, line 37

Class

ParagraphsAsymmetricTranslationTest
Tests asymmetric translation of paragraphs.

Namespace

Drupal\Tests\paragraphs_asymmetric_translation_widgets\Functional

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalPlaceBlock('local_tasks_block');
  $this
    ->drupalPlaceBlock('page_title_block');
  $this->adminUser = $this
    ->drupalCreateUser([
    'administer site configuration',
    'administer nodes',
    'create paragraphed_content_demo content',
    'edit any paragraphed_content_demo content',
    'delete any paragraphed_content_demo content',
    'administer paragraph form display',
    'administer node form display',
    'administer paragraph fields',
    'administer content translation',
    'translate any entity',
    'create content translations',
    'administer languages',
    'administer content types',
  ]);
  $this
    ->drupalLogin($this->adminUser);

  // Mark the paragraph entities as untranslatable and the paragraph field
  // as translatable.
  $edit = [
    'entity_types[paragraph]' => TRUE,
    'settings[node][paragraphed_content_demo][fields][field_paragraphs_demo]' => TRUE,
    'settings[paragraph][nested_paragraph][translatable]' => TRUE,
    'settings[paragraph][nested_paragraph][settings][language][language_alterable]' => FALSE,
    'settings[paragraph][text][translatable]' => TRUE,
    'settings[paragraph][text][settings][language][language_alterable]' => FALSE,
    'settings[paragraph][nested_paragraph][fields][field_paragraphs_demo]' => TRUE,
  ];
  $this
    ->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration'));
}