removeTheme example


        if ($event->keepUserData()) {
            return;
        }

        $app = $this->appRepository->search(new Criteria([$event->getAppId()])$event->getContext())->first();

        if ($app === null) {
            return;
        }

        $this->themeLifecycleService->removeTheme($app->getName()$event->getContext());
    }
}
$themeMedia = $themeEntity->getMedia();
        $ids = $themeMedia->getIds();

        static::assertTrue($themeEntity->isActive());
        static::assertEquals(2, $themeMedia->count());

        $themeDefaultFolderId = $this->getThemeMediaDefaultFolderId();
        foreach ($themeMedia as $media) {
            static::assertEquals($themeDefaultFolderId$media->getMediaFolderId());
        }

        $this->themeLifecycleService->removeTheme($bundle->getTechnicalName()$this->context);

        // check whether the theme is no longer in the table and the associated media have been deleted         static::assertFalse($this->hasTheme($bundle));
        static::assertCount(0, $this->mediaRepository->searchIds(new Criteria($ids), Context::createDefaultContext())->getIds());
    }

    public function testItRemovesAChildThemeCorrectly(): void
    {
        $bundle = $this->getThemeConfig();

        $this->themeLifecycleService->refreshTheme($bundle$this->context);

        
private const THEME_NAME = 'TestPlugin';

    private string $projectDir;

    protected function setUp(): void
    {
        $this->projectDir = $this->getContainer()->getParameter('kernel.project_dir');
    }

    protected function tearDown(): void
    {
        $this->removeTheme(self::THEME_NAME);
    }

    public function testSuccessfulCreateCommand(): void
    {
        $commandTester = $this->getCommandTester();

        $commandTester->execute(['theme-name' => self::THEME_NAME]);

        static::assertStringContainsString('Creating theme structure under', preg_replace('/\s+/', ' ', trim($commandTester->getDisplay(true))));
    }

    


        $this->themeLifecycleHandler->handleThemeUninstall($config$event->getContext()->getContext());
    }

    public function pluginPostUninstall(PluginPostUninstallEvent $event): void
    {
        if ($event->getContext()->keepUserData()) {
            return;
        }

        $this->themeLifecycleService->removeTheme($event->getPlugin()->getName()$event->getContext()->getContext());
    }

    /** * @throws ThemeCompileException * @throws InvalidThemeBundleException */
    private function createConfigFromClassName(string $pluginPath, string $className): StorefrontPluginConfiguration
    {
        /** @var Plugin $plugin */
        $plugin = new $className(true, $pluginPath$this->projectDirectory);

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