[TASK] Redesign TYPO3 error page
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Tests / Unit / View / ModuleMenuViewTest.php
1 <?php
2 namespace TYPO3\CMS\Backend\Tests\Unit\View;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Test for TYPO3\CMS\Backend\ModuleMenuView
19 */
20 class ModuleMenuViewTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
21 {
22 /**
23 * @test
24 */
25 public function unsetHiddenModulesUnsetsHiddenModules()
26 {
27 /** @var \TYPO3\CMS\Backend\View\ModuleMenuView|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface $moduleMenuViewMock */
28 $moduleMenuViewMock = $this->getAccessibleMock(
29 \TYPO3\CMS\Backend\View\ModuleMenuView::class,
30 array('dummy'),
31 array(),
32 '',
33 false
34 );
35
36 $loadedModulesFixture = array(
37 'file' => array(),
38 'tools' => array(),
39 'web' => array(
40 'sub' => array(
41 'list' => array(),
42 'func' => array(),
43 'info' => array(),
44 ),
45 ),
46 'user' => array(
47 'sub' => array(
48 'task' => array(),
49 'settings' => array(),
50 ),
51 ),
52 );
53 $moduleMenuViewMock->_set('loadedModules', $loadedModulesFixture);
54
55 $userTsFixture = array(
56 'value' => 'file,help',
57 'properties' => array(
58 'web' => 'list,func',
59 'user' => 'task',
60 ),
61 );
62
63 $GLOBALS['BE_USER'] = $this->getMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class, array(), array(), '', false);
64 $GLOBALS['BE_USER']->expects($this->any())->method('getTSConfig')->will($this->returnValue($userTsFixture));
65
66 $expectedResult = array(
67 'tools' => array(),
68 'web' => array(
69 'sub' => array(
70 'info' => array(),
71 ),
72 ),
73 'user' => array(
74 'sub' => array(
75 'settings' => array(),
76 ),
77 ),
78 );
79
80 $moduleMenuViewMock->_call('unsetHiddenModules');
81 $actualResult = $moduleMenuViewMock->_get('loadedModules');
82 $this->assertSame($expectedResult, $actualResult);
83 }
84 }