/** * Test that update has no effect if the source node not found * (from JCR spec 10.8.3: "If this node does not have a corresponding node in srcWorkspace, then the method has no effect."). */ public function testUpdateSrcNotFound() { $srcNode = '/tests_write_manipulation_clone/testWorkspaceUpdateNode/updateSrcNotFound'; $dstNode = $srcNode; $srcSession = $this->srcWs->getSession(); $destSession = self::$destWs->getSession(); self::$destWs->cloneFrom($this->srcWsName, $srcNode, $dstNode, false); $clonedNode = $destSession->getNode($dstNode); $this->assertCount(4, $clonedNode->getProperties()); $this->checkNodeProperty($clonedNode, 'jcr:uuid', '1d392bcb-3e49-4f0e-b0af-7c30ab838122'); $this->checkNodeProperty($clonedNode, 'foo', 'bar_6'); // Update but then remove source node $node = $srcSession->getNode($srcNode); $node->setProperty('foo', 'foo-updated'); $srcSession->removeItem($srcNode); $srcSession->save(); try { $clonedNode->update($this->srcWsName); } catch (\Exception $exception) { $this->fail("'update' method should not raise an error when source not found, got error: " . $exception->getMessage()); } $destSession->refresh(false); // Cloned node should not get any updates that were made to the source node before it was removed $clonedNode = $destSession->getNode($dstNode); $this->assertCount(4, $clonedNode->getProperties()); $this->checkNodeProperty($clonedNode, 'jcr:uuid', '1d392bcb-3e49-4f0e-b0af-7c30ab838122'); $this->checkNodeProperty($clonedNode, 'foo', 'bar_6'); }
public function testGetSession() { $this->assertEquals($this->session, $this->workspace->getSession()); }