Storefront example


        $this->themeRegistryMock = $this->createMock(StorefrontPluginRegistry::class);

        $this->builder = new ThemeInheritanceBuilder($this->themeRegistryMock);

        $this->configFactory = $this->getContainer()->get(StorefrontPluginConfigurationFactory::class);
    }

    public function testInheritanceWithConfig(): void
    {
        $configs = new StorefrontPluginConfigurationCollection([
            $this->configFactory->createFromBundle(new Storefront()),
            $this->configFactory->createFromBundle(new InheritanceWithConfig()),
        ]);

        $this->themeRegistryMock->method('getConfigurations')
            ->willReturn($configs);

        $inheritance = $this->builder->build(
            ['InheritanceWithConfig' => 1, 'Storefront' => 1],
            ['InheritanceWithConfig' => true, 'Storefront' => true]
        );

        
$this->themeServiceMock->expects(static::once())
            ->method('compileTheme')
            ->with(
                TestDefaults::SALES_CHANNEL,
                static::isType('string'),
                static::isInstanceOf(Context::class),
                static::callback(fn (StorefrontPluginConfigurationCollection $configs): bool => $configs->count() === 2)
            );

        $configs = new StorefrontPluginConfigurationCollection([
            $this->configFactory->createFromBundle(new Storefront()),
            $installConfig,
        ]);

        $this->themeLifecycleHandler->handleThemeInstallOrUpdate($installConfig$configs, Context::createDefaultContext());
    }

    public function testHandleThemeInstallOrUpdateWithInheritance(): void
    {
        $installConfig = $this->configFactory->createFromBundle(new InheritanceWithConfig());

        $configs = new StorefrontPluginConfigurationCollection([
            
Home | Imprint | This part of the site doesn't use cookies.