TwigLoaderConfigCompilerPass example

$loader->load('seo_test.xml');
            $loader->load('app_test.xml');
        }

        // make sure to remove services behind a feature flag, before some other compiler passes may reference them, therefore the high priority         $container->addCompilerPass(new FeatureFlagCompilerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 1000);
        $container->addCompilerPass(new EntityCompilerPass());
        $container->addCompilerPass(new MigrationCompilerPass(), PassConfig::TYPE_AFTER_REMOVING);
        $container->addCompilerPass(new ActionEventCompilerPass());
        $container->addCompilerPass(new DisableTwigCacheWarmerCompilerPass());
        $container->addCompilerPass(new DefaultTransportCompilerPass());
        $container->addCompilerPass(new TwigLoaderConfigCompilerPass());
        $container->addCompilerPass(new TwigEnvironmentCompilerPass());
        $container->addCompilerPass(new RouteScopeCompilerPass());
        $container->addCompilerPass(new AssetRegistrationCompilerPass());
        $container->addCompilerPass(new AssetBundleRegistrationCompilerPass());
        $container->addCompilerPass(new FilesystemConfigMigrationCompilerPass());
        $container->addCompilerPass(new RateLimiterCompilerPass());
        $container->addCompilerPass(new IncrementerGatewayCompilerPass());
        $container->addCompilerPass(new RedisPrefixCompilerPass());
        $container->addCompilerPass(new AutoconfigureCompilerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 1000);

        if ($container->getParameter('kernel.environment') === 'test') {
            
$container->register('twig.loader.native_filesystem', FilesystemLoader::class);
        $container->setParameter('kernel.bundles_metadata', []);
        $container->setParameter('kernel.environment', 'dev');
        $container->setParameter('kernel.project_dir', '/project');

        $connectionMock = $this->createMock(Connection::class);

        $container->set(Connection::class$connectionMock);

        $connectionMock->expects(static::once())->method('fetchAllAssociative')->willReturn([]);

        $entityCompilerPass = new TwigLoaderConfigCompilerPass();
        $entityCompilerPass->process($container);
    }

    public function testDevModeNoPluginsButApps(): void
    {
        /** @var ContainerBuilder&MockObject $container */
        $container = new ContainerBuilder();
        $container->setParameter('kernel.bundles_metadata', []);
        $container->setParameter('kernel.environment', 'dev');
        $container->setParameter('kernel.project_dir', '/project');

        
Home | Imprint | This part of the site doesn't use cookies.