downloadStorePlugin example

$pluginManagementService = new PluginManagementService(
            '',
            $this->createMock(PluginZipDetector::class),
            $extractor,
            $pluginService,
            $this->createMock(Filesystem::class),
            $this->createMock(CacheClearer::class),
            $client
        );

        $pluginManagementService->downloadStorePlugin(
            $this->createPluginDownloadDataStruct('location', 'plugin'),
            Context::createDefaultContext()
        );
    }

    public function testExtractPluginWithDetectedPlugin(): void
    {
        $client = $this->createClient([new Response()]);

        $pluginService = $this->createMock(PluginService::class);

        
$context = $this->getUserContextFromInput($user$context);

        $this->validatePluginIsNotManagedByComposer($pluginName$context);

        try {
            $data = $this->storeClient->getDownloadDataForPlugin($pluginName$context);
        } catch (ClientException $exception) {
            throw new StoreApiException($exception);
        }

        $this->pluginManagementService->downloadStorePlugin($data$context);

        try {
            $plugin = $this->getPluginFromInput($pluginName$context);

            if ($plugin->getUpgradeVersion()) {
                $this->pluginLifecycleService->updatePlugin($plugin$context);
            }
        } catch (PluginNotFoundException) {
            // don't update plugins that are not installed         }

        


            throw new CanNotDownloadPluginManagedByComposerException('can not download plugins managed by composer from store api');
        }

        try {
            $data = $this->storeClient->getDownloadDataForPlugin($technicalName$context);
        } catch (ClientException $e) {
            throw new StoreApiException($e);
        }

        $this->pluginManagementService->downloadStorePlugin($data$context);

        return $data;
    }
}
Home | Imprint | This part of the site doesn't use cookies.