function it_provides_loaded_configuration_files(FileLocatorInterface $fileLocator, ConfigurationLoaderInterface $loader) { $fileLocator->locateFilesNamed('configurationfile.json')->willReturn(['/cristopher/configurationfile.json', '/richard/configurationfile.json']); $loader->load('/cristopher/configurationfile.json')->willReturn(['name' => 'cristopher/sylius-theme']); $loader->load('/richard/configurationfile.json')->willReturn(['name' => 'richard/sylius-theme']); $this->getConfigurations()->shouldReturn([['name' => 'cristopher/sylius-theme'], ['name' => 'richard/sylius-theme']]); }
function it_processes_the_configuration_and_extracts_extra_sylius_theme_key_as_another_configuration(ConfigurationLoaderInterface $decoratedLoader, ConfigurationProcessorInterface $configurationProcessor) { $basicConfiguration = ['name' => 'example/sylius-theme', 'extra' => ['sylius-theme' => ['name' => 'example/brand-new-sylius-theme']]]; $decoratedLoader->load('theme-configuration-resource')->willReturn($basicConfiguration); $configurationProcessor->process([$basicConfiguration, ['name' => 'example/brand-new-sylius-theme']])->willReturn(['name' => 'example/brand-new-sylius-theme']); $this->load('theme-configuration-resource')->shouldReturn(['name' => 'example/brand-new-sylius-theme']); }
/** * {@inheritdoc} */ public function load($identifier) { $rawConfiguration = $this->decoratedLoader->load($identifier); $configurations = [$rawConfiguration]; if (isset($rawConfiguration['extra']['sylius-theme'])) { $configurations[] = $rawConfiguration['extra']['sylius-theme']; } return $this->configurationProcessor->process($configurations); }
public function it_provides_loaded_configuration_files(FileLocatorInterface $fileLocator, ConfigurationLoaderInterface $loader, ThemeHelperInterface $themeHelper) { $fileLocator->locateFilesNamed('testconfig.json')->willReturn(['/client1/testconfig.json', '/client2/testconfig.json']); $loader->load('/client1/testconfig.json')->willReturn(['name' => 'client1/custom-theme']); $loader->load('/client2/testconfig.json')->willReturn(['name' => 'client2/custom-theme']); $themeHelper->process(['name' => 'client1/custom-theme'])->willReturn(['name' => 'client1/custom-theme@client1']); $themeHelper->process(['name' => 'client2/custom-theme'])->willReturn(['name' => 'client2/custom-theme@client2']); $this->getConfigurations()->shouldReturn([['name' => 'client1/custom-theme@client1'], ['name' => 'client2/custom-theme@client2']]); }