Added unit tests for config condition if PHP extension is loaded

This commit is contained in:
UndefinedOffset 2019-07-03 10:32:41 -03:00
parent 571a4d9ace
commit e3aa0ff63a
2 changed files with 45 additions and 0 deletions

View File

@ -225,4 +225,21 @@ class ConfigManifestTest extends SapphireTest
'Fragment is included if both blocks succeed.'
);
}
public function testExtensionLoaded()
{
$config = $this->getConfigFixtureValue('ExtensionLoaded');
$this->assertEquals(
'Yes',
@$config['SessionExtLoaded'],
'Only rule correctly detects loaded PHP extension'
);
$this->assertEquals(
'No',
@$config['DummyExtLoaded'],
'Except rule correctly detects not-loaded PHP extension'
);
}
}

View File

@ -0,0 +1,28 @@
---
Only:
extensionloaded: "session"
---
SilverStripe\Core\Tests\Manifest\ConfigManifestTest:
ExtensionLoaded:
SessionExtLoaded: Yes
---
Only:
extensionloaded: "silverstripe_ext"
---
SilverStripe\Core\Tests\Manifest\ConfigManifestTest:
ExtensionLoaded:
DummyExtLoaded: Yes
---
Except:
extensionloaded: "session"
---
SilverStripe\Core\Tests\Manifest\ConfigManifestTest:
ExtensionLoaded:
SessionExtLoaded: No
---
Except:
extensionloaded: "silverstripe_ext"
---
SilverStripe\Core\Tests\Manifest\ConfigManifestTest:
ExtensionLoaded:
DummyExtLoaded: No