function it_loads_an_existing_container_if_cache_is_fresh(ContainerBuilder $containerBuilder, ContainerLoader $containerLoader, Filesystem $filesystem, Configuration $configuration, Loader $loader) { $filesystem->isCacheFresh()->willReturn(true); $filesystem->dump(Argument::any())->shouldNotBeCalled(); $loader->loadContainer(Argument::any())->shouldNotBeCalled(); $this->build($configuration)->shouldReturn($containerBuilder); }
/** * @param Configuration $configuration * * @return Container */ private function compile(Configuration $configuration) { $container = $this->loader->loadContainer($configuration); foreach ($configuration->getCompilerPasses() as $compilerPass) { $container->addCompilerPass($compilerPass); } $container->compile(); return $container; }
function it_builds_and_caches_a_new_container_if_none_exists_yet_when_not_in_debug_mode(Loader $loader, ContainerLoader $containerLoader, ContainerBuilder $containerBuilder, Filesystem $filesystem, Configuration $configuration) { $configuration->getDebug()->willReturn(false); $filesystem->exists(Argument::any())->willReturn(false); $loader->loadContainer($configuration)->willReturn($containerBuilder); $containerBuilder->compile()->shouldBeCalled(); $filesystem->dump($containerBuilder)->shouldBeCalled(); $containerLoader->loadFrom(Argument::any())->shouldNotBeCalled(); $this->build($configuration)->shouldReturn($containerBuilder); }