TYPO3 CMS  TYPO3_7-6
ModuleMenuViewTest.php
Go to the documentation of this file.
1 <?php
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 
21 {
25  public function unsetHiddenModulesUnsetsHiddenModules()
26  {
28  $moduleMenuViewMock = $this->getAccessibleMock(
29  \TYPO3\CMS\Backend\View\ModuleMenuView::class,
30  ['dummy'],
31  [],
32  '',
33  false
34  );
35 
36  $loadedModulesFixture = [
37  'file' => [],
38  'tools' => [],
39  'web' => [
40  'sub' => [
41  'list' => [],
42  'func' => [],
43  'info' => [],
44  ],
45  ],
46  'user' => [
47  'sub' => [
48  'task' => [],
49  'settings' => [],
50  ],
51  ],
52  ];
53  $moduleMenuViewMock->_set('loadedModules', $loadedModulesFixture);
54 
55  $userTsFixture = [
56  'value' => 'file,help',
57  'properties' => [
58  'web' => 'list,func',
59  'user' => 'task',
60  ],
61  ];
62 
63  $GLOBALS['BE_USER'] = $this->getMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class, [], [], '', false);
64  $GLOBALS['BE_USER']->expects($this->any())->method('getTSConfig')->will($this->returnValue($userTsFixture));
65 
66  $expectedResult = [
67  'tools' => [],
68  'web' => [
69  'sub' => [
70  'info' => [],
71  ],
72  ],
73  'user' => [
74  'sub' => [
75  'settings' => [],
76  ],
77  ],
78  ];
79 
80  $moduleMenuViewMock->_call('unsetHiddenModules');
81  $actualResult = $moduleMenuViewMock->_get('loadedModules');
82  $this->assertSame($expectedResult, $actualResult);
83  }
84 }
getAccessibleMock( $originalClassName, $methods=[], array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']