Exemplo n.º 1
0
/**
 * @return \ProjectServiceContainer|\Symfony\Component\DependencyInjection\Container
 */
function symfonyFromConfig($config)
{
    $file = TEMP_DIR . '/container.php';
    $container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
    $container->addCompilerPass(new \Symfony\Component\DependencyInjection\Compiler\AutowirePass());
    $loader = new \Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \Symfony\Component\Config\FileLocator(TEMP_DIR));
    $loader->load(asfile('config.yml', $config));
    $container->compile();
    $dumper = new \Symfony\Component\DependencyInjection\Dumper\PhpDumper($container);
    file_put_contents($file, $dumper->dump());
    require_once $file;
    return new ProjectServiceContainer();
}
 /**
  * @param Symfony\Component\DependencyInjection\ContainerBuilder $container
  */
 public function it_add_complier_pass_during_build($container)
 {
     $container->addCompilerPass(Argument::type('Fabricius\\Bundle\\FabriciusBundle\\DependencyInjection\\Compiler\\AddFormatHandlerPass'))->shouldBeCalled();
     $container->addCompilerPass(Argument::type('Fabricius\\Bundle\\FabriciusBundle\\DependencyInjection\\Compiler\\AddListenerPass'))->shouldBeCalled();
     $this->build($container);
 }