use VersionParser instead of comparator

This commit is contained in:
Thomas Portelange 2024-02-26 11:44:11 +01:00 committed by GitHub
parent 80e197fe4f
commit a06ce0493a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Core\Tests\Manifest; namespace SilverStripe\Core\Tests\Manifest;
use SebastianBergmann\Version; use SebastianBergmann\Version;
use Composer\Semver\Comparator; use Composer\Semver\VersionParser;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use Psr\SimpleCache\CacheInterface; use Psr\SimpleCache\CacheInterface;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
@ -93,7 +93,8 @@ class VersionProviderTest extends SapphireTest
'silverstripe/framework' => 'Framework', 'silverstripe/framework' => 'Framework',
]); ]);
$moduleVersion = $provider->getModuleVersion('silverstripe/framework'); $moduleVersion = $provider->getModuleVersion('silverstripe/framework');
$this->assertTrue(Comparator::greaterThanOrEqualTo($moduleVersion, '5.0.0'), "Expected > 5.0.0 but got $moduleVersion"); $parser = new VersionParser();
$this->assertIsString($parser->normalize($moduleVersion), "Expected a valid semver but got $moduleVersion");
$result = $provider->getVersion(); $result = $provider->getVersion();
$this->assertStringNotContainsString('Framework: 1.2.3', $result); $this->assertStringNotContainsString('Framework: 1.2.3', $result);
} }