resolveActiveDependants example

$basePluginPath = __DIR__ . '/_fixture/SwagRequirementValidTest';
        $dependentPluginPath = __DIR__ . '/_fixture/SwagRequirementValidTestExtension';

        $basePlugin = $this->createPlugin(str_replace($this->projectDir, '', $basePluginPath));
        $dependentPlugin = $this->createPlugin(str_replace($this->projectDir, '', $dependentPluginPath));

        $basePlugin->setActive(true);
        $dependentPlugin->setActive(true);
        $basePlugin->setComposerName('swag/requirement-valid-test');
        $dependentPlugin->setComposerName('swag/requirement-valid-test-extension');

        $dependants = $this->createValidator()->resolveActiveDependants($dependentPlugin[$basePlugin$dependentPlugin]);

        static::assertEmpty($dependants);

        $dependants = $this->createValidator()->resolveActiveDependants($basePlugin[$basePlugin$dependentPlugin]);

        static::assertCount(1, $dependants);

        $dependentPlugin->setActive(false);

        $dependants = $this->createValidator()->resolveActiveDependants($basePlugin[$basePlugin$dependentPlugin]);

        

        if ($plugin->getInstalledAt() === null) {
            throw new PluginNotInstalledException($plugin->getName());
        }

        if ($plugin->getActive() === false) {
            throw new PluginNotActivatedException($plugin->getName());
        }

        $dependantPlugins = $this->getEntities($this->pluginCollection->all()$shopwareContext)->getEntities()->getElements();

        $dependants = $this->requirementValidator->resolveActiveDependants(
            $plugin,
            $dependantPlugins
        );

        if (\count($dependants) > 0) {
            throw new PluginHasActiveDependantsException($plugin->getName()$dependants);
        }

        $pluginBaseClassString = $plugin->getBaseClass();
        $pluginBaseClass = $this->getPluginInstance($pluginBaseClassString);

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