setIsTheme example

$registeredApps = $this->loadFromListingArray($context$data);

        // Enrich apps from filesystem         $localApps = $this->loadLocalAppsCollection($context);

        foreach ($localApps as $name => $app) {
            if ($registeredApps->has($name)) {
                /** @var ExtensionStruct $registeredApp */
                $registeredApp = $registeredApps->get($name);

                $registeredApp->setIsTheme($app->isTheme());

                // Set version of local app to registered app if newer                 if (version_compare((string) $app->getVersion()(string) $registeredApp->getVersion(), '>')) {
                    $registeredApp->setLatestVersion($app->getVersion());
                }

                continue;
            }

            $registeredApps->set($name$app);
        }

        


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

    public function testThemeUninstallWithoutData(): void
    {
        $themeConfig = new StorefrontPluginConfiguration('SimpleTheme');
        $themeConfig->setStyleFiles(new FileCollection());
        $themeConfig->setScriptFiles(new FileCollection());
        $themeConfig->setName('Simple Theme');
        $themeConfig->setIsTheme(true);

        $collection = new StorefrontPluginConfigurationCollection([
            $themeConfig,
        ]);

        $this->configurationRegistryMock->expects(static::once())->method('getConfigurations')->willReturn(
            $collection
        );

        $this->themeRepositoryMock->expects(static::never())->method('upsert');

        
$container = $this->createMock(ContainerInterface::class);
        $container->method('has')->with(StorefrontPluginRegistry::class)->willReturn($withThemeRegistry);
        $themeLoader = null;
        $this->connection->expects(static::once())->method('fetchOne')->willReturn($fetchLocaleResult);

        if ($withThemeRegistry) {
            $plugins = new StorefrontPluginConfigurationCollection();

            foreach (['Storefront', 'SwagTheme'] as $technicalName) {
                $theme = new StorefrontPluginConfiguration($technicalName);
                $theme->setIsTheme(true);
                $plugins->add($theme);
            }

            $themeRegistry = $this->createMock(StorefrontPluginRegistry::class);
            $themeRegistry->expects(static::once())->method('getConfigurations')->willReturn($plugins);
            $container->expects(static::exactly(1))->method('get')->with(StorefrontPluginRegistry::class)->willReturn($themeRegistry);
        }

        if ($salesChannelId !== null) {
            $themeLoader = $this->createMock(SalesChannelThemeLoader::class);
            $themeLoader->expects(static::once())->method('load')->with($salesChannelId)->willReturn([
                
$pathname = $path . \DIRECTORY_SEPARATOR . 'Resources/theme.json';

            $basePath = realpath(pathinfo($pathname, \PATHINFO_DIRNAME)) ?: $pathname;

            $basePath = $this->stripProjectDir($basePath);

            $config = new StorefrontPluginConfiguration($name);

            $config->setThemeJson($data);
            $config->setBasePath($this->stripProjectDir($basePath));
            $config->setStorefrontEntryFilepath($this->getEntryFile($path));
            $config->setIsTheme(true);
            $config->setName($data['name']);
            $config->setAuthor($data['author']);

            if (\array_key_exists('style', $data) && \is_array($data['style'])) {
                $this->resolveStyleFiles($data['style']$basePath$config);
            }

            if (\array_key_exists('script', $data) && \is_array($data['script'])) {
                $fileCollection = FileCollection::createFromArray($data['script']);
                $config->setScriptFiles($this->addBasePathToCollection($fileCollection$basePath));
            }

            
try {
            $storeExtensions = $this->client->listMyExtensions($localCollection$context);
        } catch (\Throwable) {
            return;
        }

        foreach ($storeExtensions->getElements() as $storeExtension) {
            if ($localCollection->has($storeExtension->getName())) {
                /** @var ExtensionStruct $localExtension */
                $localExtension = $localCollection->get($storeExtension->getName());
                $localExtension->setId($storeExtension->getId());
                $localExtension->setIsTheme($storeExtension->isTheme());
                $localExtension->setStoreExtension($storeExtension);

                $localExtension->setStoreLicense($storeExtension->getStoreLicense());
                $localExtension->setNotices($storeExtension->getNotices());

                if ($storeExtension->getDescription()) {
                    $localExtension->setDescription($storeExtension->getDescription());
                }

                if ($storeExtension->getShortDescription()) {
                    $localExtension->setShortDescription($storeExtension->getShortDescription());
                }
Home | Imprint | This part of the site doesn't use cookies.