getExtensionsToDeactivate example

private readonly AbstractExtensionLifecycle $extensionLifecycleService,
        private readonly SystemConfigService $systemConfigService,
        private readonly Context $context
    ) {
    }

    /** * Remove one plugin per run call, as this action can take some time we make a new request for each plugin */
    public function run(int $offset): ValidResult
    {
        $extensions = $this->pluginCompatibility->getExtensionsToDeactivate($this->toVersion, $this->context, $this->deactivationFilter);

        $extensionCount = \count($extensions);
        if ($extensionCount === 0) {
            return new ValidResult($offset$offset);
        }

        $extension = $extensions[0];
        ++$offset;
        $this->extensionLifecycleService->deactivate($extension->getType()$extension->getName()$this->context);

        $deactivatedPlugins = (array) $this->systemConfigService->get(self::UPDATE_DEACTIVATED_PLUGINS) ?: [];
        
static::expectException(ClientException::class);
        $pluginCompatibility->getExtensionCompatibilities(new Version(), Context::createDefaultContext());
    }

    public function testExtensionsToDeactivateNoFilter(): void
    {
        $pluginCompatibility = new ExtensionCompatibility(
            $this->getStoreClient(),
            $this->getExtensionDataProvider()
        );

        static::assertEmpty($pluginCompatibility->getExtensionsToDeactivate(new Version(), Context::createDefaultContext(), ExtensionCompatibility::PLUGIN_DEACTIVATION_FILTER_NONE));
    }

    public function testExtensionsToDeactivateAll(): void
    {
        $pluginCompatibility = new ExtensionCompatibility(
            $this->getStoreClient(),
            $this->getExtensionDataProvider()
        );

        $extensionStructs = $pluginCompatibility->getExtensionsToDeactivate(new Version(), Context::createDefaultContext(), ExtensionCompatibility::PLUGIN_DEACTIVATION_FILTER_ALL);

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