protected function ParagraphsNodeMigrationAssertionsTrait::assertIcelandicNode9Paragraphs

Assertions of the Icelandic translation of node 9.

2 calls to ParagraphsNodeMigrationAssertionsTrait::assertIcelandicNode9Paragraphs()
MigrateUiParagraphsTest::testParagraphsMigrate in paragraphs/tests/src/Functional/Migrate/MigrateUiParagraphsTest.php
Tests the result of the paragraphs migration.
ParagraphContentMigrationTest::testParagraphContentMigration in paragraphs/tests/src/Kernel/migrate/ParagraphContentMigrationTest.php
Tests the migration of a content with paragraphs and field collections.

File

paragraphs/tests/src/Traits/ParagraphsNodeMigrationAssertionsTrait.php, line 77

Class

ParagraphsNodeMigrationAssertionsTrait

Namespace

Drupal\Tests\paragraphs\Traits

Code

protected function assertIcelandicNode9Paragraphs() {

  // Confirm that the Icelandic translation of node 9 (which was node 10 on
  // the source site) has the expected data.
  $node_9 = Node::load(9);
  assert($node_9 instanceof NodeInterface);
  assert($node_9 instanceof TranslatableInterface);
  $node_9_translation_languages = $node_9
    ->getTranslationLanguages(FALSE);
  $this
    ->assertEquals([
    'is',
  ], array_keys($node_9_translation_languages));
  $node_9 = $node_9
    ->getTranslation('is');
  $this
    ->assertSame('is', $node_9
    ->language()
    ->getId());

  // Check 'field collection test' field.
  $node_9_field_collection_field_entities = $this
    ->getReferencedEntities($node_9, 'field_field_collection_test', 3);
  $this
    ->assertEquals('Field Collection Text Data One IS', $node_9_field_collection_field_entities[0]->field_text->value);
  $this
    ->assertEquals('1', $node_9_field_collection_field_entities[0]->field_integer_list->value);
  $this
    ->assertEquals('Field Collection Text Data Two IS', $node_9_field_collection_field_entities[1]->field_text->value);
  $this
    ->assertEquals('2', $node_9_field_collection_field_entities[1]->field_integer_list->value);
  $this
    ->assertEquals('Field Collection Text Data Three IS', $node_9_field_collection_field_entities[2]->field_text->value);
  $this
    ->assertEquals('3', $node_9_field_collection_field_entities[2]->field_integer_list->value);

  // Check 'any paragraph' field.
  $node_9_field_any_paragraph_entities = $this
    ->getReferencedEntities($node_9, 'field_any_paragraph', 3);
  $this
    ->assertEquals('Paragraph Field One Bundle One IS', $node_9_field_any_paragraph_entities[0]->field_text->value);
  $this
    ->assertEquals('Some Text', $node_9_field_any_paragraph_entities[0]->field_text_list->value);
  $this
    ->assertEquals('Paragraph Field One Bundle Two IS', $node_9_field_any_paragraph_entities[1]->field_text->value);
  $this
    ->assertEquals('jose@jose.com', $node_9_field_any_paragraph_entities[1]->field_email->value);
  $this
    ->assertEquals('Paragraph Field One Bundle Two Delta 3 IS', $node_9_field_any_paragraph_entities[2]->field_text->value);
  $this
    ->assertEquals('john@john.com', $node_9_field_any_paragraph_entities[2]->field_email->value);

  // Check 'paragraph one only' field.
  $node_9_field_paragraph_one_only_entities = $this
    ->getReferencedEntities($node_9, 'field_paragraph_one_only', 1);
  $this
    ->assertEquals('Paragraph Field Two Bundle One IS', $node_9_field_paragraph_one_only_entities[0]->field_text->value);
  $this
    ->assertEquals('Some more text', $node_9_field_paragraph_one_only_entities[0]->field_text_list->value);

  // The 'nested fc outer' field should be empty.
  $this
    ->getReferencedEntities($node_9, 'field_nested_fc_outer', 0);
}