Update User\Store\IniStoreTest

This commit is contained in:
Alexander Fuhr 2014-11-12 17:13:15 +01:00
parent 8bb318eb72
commit b8113b688b
1 changed files with 11 additions and 6 deletions

View File

@ -32,13 +32,15 @@ class IniStoreTest extends BaseTestCase
public function testWhetherPreferenceChangesAreApplied()
{
$store = $this->getStore();
$store->setPreferences(array('key1' => '1'));
$store->setPreferences(array('testsection' => array('key1' => '1')));
$store->save(
Mockery::mock('Icinga\User\Preferences', array('toArray' => array('key1' => '11', 'key2' => '2')))
Mockery::mock('Icinga\User\Preferences', array(
'toArray' => array('testsection' => array('key1' => '11', 'key2' => '2'))
))
);
$this->assertEquals(
array('key1' => '11', 'key2' => '2'),
array('testsection' => array('key1' => '11', 'key2' => '2')),
$store->getPreferences(),
'IniStore::save does not properly apply changed preferences'
);
@ -47,10 +49,13 @@ class IniStoreTest extends BaseTestCase
public function testWhetherPreferenceDeletionsAreApplied()
{
$store = $this->getStore();
$store->setPreferences(array('key' => 'value'));
$store->setPreferences(array('testsection' => array('key' => 'value')));
$store->save(Mockery::mock('Icinga\User\Preferences', array('toArray' => array())));
$this->assertEmpty($store->getPreferences(), 'IniStore::save does not delete removed preferences');
$store->save(Mockery::mock('Icinga\User\Preferences', array('toArray' => array('testsection' => array()))));
$result = $store->getPreferences();
$this->assertEmpty($result['testsection'], 'IniStore::save does not delete removed preferences');
}
protected function getStore()