/** * magic method for unserialize() * * with this method you can cache the mbox class * * @return null */ public function __wakeup() { // if cache is stall selectFolder() rebuilds the tree on error parent::__wakeup(); }
public function testShortMbox() { $fh = fopen($this->_mboxFile, 'w'); fputs($fh, "From \r\nSubject: test\r\nFrom \r\nSubject: test2\r\n"); fclose($fh); $mail = new Zend_Mail_Storage_Mbox(array('filename' => $this->_mboxFile)); $this->assertEquals($mail->countMessages(), 2); $this->assertEquals($mail->getMessage(1)->subject, 'test'); $this->assertEquals($mail->getMessage(1)->getContent(), ''); $this->assertEquals($mail->getMessage(2)->subject, 'test2'); $this->assertEquals($mail->getMessage(2)->getContent(), ''); }
public function testOutOfBounds() { $mail = new Zend_Mail_Storage_Mbox(array('filename' => $this->_mboxFile)); try { $mail->seek(INF); } catch (Exception $e) { return; // test ok } $this->fail('no exception raised while seeking to not invalid id'); }
public function testFallback() { $list = new Zend_Mail_Storage_Mbox(array('filename' => $this->_mboxFile)); try { $result = $list->noop(); $this->assertTrue($result); } catch (Exception $e) { $this->fail('exception raised while calling noop thru fallback'); } }
public function testUniqueId() { $mail = new Zend_Mail_Storage_Mbox(array('filename' => $this->_mboxFile)); $this->assertFalse($mail->hasUniqueId); $this->assertEquals(1, $mail->getNumberByUniqueId($mail->getUniqueId(1))); $ids = $mail->getUniqueId(); foreach ($ids as $num => $id) { $this->assertEquals($num, $id); if ($mail->getNumberByUniqueId($id) != $num) { $this->fail('reverse lookup failed'); } } }