You are here

protected function LingotekNodeNestedParagraphsEditedTranslationTest::createNestedParagraphedNode in Lingotek Translation 3.8.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekNodeNestedParagraphsEditedTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNestedParagraphsEditedTranslationTest::createNestedParagraphedNode()
  2. 4.0.x tests/src/Functional/LingotekNodeNestedParagraphsEditedTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNestedParagraphsEditedTranslationTest::createNestedParagraphedNode()
  3. 3.0.x tests/src/Functional/LingotekNodeNestedParagraphsEditedTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNestedParagraphsEditedTranslationTest::createNestedParagraphedNode()
  4. 3.1.x tests/src/Functional/LingotekNodeNestedParagraphsEditedTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNestedParagraphsEditedTranslationTest::createNestedParagraphedNode()
  5. 3.2.x tests/src/Functional/LingotekNodeNestedParagraphsEditedTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNestedParagraphsEditedTranslationTest::createNestedParagraphedNode()
  6. 3.3.x tests/src/Functional/LingotekNodeNestedParagraphsEditedTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNestedParagraphsEditedTranslationTest::createNestedParagraphedNode()
  7. 3.4.x tests/src/Functional/LingotekNodeNestedParagraphsEditedTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNestedParagraphsEditedTranslationTest::createNestedParagraphedNode()
  8. 3.5.x tests/src/Functional/LingotekNodeNestedParagraphsEditedTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNestedParagraphsEditedTranslationTest::createNestedParagraphedNode()
  9. 3.6.x tests/src/Functional/LingotekNodeNestedParagraphsEditedTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNestedParagraphsEditedTranslationTest::createNestedParagraphedNode()
  10. 3.7.x tests/src/Functional/LingotekNodeNestedParagraphsEditedTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNestedParagraphsEditedTranslationTest::createNestedParagraphedNode()
1 call to LingotekNodeNestedParagraphsEditedTranslationTest::createNestedParagraphedNode()
LingotekNodeNestedParagraphsEditedTranslationTest::testNodeMarkedAsEditedIfParagraphEdited in tests/src/Functional/LingotekNodeNestedParagraphsEditedTranslationTest.php

File

tests/src/Functional/LingotekNodeNestedParagraphsEditedTranslationTest.php, line 175

Class

LingotekNodeNestedParagraphsEditedTranslationTest
Tests translating a node with multiple locales including nested paragraphs.

Namespace

Drupal\Tests\lingotek\Functional

Code

protected function createNestedParagraphedNode($profile = 'manual') {
  $nestedParagraph1 = Paragraph::create([
    'type' => 'image_text',
    'field_text_demo' => 'Llamas are very cool for the first time',
  ]);
  $nestedParagraph1
    ->save();
  $nestedParagraph2 = Paragraph::create([
    'type' => 'image_text',
    'field_text_demo' => 'Llamas are very cool for the second time',
  ]);
  $nestedParagraph2
    ->save();
  $paragraph1 = Paragraph::create([
    'type' => 'paragraph_container',
    'field_paragraphs_demo' => [
      $nestedParagraph1,
      $nestedParagraph2,
    ],
  ]);
  $paragraph1
    ->save();
  $nestedParagraph3 = Paragraph::create([
    'type' => 'image_text',
    'field_text_demo' => 'Dogs are very cool for the first time',
  ]);
  $nestedParagraph3
    ->save();
  $nestedParagraph4 = Paragraph::create([
    'type' => 'image_text',
    'field_text_demo' => 'Dogs are very cool for the second time',
  ]);
  $nestedParagraph4
    ->save();
  $paragraph2 = Paragraph::create([
    'type' => 'paragraph_container',
    'field_paragraphs_demo' => [
      $nestedParagraph3,
      $nestedParagraph4,
    ],
  ]);
  $paragraph2
    ->save();
  $metadata = LingotekContentMetadata::create([
    'profile' => $profile,
  ]);
  $metadata
    ->save();
  $node = Node::create([
    'type' => 'paragraphed_nested_content',
    'title' => 'Llamas are cool',
    'lingotek_metadata' => $metadata,
    'field_paragraph_container' => [
      $paragraph1,
      $paragraph2,
    ],
    'status' => TRUE,
  ]);
  $node
    ->save();
}