From 0e168785fb9ecd596fad0cb7dac27cf6d6466494 Mon Sep 17 00:00:00 2001 From: dantleech Date: Wed, 17 Apr 2013 14:44:48 +0100 Subject: [PATCH] Reorder with rename test --- .../ODM/PHPCR/Functional/ReorderTest.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/ReorderTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/ReorderTest.php index d3bfa2768..58960cef5 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/ReorderTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/ReorderTest.php @@ -74,6 +74,31 @@ public function testReorder() $this->assertSame(array('second', 'first', 'third', 'fourth'), $this->getChildrenNames($parent->getChildren())); } + public function testReorderWithRename() + { + $first = $this->dm->find(null, '/functional/source/first'); + $this->assertNotNull($first); + + $first->setNodeName('renamed'); + $this->dm->persist($first); + + $parent = $this->dm->find(null, '/functional/source'); + + $children = $parent->getChildren(); + + $this->assertEquals($children->first()->getNodeName(), $first->getNodeName()); + var_dump($children->first()->getNodeName()); + var_dump($this->getChildrenNames($children)); + $this->assertSame($this->childrenNames, $this->getChildrenNames($children)); + + $this->dm->reorder($parent, 'renamed', 'second', false); + $this->dm->flush(); + $this->dm->clear(); + + $parent = $this->dm->find(null, '/functional/source'); + $this->assertSame(array('second', 'first', 'third', 'fourth'), $this->getChildrenNames($parent->getChildren())); + } + public function testReorderNoop() { $parent = $this->dm->find(null, '/functional/source');