public function testGetNextId() { $db = new MsgDb(); $this->assertEquals(100001, $db->getNextId()); $db->addMsg('test_data/email1.eml', array(Storage::FLAG_ANSWERED), true); $db->addMsg('test_data/email2.eml', array(Storage::FLAG_SEEN, Storage::FLAG_ANSWERED), false); $db->addMsg('test_data/email3.eml', array(Storage::FLAG_SEEN), false); $this->assertEquals(100004, $db->getNextId()); }
public function addStorage(AbstractStorage $storage) { #fwrite(STDOUT, 'add: '.$storage->getType().' '.get_class($storage)."\n"); if (!$this->defaultStorage) { $this->defaultStorage = $storage; $dbPath = $storage->getPath(); if (substr($dbPath, -1) == '/') { $dbPath = substr($dbPath, 0, -1); } $dbPath .= '.yml'; $storage->setDbPath($dbPath); $db = new MsgDb($dbPath); $db->load(); $storage->setDb($db); } else { $this->storages[] = $storage; } #\Doctrine\Common\Util\Debug::dump($this->defaultStorage); #\Doctrine\Common\Util\Debug::dump($this->storages); }