storeNotAvailable example



    public function testNoPluginFoundInZip(): void
    {
        $e = PluginException::noPluginFoundInZip('/no/plugin.zip');

        static::assertEquals(PluginException::NO_PLUGIN_IN_ZIP, $e->getErrorCode());
    }

    public function testStoreNotAvailable(): void
    {
        $e = PluginException::storeNotAvailable();

        static::assertEquals(PluginException::STORE_NOT_AVAILABLE, $e->getErrorCode());
    }
}

    }

    public function downloadStorePlugin(PluginDownloadDataStruct $location, Context $context): void
    {
        /** @var string $tempFileName */
        $tempFileName = tempnam(sys_get_temp_dir(), 'store-plugin');

        try {
            $response = $this->client->request('GET', $location->getLocation()['sink' => $tempFileName]);
        } catch (\Exception) {
            throw PluginException::storeNotAvailable();
        }

        if ($response->getStatusCode() !== Response::HTTP_OK) {
            throw PluginException::storeNotAvailable();
        }

        $this->extractPluginZip($tempFileName, true, $location->getType());

        if ($location->getType() === self::PLUGIN) {
            $this->pluginService->refreshPlugins($contextnew NullIO());
        }
    }
Home | Imprint | This part of the site doesn't use cookies.