From a1d1e977c5912bcc5ed4a9a46901c523da1e7bbe Mon Sep 17 00:00:00 2001 From: Thomas Portelange Date: Mon, 26 Feb 2024 10:13:34 +0100 Subject: [PATCH] use composer/semver --- tests/php/Core/Manifest/VersionProviderTest.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/php/Core/Manifest/VersionProviderTest.php b/tests/php/Core/Manifest/VersionProviderTest.php index b3155424d..f5a9ea34a 100644 --- a/tests/php/Core/Manifest/VersionProviderTest.php +++ b/tests/php/Core/Manifest/VersionProviderTest.php @@ -3,15 +3,15 @@ namespace SilverStripe\Core\Tests\Manifest; use SebastianBergmann\Version; +use Composer\Semver\Comparator; use SilverStripe\Dev\SapphireTest; +use Psr\SimpleCache\CacheInterface; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Manifest\VersionProvider; class VersionProviderTest extends SapphireTest { - const SEMVER_REGEX = '(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-(0|[1-9A-Za-z-][0-9A-Za-z-]*)(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?'; - /** * @var VersionProvider */ @@ -92,10 +92,9 @@ class VersionProviderTest extends SapphireTest Config::modify()->set(VersionProvider::class, 'modules', [ 'silverstripe/framework' => 'Framework', ]); - $this->assertMatchesRegularExpression('/' . self::SEMVER_REGEX . '/', $provider->getModuleVersion('silverstripe/framework')); + $this->assertTrue(Comparator::greaterThan($provider->getModuleVersion('silverstripe/framework'), '5.0.0')); $result = $provider->getVersion(); $this->assertStringNotContainsString('Framework: 1.2.3', $result); - $this->assertMatchesRegularExpression('/Framework: ' . self::SEMVER_REGEX . '/', $result); } private function clearCache()