Added new test for Config.

The test checks if instances from Config->getConfig() are the same.
This commit is contained in:
Abel Hoogeveen 2016-06-02 15:44:32 +02:00
parent 53f597f947
commit ef82ea3463
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,5 @@
<?php
return array(
'key' => 'value'
);

View File

@ -108,4 +108,20 @@ class configTest extends CoreTestAbstract
$this->assertFalse(in_array('tests/config/testRemoveConfigPath', $this->config->getConfigPaths()));
}
public function testSameConfigObject()
{
$config = $this->config->getConfig('testsameconfigobject', array('tests/config/testSameConfigObject'));
$config2 = $this->config->getConfig('testsameconfigobject', array('tests/config/testSameConfigObject'));
// First test if the objects are the same instance
$this->assertSame($config, $config2);
// First test the existing key
$this->assertEquals($config->key, 'value');
// Change it and test if it's different now
$config->key = 'other_value';
$this->assertEquals($config2->key, 'other_value');
}
}