Skip to content

Commit 11f6d7a

Browse files
committed
Merge pull request #165 from phpcr/create_and_reference_nodes_in_transaction
added a test adding a reference to a new node in a single transaction
2 parents ac899c0 + e24a969 commit 11f6d7a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/Writing/MixinReferenceableTest.php

+13
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,17 @@ public function testSetUuidButNotReferenceableExisting()
204204
{
205205
$this->node->setProperty('jcr:uuid', 'dddd61c0-09ab-42a9-87c0-308ccc93aaaa');
206206
}
207+
208+
public function testCreateReferenceInSingleTransaction()
209+
{
210+
$session = $this->renewSession();
211+
212+
$rootNode = $session->getNode('/');
213+
$child1 = $rootNode->addNode('child1');
214+
$child2 = $rootNode->addNode('child2');
215+
$child2->addMixin('mix:referenceable');
216+
$child1->setProperty('someref', $child2, PropertyType::REFERENCE);
217+
218+
$this->session->save();
219+
}
207220
}

0 commit comments

Comments
 (0)