l3pp4rd/DoctrineExtensions — pull request #423 by pscheit (2012-08-03 14:11:51+00:00)
Title: [tree] persistAs* Functions have other behaviour on already persisted items, PR for #422

Attached is a test for the issue

the test fails with:

There was 1 failure:

1) Gedmo\Tree\NestedTreePositionTest::testFullTreePositionUpdates
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
'
+ Vegitables
+ Meat
Food
- Vegitables
+ Milk
Fruits
Citrons
Oranges
- Milk
- Meat

'

D:\www\DoctrineExtensions\tests\Gedmo\Tree\NestedTreePositionTest.php:194

In my humble oppinon this should produce / update the same tree as before, shouldn't it?

If we don't do a clear() after popuplate we get an exception:

1) Gedmo\Tree\NestedTreePositionTest::testFullTreePositionUpdates
Gedmo\Exception\UnexpectedValueException: Cannot set child as parent to node: 5

D:\www\DoctrineExtensions\lib\Gedmo\Tree\Strategy\ORM\Nested.php:325
D:\www\DoctrineExtensions\lib\Gedmo\Tree\Strategy\ORM\Nested.php:166
D:\www\DoctrineExtensions\lib\Gedmo\Tree\TreeListener.php:123
D:\www\DoctrineExtensions\vendor\doctrine-common\lib\Doctrine\Common\EventManager.php:62
D:\www\DoctrineExtensions\vendor\doctrine-orm\lib\Doctrine\ORM\UnitOfWork.php:296
D:\www\DoctrineExtensions\vendor\doctrine-orm\lib\Doctrine\ORM\EntityManager.php:355
D:\www\DoctrineExtensions\tests\Gedmo\Tree\NestedTreePositionTest.php:189
C:\Program Files (x86)\PHP\phpunit:46