diff --git a/tests/modules/entity_composite_relationship_test/src/Entity/EntityTestCompositeRelationship.php b/tests/modules/entity_composite_relationship_test/src/Entity/EntityTestCompositeRelationship.php index b7be947..bd0dd15 100644 --- a/tests/modules/entity_composite_relationship_test/src/Entity/EntityTestCompositeRelationship.php +++ b/tests/modules/entity_composite_relationship_test/src/Entity/EntityTestCompositeRelationship.php @@ -14,7 +14,7 @@ use Drupal\entity_test\Entity\EntityTestMulRev; * @ContentEntityType( * id = "entity_test_composite", * label = @Translation("Test entity - composite relationship"), - * handlers = { * + * handlers = { * "views_data" = "Drupal\views\EntityViewsData", * }, * base_table = "entity_test_composite", diff --git a/tests/src/Kernel/EntityReferenceRevisionsViewsTest.php b/tests/src/Kernel/EntityReferenceRevisionsViewsTest.php index b8eb0ae..d050510 100644 --- a/tests/src/Kernel/EntityReferenceRevisionsViewsTest.php +++ b/tests/src/Kernel/EntityReferenceRevisionsViewsTest.php @@ -97,6 +97,33 @@ class EntityReferenceRevisionsViewsTest extends ViewsKernelTestBase { 'title_1' => 'Node title revision 1', ], ], $column_map); + + // Set a new revision, composite entity should have a new revision as well. + $composite = EntityTestCompositeRelationship::load($composite->id()); + $composite_original_revision_id = $composite->getRevisionId(); + $node_original_revision_id = $node->getRevisionId(); + + $node->setTitle('Node title revision 2'); + $node->setNewRevision(TRUE); + $node->save(); + $node_rev_id = $node->getRevisionId(); + + // Ensure that we saved a new revision ID. + $composite2 = EntityTestCompositeRelationship::load($composite->id()); + $composite2_rev_id = $composite2->getRevisionId(); + $this->assertNotEquals($node_rev_id, $node_original_revision_id); + $this->assertNotEquals($composite2_rev_id, $composite_original_revision_id); + + // Check if the updated node title is presented in the View result. + $view = Views::getView('composite_entities'); + $this->executeView($view); + + $this->assertIdenticalResultset($view, [ + [ + 'name' => 'composite_entity_test', + 'title_1' => 'Node title revision 2', + ], + ], $column_map); } }