Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ensure that the update version is formatted correctly during the update check #2616

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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