Skip to content

Commit 1d481fd

Browse files
committed
Merge remote-tracking branch 'api/MAGETWO-53003-Semantic-Versioning' into PR_Branch
2 parents eb0648d + b0ee7e0 commit 1d481fd

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

dev/tests/functional/tests/app/Magento/Upgrade/Test/TestCase/UpgradeSystemTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,20 @@ public function test(
7373
);
7474
$version = $upgrade['upgradeVersion'];
7575

76-
if (preg_match('/^[0-9].[0-9].[0-9]/', $version, $out)) {
76+
$suffix = "( (CE|EE))$";
77+
$normalVersion = '(0|[1-9]\d*)';
78+
$preReleaseVersion = "((0(?!\\d+(\\.|\\+|{$suffix}))|[1-9A-Za-z])[0-9A-Za-z-]*)";
79+
$buildVersion = '([0-9A-Za-z][0-9A-Za-z-]*)';
80+
$versionPattern = "/^{$normalVersion}(\\.{$normalVersion}){2}"
81+
. "(-{$preReleaseVersion}(\\.{$preReleaseVersion})*)?"
82+
. "(\\+{$buildVersion}(\\.{$buildVersion})*)?{$suffix}/";
83+
84+
if (preg_match($versionPattern, $version, $out)) {
7785
$version = array_shift($out);
86+
} else {
87+
$this->fail(
88+
"Provided version format does not comply with semantic versioning specification. Got '{$version}'"
89+
);
7890
}
7991

8092
// Authenticate in admin area

0 commit comments

Comments
 (0)