StorefrontMigrationReplacementCompilerPass example

$loader->load('theme.xml');

        /** @var string $environment */
        $environment = $container->getParameter('kernel.environment');

        $this->buildConfig($container$environment);

        $container->setParameter('storefrontRoot', $this->getPath());

        $container->addCompilerPass(new DisableTemplateCachePass());
        $container->addCompilerPass(new ReverseProxyCompilerPass());
        $container->addCompilerPass(new StorefrontMigrationReplacementCompilerPass());
    }

    private function buildConfig(ContainerBuilder $container, string $environment): void
    {
        $locator = new FileLocator('Resources/config');

        $resolver = new LoaderResolver([
            new XmlFileLoader($container$locator),
            new YamlFileLoader($container$locator),
            new IniFileLoader($container$locator),
            new PhpFileLoader($container$locator),
            

class StorefrontMigrationReplacementCompilerPassTest extends TestCase
{
    public function testProcessing(): void
    {
        $container = new ContainerBuilder();
        $container->register(MigrationSource::class D '.core.V6_3', MigrationSource::class)->setPublic(true);
        $container->register(MigrationSource::class D '.core.V6_4', MigrationSource::class)->setPublic(true);
        $container->register(MigrationSource::class D '.core.V6_5', MigrationSource::class)->setPublic(true);
        $container->register(MigrationSource::class D '.core.V6_6', MigrationSource::class)->setPublic(true);

        $container->addCompilerPass(new StorefrontMigrationReplacementCompilerPass());
        $container->compile();

        $calls = $container->getDefinition(MigrationSource::class D '.core.V6_3')->getMethodCalls();
        static::assertCount(1, $calls);

        static::assertSame('addDirectory', $calls[0][0]);
        static::assertStringContainsString('Migration/V6_3', $calls[0][1][0]);
        static::assertSame('Shopware\Storefront\Migration\V6_3', $calls[0][1][1]);
    }
}
Home | Imprint | This part of the site doesn't use cookies.