/** * @param SymfonyBuilder $container * @param ContainerConfiguration $config */ private function loadFiles(SymfonyBuilder $container, ContainerConfiguration $config, Generator $generator) { $loader = $generator->getLoader($container, $config->getPaths()); foreach ($config->getFiles() as $file) { $loader->load($file); } }
/** * @test * * @covers Lcobucci\DependencyInjection\Generator::__construct * @covers Lcobucci\DependencyInjection\Generator::generate * @covers Lcobucci\DependencyInjection\Generator::loadContainer */ public function generateShouldCompileAndLoadTheContainer() { vfsStream::setup('tests', null, ['container.php' => '<?php class Test extends \\Symfony\\Component\\DependencyInjection\\Container {}']); $config = $this->createConfiguration('Test'); $dump = $this->createDump(vfsStream::url('tests/container.php')); $container = $this->generator->generate($config, $dump); $this->assertInstanceOf(ContainerInterface::class, $container); }
/** * @test * * @covers Lcobucci\DependencyInjection\ContainerBuilder::__construct * @covers Lcobucci\DependencyInjection\ContainerBuilder::setDefaultConfiguration * @covers Lcobucci\DependencyInjection\ContainerBuilder::createDumpCache * @covers Lcobucci\DependencyInjection\ContainerBuilder::getContainer */ public function getContainerShouldGenerateAndReturnTheContainer() { $builder = new ContainerBuilder($this->config, $this->generator, $this->parameterBag); $container = $this->getMock(ContainerInterface::class); $this->generator->expects($this->once())->method('generate')->with($this->config, $this->isInstanceOf(ConfigCache::class))->willReturn($container); $this->assertSame($container, $builder->getContainer()); }
/** * {@inheritdoc} */ public function getContainer() { return $this->generator->generate($this->config, $this->createDumpCache()); }