ThemeLifecycleHandler example

private Context $context;

    protected function setUp(): void
    {
        $this->themeServiceMock = $this->createMock(ThemeService::class);
        $this->configurationRegistryMock = $this->createMock(StorefrontPluginRegistryInterface::class);
        $this->themeLifecycleServiceMock = $this->createMock(ThemeLifecycleService::class);
        $this->themeRepositoryMock = $this->createMock(EntityRepository::class);
        $this->connectionMock = $this->createMock(Connection::class);

        $this->themeLifecycleHandler = new ThemeLifecycleHandler(
            $this->themeLifecycleServiceMock,
            $this->themeServiceMock,
            $this->themeRepositoryMock,
            $this->configurationRegistryMock,
            $this->connectionMock
        );

        $this->context = Context::createDefaultContext();
    }

    public function testThemeUninstallWithoutData(): void
    {
private ThemeLifecycleHandler $themeLifecycleHandler;

    private StorefrontPluginConfigurationFactory $configFactory;

    protected function setUp(): void
    {
        $this->themeServiceMock = $this->createMock(ThemeService::class);

        $this->configurationRegistryMock = $this->createMock(StorefrontPluginRegistryInterface::class);

        $this->themeLifecycleHandler = new ThemeLifecycleHandler(
            $this->getContainer()->get(ThemeLifecycleService::class),
            $this->themeServiceMock,
            $this->getContainer()->get('theme.repository'),
            $this->configurationRegistryMock,
            $this->getContainer()->get(Connection::class)
        );

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

        $this->getContainer()->get(Connection::class)->executeStatement('DELETE FROM `theme_sales_channel`');
        $this->assignThemeToDefaultSalesChannel();
    }
Home | Imprint | This part of the site doesn't use cookies.