protected function ParagraphsNodeMigrationAssertionsTrait::assertNode8Paragraphs in Paragraphs 8
Assertions on node 8.
2 calls to ParagraphsNodeMigrationAssertionsTrait::assertNode8Paragraphs()
- MigrateUiParagraphsTest::testParagraphsMigrate in tests/
src/ Functional/ Migrate/ MigrateUiParagraphsTest.php - Tests the result of the paragraphs migration.
- ParagraphContentMigrationTest::testParagraphContentMigration in tests/
src/ Kernel/ migrate/ ParagraphContentMigrationTest.php - Tests the migration of a content with paragraphs and field collections.
File
- tests/
src/ Traits/ ParagraphsNodeMigrationAssertionsTrait.php, line 17
Class
Namespace
Drupal\Tests\paragraphs\TraitsCode
protected function assertNode8Paragraphs() {
$node_8 = Node::load(8);
assert($node_8 instanceof NodeInterface);
// Check 'field collection test' field.
$node_8_field_collection_field_entities = $this
->getReferencedEntities($node_8, 'field_field_collection_test', 2);
$this
->assertEquals('Field Collection Text Data One UND', $node_8_field_collection_field_entities[0]->field_text->value);
$this
->assertEquals('1', $node_8_field_collection_field_entities[0]->field_integer_list->value);
$this
->assertEquals('Field Collection Text Data Two UND', $node_8_field_collection_field_entities[1]->field_text->value);
$this
->assertNull($node_8_field_collection_field_entities[1]->field_integer_list->value);
// Check 'any paragraph' field.
$node_8_field_any_paragraph_entities = $this
->getReferencedEntities($node_8, 'field_any_paragraph', 2);
$this
->assertEquals('Paragraph Field One Bundle One UND', $node_8_field_any_paragraph_entities[0]->field_text->value);
$this
->assertEquals('Some Text', $node_8_field_any_paragraph_entities[0]->field_text_list->value);
$this
->assertEquals('Paragraph Field One Bundle Two UND', $node_8_field_any_paragraph_entities[1]->field_text->value);
$this
->assertEquals('joe@joe.com', $node_8_field_any_paragraph_entities[1]->field_email->value);
// Check 'paragraph one only' field.
$node_8_field_paragraph_one_only_entities = $this
->getReferencedEntities($node_8, 'field_paragraph_one_only', 1);
$this
->assertEquals('Paragraph Field Two Bundle One Revision Two UND', $node_8_field_paragraph_one_only_entities[0]->field_text->value);
$this
->assertEquals('Some more text', $node_8_field_paragraph_one_only_entities[0]->field_text_list->value);
// Check 'nested fc outer' field.
$node_8_field_nested_fc_outer_entities = $this
->getReferencedEntities($node_8, 'field_nested_fc_outer', 1);
assert($node_8_field_nested_fc_outer_entities[0] instanceof ParagraphInterface);
$node_8_inner_nested_fc_0_entities = $this
->getReferencedEntities($node_8_field_nested_fc_outer_entities[0], 'field_nested_fc_inner', 1);
$this
->assertEquals('Nested FC test text', $node_8_inner_nested_fc_0_entities[0]->field_text->value);
}