store() public method

Save all dirty prefs to the storage backend.
public store ( boolean $throw = true )
$throw boolean Throw exception on error? If false, ignores errors. (Since 2.1.0)
Esempio n. 1
0
 public function testModifyPreferences()
 {
     $p = new Horde_Prefs('horde', array(self::$prefs));
     $p['theme'] = "barbie";
     $p->store();
     $this->assertEquals("barbie", $this->_readValue(self::$db->selectValue('SELECT pref_value FROM horde_prefs WHERE pref_uid = ? AND pref_scope = ? AND pref_name = ?', array('joe', 'horde', 'theme'))));
 }
Esempio n. 2
0
 public function testLargePreferences()
 {
     $p = new Horde_Prefs('test', array(self::$prefs, new Horde_Prefs_Stub_Storage('test')));
     $value = str_repeat('x', 4001);
     $p['a'] = $value;
     $p->store();
     $this->assertEquals($value, $this->_readValue(self::$db->selectValue('SELECT pref_value FROM horde_prefs WHERE pref_uid = ? AND pref_scope = ? AND pref_name = ?', array('joe', 'test', 'a'))));
 }
Esempio n. 3
0
 public function testCreateFolder()
 {
     $this->markTestIncomplete('The mock driver confuses user/test/Preferences with INBOX/Preferences');
     setlocale(LC_MESSAGES, 'C');
     $p = new Horde_Prefs('test', array(new Horde_Prefs_Storage_KolabImap('test', array('kolab' => $this->_createStorage())), new Horde_Prefs_Stub_Storage('test')));
     $p['a'] = 'c';
     $p->store();
     $this->assertLogContains('Horde_Prefs_Storage_KolabImap: Created default Kolab preferences folder "Preferences".');
 }
Esempio n. 4
0
 public function testModifyPreferences()
 {
     $storage = $this->_createDefaultStorage();
     $p = new Horde_Prefs('horde', array(new Horde_Prefs_Storage_KolabImap('*****@*****.**', array('kolab' => $storage))));
     $p['theme'] = 'barbie';
     $p->store();
     $objects = $storage->getData('INBOX/Preferences')->getObjects();
     $object = array_pop($objects);
     $this->assertContains('theme:YmFyYmll', $object['pref']);
     $p->cleanup(true);
 }