protected function EntityReferenceRevisionsCompositeTest::assignCompositeToNode in Entity Reference Revisions 8
Creates and assigns the composite entity to a node.
Parameters
string $node_type: The node type.
Return value
array An array containing a composite and a node entity.
5 calls to EntityReferenceRevisionsCompositeTest::assignCompositeToNode()
- EntityReferenceRevisionsCompositeTest::testCompositeDeleteAfterChangingParent in tests/
src/ Kernel/ EntityReferenceRevisionsCompositeTest.php - Tests the composite entity is not deleted when changing parents.
- EntityReferenceRevisionsCompositeTest::testCompositeDeleteAfterDuplicatingParent in tests/
src/ Kernel/ EntityReferenceRevisionsCompositeTest.php - Tests the composite entity is not deleted when duplicating host entity.
- EntityReferenceRevisionsCompositeTest::testCompositeDeleteAfterRemovingReference in tests/
src/ Kernel/ EntityReferenceRevisionsCompositeTest.php - Tests the composite entity is deleted after removing its reference.
- EntityReferenceRevisionsCompositeTest::testCompositeDeleteAfterRemovingReferenceWithRevisions in tests/
src/ Kernel/ EntityReferenceRevisionsCompositeTest.php - Tests the composite entity is deleted after removing its reference.
- EntityReferenceRevisionsCompositeTest::testCompositeDeleteRevisionAfterChangingParent in tests/
src/ Kernel/ EntityReferenceRevisionsCompositeTest.php - Composite entity with revisions isn't deleted when changing parents.
File
- tests/
src/ Kernel/ EntityReferenceRevisionsCompositeTest.php, line 696
Class
- EntityReferenceRevisionsCompositeTest
- Tests the entity_reference_revisions composite relationship.
Namespace
Drupal\Tests\entity_reference_revisions\KernelCode
protected function assignCompositeToNode($node_type = 'article') {
$composite = EntityTestCompositeRelationship::create([
'uuid' => $this
->randomMachineName(),
'name' => $this
->randomMachineName(),
]);
$composite
->save();
$node = Node::create([
'title' => $this
->randomMachineName(),
'type' => $node_type,
'composite_reference' => $composite,
]);
$node
->save();
return [
$composite,
$node,
];
}