‪TYPO3CMS  10.4
ModuleDataStorageServiceTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23 
27 class ‪ModuleDataStorageServiceTest extends UnitTestCase
28 {
33  {
34  // Simulate empty module data
35  ‪$GLOBALS['BE_USER'] = $this->createMock(BackendUserAuthentication::class);
36  ‪$GLOBALS['BE_USER']->uc = [];
37  ‪$GLOBALS['BE_USER']->uc['moduleData'] = [];
38 
39  $subject = new ‪ModuleDataStorageService();
40  $objectManagerMock = $this->createMock(ObjectManager::class);
41  $moduleDataMock = $this->createMock(ModuleData::class);
42  $objectManagerMock
43  ->expects(self::once())
44  ->method('get')
45  ->with(ModuleData::class)
46  ->willReturn($moduleDataMock);
47  $subject->injectObjectManager($objectManagerMock);
48 
49  self::assertSame($moduleDataMock, $subject->loadModuleData());
50  }
51 }
‪TYPO3\CMS\Beuser\Tests\Unit\Service\ModuleDataStorageServiceTest
Definition: ModuleDataStorageServiceTest.php:28
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Beuser\Tests\Unit\Service\ModuleDataStorageServiceTest\loadModuleDataReturnsModuleDataObjectForEmptyModuleData
‪loadModuleDataReturnsModuleDataObjectForEmptyModuleData()
Definition: ModuleDataStorageServiceTest.php:32
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Beuser\Tests\Unit\Service
Definition: ModuleDataStorageServiceTest.php:16
‪TYPO3\CMS\Extbase\Object\ObjectManager
Definition: ObjectManager.php:28
‪TYPO3\CMS\Beuser\Service\ModuleDataStorageService
Definition: ModuleDataStorageService.php:29
‪TYPO3\CMS\Beuser\Domain\Model\ModuleData
Definition: ModuleData.php:23