Neos\Flow\Tests\Unit\I18n\ServiceTest::initializeCorrectlyGeneratesAvailableLocales PHP Method

initializeCorrectlyGeneratesAvailableLocales() public method

    public function initializeCorrectlyGeneratesAvailableLocales()
    {
        mkdir('vfs://Foo/Bar/Private/Translations', 0777, true);
        foreach (['en', 'sr_Cyrl_RS'] as $localeIdentifier) {
            file_put_contents('vfs://Foo/Bar/Private/foobar.' . $localeIdentifier . '.baz', 'FooBar');
        }
        foreach (['en_GB', 'sr'] as $localeIdentifier) {
            file_put_contents('vfs://Foo/Bar/Private/Translations/' . $localeIdentifier . '.xlf', 'FooBar');
        }
        $mockPackage = $this->createMock(PackageInterface::class);
        $mockPackage->expects($this->any())->method('getResourcesPath')->will($this->returnValue('vfs://Foo/Bar/'));
        $mockPackageManager = $this->createMock(PackageManagerInterface::class);
        $mockPackageManager->expects($this->any())->method('getActivePackages')->will($this->returnValue([$mockPackage]));
        $mockLocaleCollection = $this->createMock(I18n\LocaleCollection::class);
        $mockLocaleCollection->expects($this->exactly(4))->method('addLocale');
        $mockSettings = ['i18n' => ['defaultLocale' => 'sv_SE', 'fallbackRule' => ['strict' => false, 'order' => []], 'scan' => ['includePaths' => ['/Private/' => true], 'excludePatterns' => []]]];
        $mockCache = $this->createMock(VariableFrontend::class);
        $mockCache->expects($this->once())->method('has')->with('availableLocales')->will($this->returnValue(false));
        $service = $this->getAccessibleMock(I18n\Service::class, ['dummy']);
        $service->_set('localeBasePath', 'vfs://Foo/');
        $this->inject($service, 'packageManager', $mockPackageManager);
        $this->inject($service, 'localeCollection', $mockLocaleCollection);
        $service->injectSettings($mockSettings);
        $this->inject($service, 'cache', $mockCache);
        $service->initializeObject();
    }