コード例 #1
0
ファイル: Mbox.php プロジェクト: ngchie/system
 /**
  * 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();
 }
コード例 #2
0
 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(), '');
 }
コード例 #3
0
ファイル: MboxTest.php プロジェクト: jorgenils/zend-framework
 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');
 }
コード例 #4
0
 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');
     }
 }
コード例 #5
0
ファイル: MboxTest.php プロジェクト: jorgenils/zend-framework
 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');
         }
     }
 }