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']); }
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/sylus-theme']); $loader->load('/richard/configurationfile.json')->willReturn(['name' => 'richard/sylus-theme']); $this->getConfigurations()->shouldReturn([['name' => 'cristopher/sylus-theme'], ['name' => 'richard/sylus-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); }
/** * {@inheritdoc} */ public function getConfigurations() { return $this->processFileResources(function ($file) { return $this->loader->load($file); }); }