You are here

protected function ParagraphsEntityTranslationWithNonTranslatableParagraphs::setUp in Paragraphs 8

Same name in this branch
  1. 8 tests/src/Functional/WidgetLegacy/ParagraphsEntityTranslationWithNonTranslatableParagraphs.php \Drupal\Tests\paragraphs\Functional\WidgetLegacy\ParagraphsEntityTranslationWithNonTranslatableParagraphs::setUp()
  2. 8 tests/src/Functional/WidgetStable/ParagraphsEntityTranslationWithNonTranslatableParagraphs.php \Drupal\Tests\paragraphs\Functional\WidgetStable\ParagraphsEntityTranslationWithNonTranslatableParagraphs::setUp()

Overrides ParagraphsTestBase::setUp

File

tests/src/Functional/WidgetLegacy/ParagraphsEntityTranslationWithNonTranslatableParagraphs.php, line 25

Class

ParagraphsEntityTranslationWithNonTranslatableParagraphs
Tests the translation of heavily nested / specialized setup.

Namespace

Drupal\Tests\paragraphs\Functional\WidgetLegacy

Code

protected function setUp() : void {
  parent::setUp();
  $this->admin_user = $this
    ->drupalCreateUser([], NULL, TRUE);
  $this
    ->drupalLogin($this->admin_user);

  // Add a languages.
  $edit = array(
    'predefined_langcode' => 'de',
  );
  $this
    ->drupalGet('admin/config/regional/language/add');
  $this
    ->submitForm($edit, 'Add language');
  $edit = array(
    'predefined_langcode' => 'fr',
  );
  $this
    ->drupalGet('admin/config/regional/language/add');
  $this
    ->submitForm($edit, 'Add language');

  // Create article content type with a paragraphs field.
  $this
    ->addParagraphedContentType('article', 'field_paragraphs');
  $this
    ->drupalGet('admin/structure/types/manage/article');

  // Make content type translatable.
  $edit = array(
    'language_configuration[content_translation]' => TRUE,
  );
  $this
    ->drupalGet('admin/structure/types/manage/article');
  $this
    ->submitForm($edit, 'Save content type');
  $this
    ->drupalGet('admin/structure/types/manage/article');

  // Ensue the paragraphs field itself isn't translatable - this would be a
  // currently not supported configuration otherwise.
  $edit = array(
    'translatable' => FALSE,
  );
  $this
    ->drupalGet('admin/structure/types/manage/article/fields/node.article.field_paragraphs');
  $this
    ->submitForm($edit, 'Save settings');

  // Add Paragraphs type.
  $this
    ->addParagraphsType('test_paragraph_type');

  // Configure paragraphs type.
  static::fieldUIAddNewField('admin/structure/paragraphs_type/test_paragraph_type', 'text', 'Text', 'string', [
    'cardinality' => '-1',
  ]);

  // Just for verbose-sake - check the content language settings.
  $this
    ->drupalGet('admin/config/regional/content-language');
}