#1634: NestedSet: insertAsLastChildOf puts nodes in incorrect order
-----------------------------------+----------------------------------------
 Reporter:  eXtreme                |       Owner:  romanb 
     Type:  defect                 |      Status:  new    
 Priority:  blocker                |   Milestone:  Unknown
Component:  NestedSet              |     Version:  1.0.3  
 Keywords:                         |    Has_test:  1      
 Mystatus:  Pending Core Response  |   Has_patch:  0      
-----------------------------------+----------------------------------------
 I've noticed this serious issue during writing a test case for my ticket
 #1613. It is a problem with insertAsLastChildOf method. I used this method
 to prepare a tree in first test case for that ticket (now it uses yaml
 import). insertAsLastChildOf does not put nodes in right and correct
 places. It puts them as first childs, it also corrupts next-level child
 nodes including wrong parents and levels...

 Now I've created a new test case. It has 5 test methods:

  * testImportTree
  * testInsertBySequence
  * testInsertByLevel
  * testInsertBySequenceReversed
  * testInsertByLevelReversed

 Every method generates tree using different styles. Methods should produce
 the same tree:

 {{{
 id. (parent) name : LEFTxRIGHT

 1.  (0) Root : 1x20
 2.  (1)   Node 1 : 2x3
 3.  (1)   Node 2 : 4x15
 4.  (3)     Node 21 : 5x6
 5.  (3)     Node 22 : 7x8
 6.  (3)     Node 23 : 9x12
 7.  (6)       Node 231 : 10x11
 8.  (3)     Node 24 : 13x14
 9.  (1)   Node 3 : 16x17
 10. (1)   Node 4 : 18x19
 }}}

 Every method tests generated tree using the same asserts (they test every
 node on name, left, right, level and parent). Every method also tests
 moveAsNextSiblingOf and moveAsFirstChildOf on two nodes and after those
 moving operations there are also some asserts.

 '''ImportTree''' tests yaml import - everything is OK here.
 '''testInsertBySequence''' and '''testInsertByLevel''' use
 '''insertAsLastChildOf''' to insert nodes in tree - they are broken.

 BySequence means that nodes are inserted in order they should appear in
 tree. ByLevel means that it inserts first all nodes on level 1, then all
 nodes on level 2 and so on. Reversed means that methods use
 insertAsFirstChildOf (instead of insertAsLastChildOf). Each of them should
 produce the same tree. In fact, they don't do it. :P

 By now results of test case are:

 {{{
 Tested: 312 test cases.
 Successes: 274 passes.
 Failures: 76 fails.
 }}}

 I hope I have not done any mistakes in my test case ;)

 In fact, NestedSet isn't well testcased in Doctrine Test Framework. There
 are only single/multi root and yaml importing tests (and some connected
 with tickets).

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1634>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to