[TASK] Update caching framework to latest FLOW3 version
[Packages/TYPO3.CMS.git] / tests / t3lib / tree / class.t3lib_tree_nodecollectionTest.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010-2011 Stefan Galinski <stefan.galinski@gmail.com>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * Testcase for class t3lib_tree_NodeCollection.
27 *
28 * @author Stefan Galinski <stefan.galinski@gmail.com>
29 * @package TYPO3
30 * @subpackage t3lib
31 */
32 class t3lib_tree_NodeCollectionTest extends tx_phpunit_testcase {
33 public function setUp() {
34 }
35
36 public function tearDown() {
37 }
38
39 /**
40 * @test
41 */
42 public function sortNodes() {
43 $nodeCollection = new t3lib_tree_NodeCollection(array(
44 array('serializeClassName' => 't3lib_tree_Node', 'id' => 15),
45 array('serializeClassName' => 't3lib_tree_Node', 'id' => 25),
46 array('serializeClassName' => 't3lib_tree_Node', 'id' => 5),
47 array('serializeClassName' => 't3lib_tree_Node', 'id' => 2),
48 array('serializeClassName' => 't3lib_tree_Node', 'id' => 150),
49 array('serializeClassName' => 't3lib_tree_Node', 'id' => 67),
50 ));
51 $nodeCollection->asort();
52
53 $expected = array(2, 5, 15, 25, 67, 150);
54 $ids = array();
55 foreach ($nodeCollection as $node) {
56 $ids[] = $node->getId();
57 }
58 $this->assertSame($expected, $ids);
59 }
60 }
61 ?>