17 use Prophecy\Argument;
26 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
36 GeneralUtility::purgeInstances();
45 $cacheManagerProphecy = $this->prophesize(CacheManager::class);
46 GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal());
47 $cacheFrontendProphecy = $this->prophesize(FrontendInterface::class);
48 $cacheManagerProphecy->getCache(
'l10n')->willReturn($cacheFrontendProphecy->reveal());
49 $cacheFrontendProphecy->get(Argument::cetera())->willReturn(
false);
50 $cacheFrontendProphecy->set(Argument::cetera())->willReturn(
null);
54 $unique =
'locallangXMLOverrideTest' . substr($this->getUniqueId(), 0, 10);
55 $xml =
'<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
58 <languageKey index="default" type="array">
59 <label index="buttons.logout">EXIT</label>
64 GeneralUtility::writeFileToTypo3tempDir($file, $xml);
65 $this->testFilesToDelete[] = $file;
68 $defaultLL = $subject->getParsedData(
'EXT:core/Resources/Private/Language/locallang_core.xlf',
'default');
71 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'locallangXMLOverride'][
'EXT:core/Resources/Private/Language/locallang_core.xlf'][$unique] = $file;
74 $store = GeneralUtility::makeInstance(LanguageStore::class);
75 $store->flushData(
'EXT:core/Resources/Private/Language/locallang_core.xlf');
78 $overrideLL = $subject->getParsedData(
'EXT:core/Resources/Private/Language/locallang_core.xlf',
'default');
80 $this->assertNotEquals($overrideLL[
'default'][
'buttons.logout'][0][
'target'],
'');
81 $this->assertNotEquals($defaultLL[
'default'][
'buttons.logout'][0][
'target'], $overrideLL[
'default'][
'buttons.logout'][0][
'target']);
82 $this->assertEquals($overrideLL[
'default'][
'buttons.logout'][0][
'target'],
'EXIT');
90 $cacheManagerProphecy = $this->prophesize(CacheManager::class);
91 GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal());
94 $localizationFactory = $this->getAccessibleMock(LocalizationFactory::class, [
'localizationOverride']);
95 $languageStore = $this->getMockBuilder(LanguageStore::class)
96 ->setMethods([
'hasData',
'setConfiguration',
'getData',
'setData'])
98 $cacheInstance = $this->getMockBuilder(VariableFrontend::class)
99 ->setMethods([
'get',
'set'])
100 ->disableOriginalConstructor()
102 $localizationFactory->_set(
'store', $languageStore);
103 $localizationFactory->_set(
'cacheInstance', $cacheInstance);
104 $languageStore->method(
'hasData')->willReturn(
false);
105 $languageStore->method(
'getData')->willReturn([
'default' => []]);
106 $languageStore->method(
'setConfiguration')->willThrowException(
new FileNotFoundException(
'testing', 1476049512));
107 $cacheInstance->method(
'get')->willReturn(
false);
108 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'locallangXMLOverride'] = [
'foo' =>
'bar'];
110 $localizationFactory->expects($this->once())->method(
'localizationOverride');
111 $localizationFactory->getParsedData(
'EXT:backend/Resources/Private/Language/locallang_layout.xlf',
'default');