TYPO3 CMS  TYPO3_6-2
TreeNodeCollectionTest.php
Go to the documentation of this file.
1 <?php
3 
23 
27  public function sortNodes() {
28  $nodeCollection = new \TYPO3\CMS\Backend\Tree\TreeNodeCollection(array(
29  array('serializeClassName' => 'TYPO3\\CMS\\Backend\\Tree\\TreeNode', 'id' => 15),
30  array('serializeClassName' => 'TYPO3\\CMS\\Backend\\Tree\\TreeNode', 'id' => 25),
31  array('serializeClassName' => 'TYPO3\\CMS\\Backend\\Tree\\TreeNode', 'id' => 5),
32  array('serializeClassName' => 'TYPO3\\CMS\\Backend\\Tree\\TreeNode', 'id' => 2),
33  array('serializeClassName' => 'TYPO3\\CMS\\Backend\\Tree\\TreeNode', 'id' => 150),
34  array('serializeClassName' => 'TYPO3\\CMS\\Backend\\Tree\\TreeNode', 'id' => 67)
35  ));
36  $nodeCollection->asort();
37  $expected = array(2, 5, 15, 25, 67, 150);
38  $ids = array();
39  foreach ($nodeCollection as $node) {
40  $ids[] = $node->getId();
41  }
42  $this->assertSame($expected, $ids);
43  }
44 
45 }