Symfony编译容器测试

时间:2018-06-09 14:58:29

标签: symfony phpunit

我用测试有问题,也许有人可以解释一下测试哪些功能?

它是来自symfony文档Compiling the Container

的编译容器
public static function create($filename, $isDebug = false)
{
    $containerConfigCache = new ConfigCache($filename, $isDebug);

    if (!$containerConfigCache->isFresh()) {
        $containerBuilder = new ContainerBuilder();
        $extension = new NfqParkingExtension();
        $containerBuilder->registerExtension($extension);
        $containerBuilder->loadFromExtension($extension->getAlias());
        $containerBuilder->compile();

        $dumper = new PhpDumper($containerBuilder);
        $containerConfigCache->write(
            $dumper->dump(['class' => 'testContainer']),
            $containerBuilder->getResources()
        );
    }

    require_once $filename;

    return new testContainer();
}

0 个答案:

没有答案