Example #1
0
 /**
  * Utility
  */
 function getOpt($text)
 {
     $text = $this->compileVar($text);
     if (preg_match_all('/\\s*([^=]+)\\s*=\\s*( (?:[^"\'(\\s]|  "[^"]+" | \\([^)]*\\) |  \'[^\']+\')+ )\\s*/xms', $text, $m)) {
         $opt = array_combine($m[1], $m[2]);
     }
     $store = XStore::factory('array', $opt);
     return $store;
 }
Example #2
0
 function testSqlite()
 {
     $store = XStore::factory('sqlite', array(), array('file' => $this->dirname . "/store.db"));
     $this->assertEquals('XStoreSqlite', get_class($store), 'Object Type unmuch');
     $store->drop();
     $store->set('test', array("aaa", "bbb", "ccc"));
     $store->set('test2', $GLOBALS);
     $this->assertNotNull($store->getTime('test'), "Can't get Time");
     $this->assertNotNull($store->get('test2'), "Can't get test2");
     $store->delete('test2');
     $this->assertFalse($store->get('test2'), "Can't delete test2");
     $this->assertEquals($store->get('test'), array("aaa", "bbb", "ccc"));
     $data = $store->get('test');
     $this->assertEquals($data[2], "ccc");
 }