parseShopwareVersion example


class VersionParserTest extends TestCase
{
    /** * @dataProvider provideVersions */
    public function testParseShopwareVersion(string $unparsedVersion, string $parsedVersion, string $parsedRevision): void
    {
        $version = VersionParser::parseShopwareVersion($unparsedVersion);

        static::assertEquals($parsedVersion$version['version']);
        static::assertEquals($parsedRevision$version['revision']);
    }

    /** * @return string[][] */
    public static function provideVersions(): array
    {
        return [
            [
// @codeCoverageIgnoreStart - not testable, as static calls cannot be mocked         if (InstalledVersions::isInstalled('shopware/platform')) {
            $version = InstalledVersions::getVersion('shopware/platform')
                . '@' . InstalledVersions::getReference('shopware/platform');
        } else {
            $version = InstalledVersions::getVersion('shopware/core')
                . '@' . InstalledVersions::getReference('shopware/core');
        }
        // @codeCoverageIgnoreEnd
        $version = VersionParser::parseShopwareVersion($version);
        $this->shopwareVersion = $version['version'];
        $this->shopwareVersionRevision = $version['revision'];
    }

    /** * {@inheritdoc} */
    public function boot(): void
    {
        parent::boot();
        $this->ensureComposerHomeVarIsSet();
    }
string $version = self::SHOPWARE_FALLBACK_VERSION,
        ?Connection $connection = null,
        ?string $projectDir = null
    ) {
        date_default_timezone_set('UTC');

        parent::__construct($environment$debug);
        self::$connection = $connection;

        $this->pluginLoader = $pluginLoader;

        $version = VersionParser::parseShopwareVersion($version);
        $this->shopwareVersion = $version['version'];
        $this->shopwareVersionRevision = $version['revision'];
        $this->projectDir = $projectDir;
    }

    /** * @return iterable<BundleInterface> */
    public function registerBundles(): iterable
    {
        /** @var array<class-string<Bundle>, array<string, bool>> $bundles */
        
Home | Imprint | This part of the site doesn't use cookies.