Update User\Store\IniStoreTest

This commit is contained in:
Alexander Fuhr 2014-11-12 17:13:15 +01:00
parent 8bb318eb72
commit b8113b688b

View File

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