|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010-2011 Stefan Galinski <stefan.galinski@gmail.com> 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * 00017 * This script is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * This copyright notice MUST APPEAR in all copies of the script! 00023 ***************************************************************/ 00024 00025 /** 00026 * Testcase for class t3lib_tree_NodeCollection. 00027 * 00028 * @author Stefan Galinski <stefan.galinski@gmail.com> 00029 * @package TYPO3 00030 * @subpackage t3lib 00031 */ 00032 class t3lib_tree_NodeCollectionTest extends tx_phpunit_testcase { 00033 public function setUp() { 00034 } 00035 00036 public function tearDown() { 00037 } 00038 00039 /** 00040 * @test 00041 */ 00042 public function sortNodes() { 00043 $nodeCollection = new t3lib_tree_NodeCollection(array( 00044 array('serializeClassName' => 't3lib_tree_Node', 'id' => 15), 00045 array('serializeClassName' => 't3lib_tree_Node', 'id' => 25), 00046 array('serializeClassName' => 't3lib_tree_Node', 'id' => 5), 00047 array('serializeClassName' => 't3lib_tree_Node', 'id' => 2), 00048 array('serializeClassName' => 't3lib_tree_Node', 'id' => 150), 00049 array('serializeClassName' => 't3lib_tree_Node', 'id' => 67), 00050 )); 00051 $nodeCollection->asort(); 00052 00053 $expected = array(2, 5, 15, 25, 67, 150); 00054 $ids = array(); 00055 foreach ($nodeCollection as $node) { 00056 $ids[] = $node->getId(); 00057 } 00058 $this->assertSame($expected, $ids); 00059 } 00060 } 00061 ?>
1.8.0