/**
  * Initialize mailbox folder with name 'Processing'. If folder is not exists - it will be created
  * @return void
  */
 private function initialize()
 {
     if (is_null($this->folderOfProcessedMessages)) {
         $exists = false;
         $iterator = new \RecursiveIteratorIterator($this->zendImapStorage->getFolders());
         foreach ($iterator as $folder) {
             if ($folder->getLocalName() == self::NAME_OF_FOLDER_OF_PROCESSED_MESSAGES) {
                 $exists = true;
                 break;
             }
         }
         if (false === $exists) {
             $this->zendImapStorage->createFolder(self::NAME_OF_FOLDER_OF_PROCESSED_MESSAGES, new \Zend\Mail\Storage\Folder('INBOX'));
         }
         $this->folderOfProcessedMessages = new \Zend\Mail\Storage\Folder('INBOX/' . self::NAME_OF_FOLDER_OF_PROCESSED_MESSAGES);
     }
 }
Пример #2
0
 public function testCreateExistingFolder()
 {
     $mail = new Storage\Imap($this->_params);
     try {
         $mail->createFolder('subfolder/test');
     } catch (\Exception $e) {
         return;
         // ok
     }
     $this->fail('should not be able to create existing folder');
 }
Пример #3
0
 public function testCreateExistingFolder()
 {
     $mail = new Storage\Imap($this->_params);
     $this->setExpectedException('Zend\\Mail\\Storage\\Exception\\InvalidArgumentException');
     $mail->createFolder('subfolder/test');
 }