function let(Loader $loader, ContainerLoader $containerLoader, Filesystem $filesystem, Configuration $configuration) { $configuration->getServicesFormat()->willReturn('xml'); $configuration->getServicesFolders()->willReturn([]); $configuration->getContainerFilePath()->willReturn($this->containerFile); $configuration->getCompilerPasses()->willReturn([]); $this->beConstructedWith($loader, $containerLoader, $filesystem); }
function let(MageApp $app, Configuration $generatorConfig, StoreConfigCompilerPass $configCompilerPass, InjectableCompilerPass $injectableCompilerPass) { $generatorConfig->getContainerFilePath()->willReturn('container.php'); $generatorConfig->getDebug()->willReturn(true); $generatorConfig->getServicesFolders()->willReturn(['app/etc']); $generatorConfig->getServicesFormat()->willReturn('xml'); $generatorConfig->getCompilerPasses()->willReturn([]); $generatorConfig->isTestEnvironment()->willReturn(false); $services = ['app' => $app, 'generatorConfig' => $generatorConfig, 'storeConfigCompilerPass' => $configCompilerPass, 'injectableCompilerPass' => $injectableCompilerPass]; $this->beConstructedWith($services); }
function let(Configuration $generatorConfig) { $generatorConfig->getContainerFilePath()->willReturn('container.php'); $generatorConfig->getDebug()->willReturn(true); $generatorConfig->getServicesFolders()->willReturn(['app/etc']); $generatorConfig->getServicesFormat()->willReturn('xml'); $generatorConfig->getCompilerPasses()->willReturn([]); $generatorConfig->isTestEnvironment()->willReturn(false); $services = ['generatorConfig' => $generatorConfig]; $this->beConstructedWith($services); }
/** * @param Configuration $configuration * * @return Container */ public function build(Configuration $configuration) { $containerFilePath = $configuration->getContainerFilePath(); $containerHasBeenBuilt = $this->filesystem->exists($containerFilePath); $isDebug = $configuration->getDebug(); if ($isDebug) { $container = $this->compile($configuration); } else { if ($containerHasBeenBuilt) { $container = $this->containerLoader->loadFrom($containerFilePath); } else { $container = $this->compile($configuration); $this->filesystem->dump($container); } } return $container; }
/** * @return Container */ private function buildContainer() { $containerConfigCache = new ConfigCache($this->configuration->getContainerFilePath(), $this->configuration->getDebug()); $builder = new Builder(new ConfigurationLoader(new SymfonyContainerBuilder(), new DelegatingLoaderFactory(), new SymfonyFilesystem()), new ContainerLoader(), new Filesystem(new SymfonyFilesystem(), new ContainerDumperFactory(), $containerConfigCache)); return $builder->build($this->configuration); }