2013-03-12 15:32:46 +13:00
|
|
|
<?php
|
|
|
|
|
2016-09-09 18:43:05 +12:00
|
|
|
use SilverStripe\Core\Manifest\ConfigStaticManifest;
|
2016-08-19 10:51:35 +12:00
|
|
|
use SilverStripe\Dev\SapphireTest;
|
|
|
|
|
|
|
|
|
2013-03-12 15:32:46 +13:00
|
|
|
class ConfigStaticManifestTest extends SapphireTest {
|
|
|
|
|
2015-05-01 01:04:55 +00:00
|
|
|
private static $testString = 'string';
|
2013-03-12 15:32:46 +13:00
|
|
|
|
2015-05-01 01:04:55 +00:00
|
|
|
private static $testArray = array('foo' => 'bar');
|
2013-03-12 15:32:46 +13:00
|
|
|
|
2015-05-01 01:04:55 +00:00
|
|
|
protected static $ignored = true;
|
2013-03-12 15:32:46 +13:00
|
|
|
|
2015-05-01 01:04:55 +00:00
|
|
|
public function testGet() {
|
2016-09-09 18:43:05 +12:00
|
|
|
$manifest = new ConfigStaticManifest();
|
2013-03-12 15:32:46 +13:00
|
|
|
|
2015-05-01 01:04:55 +00:00
|
|
|
// Test madeup value
|
|
|
|
$this->assertNull($manifest->get(__CLASS__, 'madeup', null));
|
2013-03-13 11:26:49 +13:00
|
|
|
|
2015-05-01 01:04:55 +00:00
|
|
|
// Test string value
|
|
|
|
$this->assertEquals('string', $manifest->get(__CLASS__, 'testString'));
|
2013-03-13 11:26:49 +13:00
|
|
|
|
2015-05-01 01:04:55 +00:00
|
|
|
// Test array value
|
|
|
|
$this->assertEquals(array('foo' => 'bar'), $manifest->get(__CLASS__, 'testArray'));
|
2013-03-12 15:32:46 +13:00
|
|
|
|
2015-05-01 01:04:55 +00:00
|
|
|
// Test to ensure we're only picking up private statics
|
|
|
|
$this->assertNull($manifest->get(__CLASS__, 'ignored', null));
|
2013-03-13 11:59:49 +13:00
|
|
|
|
2015-05-01 01:04:55 +00:00
|
|
|
// Test madeup class
|
|
|
|
if(!class_exists('aonsffgrgx')) {
|
|
|
|
$this->assertNull($manifest->get('aonsffgrgx', 'madeup', null));
|
2013-05-05 12:19:31 +12:00
|
|
|
}
|
|
|
|
}
|
2013-06-26 15:49:00 +12:00
|
|
|
|
2013-05-05 12:19:31 +12:00
|
|
|
}
|