diff --git a/tests/src/Kernel/EntityReferenceRevisionsNormalizerTest.php b/tests/src/Kernel/EntityReferenceRevisionsNormalizerTest.php index 743c20a..05bf521 100644 --- a/tests/src/Kernel/EntityReferenceRevisionsNormalizerTest.php +++ b/tests/src/Kernel/EntityReferenceRevisionsNormalizerTest.php @@ -146,26 +146,24 @@ class EntityReferenceRevisionsNormalizerTest extends EntityKernelTestBase { $composite->save(); $nested_composite = EntityTestCompositeRelationship::create([ - 'name' => $this->randomMachineName(), + 'name' => $nested_composite_name = $this->randomMachineName(), 'composite_nested_reference' => $composite ]); $nested_composite->save(); - // Add content with the nested composite entity test. + // Add 2 nodes for referencing. $node_reference = Node::create([ 'type' => 'article', 'title' => 'Referenced node', ]); $node_reference->save(); - - // Add content with the nested composite entity test. $node_reference2 = Node::create([ 'type' => 'article', 'title' => 'Referenced node #2', ]); $node_reference2->save(); - // Add content with the nested composite entity test. + // Add content with the nested composite entity test and the 2 referenced nodes. $node = Node::create([ 'type' => 'article', 'title' => 'Normalizing paragraph test', @@ -191,10 +189,12 @@ class EntityReferenceRevisionsNormalizerTest extends EntityKernelTestBase { $node = $this->serializer->denormalize($normalized, Node::class, 'hal_json'); // Check the id of the composite reference in the node. - $this->assertEquals($revision_id, $node->composite_reference->target_revision_id); - $this->assertEquals($composite_name, $node->composite_reference->entity->label()); + $this->assertEquals($revision_id, $node->get('composite_reference')->target_revision_id); + $this->assertEquals($nested_composite_name, $node->get('composite_reference')->entity->label()); // Check the id of the nested composite reference in the entity test composite. - $this->assertEquals($nested_revision_id, $node->composite_reference->entity->composite_nested_reference->target_revision_id); + $this->assertEquals($nested_revision_id, $node->get('composite_reference')->entity->get('composite_nested_reference')->target_revision_id); + $this->assertEquals($composite_name, $node->get('composite_reference')->entity->get('composite_nested_reference')->entity->label()); + } }