示例#1
0
 public function testFindFolders()
 {
     $folder = $this->getMockBuilder('Oro\\Bundle\\ImapBundle\\Mail\\Storage\\Folder')->disableOriginalConstructor()->getMock();
     $this->storage->expects($this->once())->method('getFolders')->with($this->equalTo('SomeFolder'))->will($this->returnValue($folder));
     $result = $this->connector->findFolders('SomeFolder');
     $this->assertCount(0, $result);
 }
 /**
  * @return EmailFolder[]
  */
 public function getFolders()
 {
     // retrieve folders from imap
     $folders = $this->connector->findFolders();
     // transform folders into tree of models
     $emailFolderModels = $this->processFolders($folders);
     if ($this->origin->getId()) {
         // renew existing folders if origin already exists
         $existingFolders = $this->getExistingFolders();
         // merge synced and existing folders
         $emailFolderModels = $this->mergeFolders($emailFolderModels, $existingFolders);
         // mark old folders as outdated
         $this->removeOutdated($existingFolders);
         // flush changes
         $this->em->flush();
     }
     return $this->extractEmailFolders($emailFolderModels);
 }
示例#3
0
 /**
  * Retrieve folders
  *
  * @param string|null $parentFolder The global name of a parent folder.
  * @param bool        $recursive    True to get all subordinate folders
  *
  * @return Folder[]
  */
 public function getFolders($parentFolder = null, $recursive = false)
 {
     return $this->connector->findFolders($parentFolder, $recursive);
 }