getComposerName example



    public function testValidateConflictsSpecificMessage(): void
    {
        $path = __DIR__ . '/_fixture/SwagTestValidateConflictsSpecificMessage';
        $path = str_replace($this->projectDir, '', $path);

        $plugin = $this->createPlugin($path);

        $regexTemplate = '#.*"%s" conflicts with plugin/package "%s == 6\.[0-9]+\.[0-9]+\.[0-9]+.*#im';

        static::assertIsString($plugin->getComposerName());
        $this->expectExceptionMessageMatches(sprintf(
            $regexTemplate,
            preg_quote($plugin->getComposerName(), '#'),
            preg_quote('shopware/core', '#')
        ));
        $this->createValidator()->validateRequirements($plugin, Context::createDefaultContext(), 'test');
    }

    private function createValidator(): RequirementsValidator
    {
        $pluginRepo = $this->createMock(EntityRepository::class);
        
$installDate = new \DateTime();
            $pluginData['installedAt'] = $installDate->format(Defaults::STORAGE_DATE_TIME_FORMAT);
            $plugin->setInstalledAt($installDate);

            $this->updatePluginData($pluginData$shopwareContext);

            $pluginBaseClass->postInstall($installContext);

            $this->eventDispatcher->dispatch(new PluginPostInstallEvent($plugin$installContext));
        } catch (\Throwable $e) {
            if ($didRunComposerRequire && $plugin->getComposerName()) {
                $this->executor->remove($plugin->getComposerName()$plugin->getName());
            }

            throw $e;
        }

        return $installContext;
    }

    /** * @throws PluginNotInstalledException */

    }

    /** * dependsOn determines, whether a given plugin depends on another one. * * @param PluginEntity $plugin the plugin to be checked * @param PluginEntity $dependency the potential dependency */
    private function dependsOn(PluginEntity $plugin, PluginEntity $dependency): bool
    {
        $composerName = $dependency->getComposerName();
        if (!\is_string($composerName)) {
            return false;
        }

        if (\array_key_exists($composerName$this->getPluginDependencies($plugin)['require'])) {
            return true;
        }

        return false;
    }

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