[TASK] Remove not maintainable test
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Tests / Unit / Tree / Pagetree / DataProviderTest.php
1 <?php
2 namespace TYPO3\CMS\Backend\Tests\Unit\Tree\Pagetree;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2012-2013 Stefan Galinski <stefan.galinski@gmail.com>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 /**
28 * Test case
29 *
30 * @author Stefan Galinski <stefan.galinski@gmail.com>
31 * @author Oliver Klee <typo3-coding@oliverklee.de>
32 * @TODO: Refactor the subject class and make it better testable, especially getNodes()
33 */
34 class DataProviderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
35
36 /**
37 * @var \TYPO3\CMS\Backend\Tree\Pagetree\DataProvider|\PHPUnit_Framework_MockObject_MockObject
38 */
39 protected $subject = NULL;
40
41 public function setUp() {
42 $GLOBALS['TYPO3_CONF_VARS']['BE']['pageTree']['preloadLimit'] = 0;
43 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php']['postProcessCollections'] = array();
44 $GLOBALS['LOCKED_RECORDS'] = array();
45 /** @var $backendUserMock \TYPO3\CMS\Core\Authentication\BackendUserAuthentication|\PHPUnit_Framework_MockObject_MockObject */
46 $backendUserMock = $this->getMock('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication', array(), array(), '', FALSE);
47 $GLOBALS['BE_USER'] = $backendUserMock;
48
49 $this->subject = new \TYPO3\CMS\Backend\Tree\Pagetree\DataProvider();
50
51 }
52
53 /**
54 * @test
55 */
56 public function getRootNodeReturnsNodeWithRootId() {
57 $this->assertSame('root', $this->subject->getRoot()->getId());
58 }
59
60 /**
61 * @test
62 */
63 public function getRootNodeReturnsExpandedNode() {
64 $this->assertTrue($this->subject->getRoot()->isExpanded());
65 }
66 }