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