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