‪TYPO3CMS  10.4
LocalizationFactoryTest.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 
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24 
28 class ‪LocalizationFactoryTest extends UnitTestCase
29 {
34  {
35  $languageStore = $this->getMockBuilder(LanguageStore::class)
36  ->onlyMethods(['hasData', 'setConfiguration', 'getData', 'setData'])
37  ->getMock();
38  $cacheInstance = $this->getMockBuilder(VariableFrontend::class)
39  ->onlyMethods(['get', 'set'])
40  ->disableOriginalConstructor()
41  ->getMock();
42 
43  $languageStore->method('hasData')->willReturn(false);
44  $languageStore->method('getData')->willReturn(['default' => []]);
45  $languageStore->method('setConfiguration')->willThrowException(new ‪FileNotFoundException('testing', 1476049512));
46  $cacheInstance->method('get')->willReturn(false);
47  $cacheManagerProphecy = $this->prophesize(CacheManager::class);
48  $cacheManagerProphecy->getCache('l10n')->willReturn($cacheInstance);
49 
51  $localizationFactory = $this->getAccessibleMock(LocalizationFactory::class, ['localizationOverride'], [$languageStore, $cacheManagerProphecy->reveal()]);
52  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'] = ['foo' => 'bar'];
53 
54  $localizationFactory->getParsedData('EXT:backend/Resources/Private/Language/locallang_layout.xlf', 'default');
55  }
56 }
‪TYPO3\CMS\Core\Localization\LocalizationFactory
Definition: LocalizationFactory.php:28
‪TYPO3\CMS\Core\Localization\Exception\FileNotFoundException
Definition: FileNotFoundException.php:22
‪TYPO3\CMS\Core\Tests\Unit\Localization\LocalizationFactoryTest\getParsedDataCallsLocalizationOverrideIfFileNotFoundExceptionIsThrown
‪getParsedDataCallsLocalizationOverrideIfFileNotFoundExceptionIsThrown()
Definition: LocalizationFactoryTest.php:33
‪TYPO3\CMS\Core\Tests\Unit\Localization\LocalizationFactoryTest
Definition: LocalizationFactoryTest.php:29
‪TYPO3\CMS\Core\Localization\LanguageStore
Definition: LanguageStore.php:27
‪TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
Definition: VariableFrontend.php:25
‪TYPO3\CMS\Core\Cache\CacheManager
Definition: CacheManager.php:35
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Tests\Unit\Localization
Definition: LocalesTest.php:16