Skip to content

Commit

Permalink
Merge pull request #2616 from shopware5/fix/version-format
Browse files Browse the repository at this point in the history
fix: Ensure that the update version is formatted correctly during the update check
  • Loading branch information
Dennis Garding authored Oct 16, 2023
2 parents 7566865 + 41c6ca3 commit a1fa43c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ private function createVersionFromGithubResponse(string $shopwareVersion, array
private function getRelease(string $shopwareVersion, array $releaseInformation): array
{
foreach ($releaseInformation as $release) {
if (version_compare($shopwareVersion, ltrim($release['tag_name'], 'v'), '>=')) {
$release['tag_name'] = ltrim($release['tag_name'], 'v');
if (version_compare($shopwareVersion, $release['tag_name'], '>=')) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function testCheckUpdateReturnsVersionWithNewRelease(): void

$version = $updateChecker->checkUpdate('5.7.13');
static::assertInstanceOf(Version::class, $version);
static::assertSame('v5.7.14', $version->version);
static::assertSame('5.7.14', $version->version);
}

public function testCheckUpdateReturnsVersionWithNewPreRelease(): void
Expand All @@ -151,7 +151,7 @@ public function testCheckUpdateReturnsVersionWithNewPreRelease(): void

$version = $updateChecker->checkUpdate('5.7.13');
static::assertInstanceOf(Version::class, $version);
static::assertSame('v5.7.14', $version->version);
static::assertSame('5.7.14', $version->version);
}

public function testCheckUpdateReturnsVersionOfPreReleaseWithPreRelease(): void
Expand All @@ -168,7 +168,7 @@ public function testCheckUpdateReturnsVersionOfPreReleaseWithPreRelease(): void

$version = $updateChecker->checkUpdate('5.7.13');
static::assertInstanceOf(Version::class, $version);
static::assertSame('v5.7.15', $version->version);
static::assertSame('5.7.15', $version->version);
}

public function testCheckUpdateReturnsVersionOfNormalReleaseWithoutPreRelease(): void
Expand All @@ -185,7 +185,7 @@ public function testCheckUpdateReturnsVersionOfNormalReleaseWithoutPreRelease():

$version = $updateChecker->checkUpdate('5.7.13');
static::assertInstanceOf(Version::class, $version);
static::assertSame('v5.7.14', $version->version);
static::assertSame('5.7.14', $version->version);
}

private function getSingleVersionJson(string $version, bool $prerelease = false): string
Expand Down

0 comments on commit a1fa43c

Please sign in to comment.