Merge pull request #11166 from creative-commoners/pulls/5/check-exists

MNT Ensure composer/semver installed or skip test
This commit is contained in:
Guy Sartorelli 2024-03-04 15:27:13 +13:00 committed by GitHub
commit 054c2389c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,7 +65,7 @@ class VersionProviderTest extends SapphireTest
public function testGetModuleVersionFromComposer()
{
Config::modify()->set(VersionProvider::class, 'modules', [
'silverstripe/siteconfig' => 'SiteConfig',
'silverstripe/config' => 'Config',
'silverstripe/framework' => 'Framework',
]);
@ -77,17 +77,20 @@ class VersionProviderTest extends SapphireTest
public function testGetVersion()
{
Config::modify()->set(VersionProvider::class, 'modules', [
'silverstripe/siteconfig' => 'SiteConfig',
'silverstripe/config' => 'Config',
'silverstripe/framework' => 'Framework'
]);
$result = $this->getProvider()->getVersion();
$this->assertStringNotContainsString('SiteConfig: ', $result);
$this->assertStringNotContainsString('Config: ', $result);
$this->assertStringContainsString('Framework: ', $result);
$this->assertStringNotContainsString(', ', $result);
}
public function testGetModuleVersion()
{
if (!class_exists(VersionParser::class)) {
$this->markTestSkipped('This test requires composer/semver to be installed');
}
$provider = $this->getProvider();
Config::modify()->set(VersionProvider::class, 'modules', [
'silverstripe/framework' => 'Framework',