From e24a969afc08592925cf7f2bcd043f44a4313f8b Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Mon, 10 Aug 2015 16:28:11 +0200 Subject: [PATCH] added a test adding a reference to a new node in a single transaction --- tests/Writing/MixinReferenceableTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/Writing/MixinReferenceableTest.php b/tests/Writing/MixinReferenceableTest.php index 6a3374b7..203bb232 100644 --- a/tests/Writing/MixinReferenceableTest.php +++ b/tests/Writing/MixinReferenceableTest.php @@ -204,4 +204,17 @@ public function testSetUuidButNotReferenceableExisting() { $this->node->setProperty('jcr:uuid', 'dddd61c0-09ab-42a9-87c0-308ccc93aaaa'); } + + public function testCreateReferenceInSingleTransaction() + { + $session = $this->renewSession(); + + $rootNode = $session->getNode('/'); + $child1 = $rootNode->addNode('child1'); + $child2 = $rootNode->addNode('child2'); + $child2->addMixin('mix:referenceable'); + $child1->setProperty('someref', $child2, PropertyType::REFERENCE); + + $this->session->save(); + } }