コード例 #1
0
 public function testPasswordGetterAndSetter()
 {
     $origin = new ImapEmailOrigin();
     $this->assertNull($origin->getPassword());
     $origin->setPassword('test');
     $this->assertEquals('test', $origin->getPassword());
 }
コード例 #2
0
 /**
  * @param ImapEmailOrigin $origin
  */
 protected function clearOrigin(ImapEmailOrigin $origin)
 {
     $folders = $origin->getFolders();
     $folderRepository = $this->em->getRepository('OroImapBundle:ImapEmailFolder');
     foreach ($folders as $folder) {
         $imapFolder = $folderRepository->findOneBy(['folder' => $folder]);
         if (!$origin->isActive()) {
             $this->removeFolder($imapFolder);
         } elseif (!$folder->isSyncEnabled()) {
             $this->clearFolder($imapFolder);
             $imapFolder->getFolder()->setSynchronizedAt(null);
         }
     }
     if (!$origin->isActive()) {
         $this->em->remove($origin);
         $this->em->flush();
     }
 }
コード例 #3
0
 /**
  * Case when user submit empty form but have configuration
  * configuration should be not active and relation should be broken
  */
 public function testSubmitEmptyForm()
 {
     $type = new ConfigurationType($this->encryptor);
     $form = $this->factory->create($type);
     $entity = new ImapEmailOrigin();
     $this->assertTrue($entity->isActive());
     $form->setData($entity);
     $form->submit(array('host' => '', 'port' => '', 'ssl' => '', 'user' => '', 'password' => ''));
     $this->assertNotSame($entity, $form->getData());
     $this->assertNotInstanceOf('Oro\\Bundle\\ImapBundle\\Entity\\ImapEmailOrigin', $form->getData());
     $this->assertNull($form->getData());
 }
コード例 #4
0
 /**
  * Creates a processor is used to synchronize emails
  *
  * @param ImapEmailOrigin $origin
  * @return ImapEmailSynchronizationProcessor
  */
 protected function createSynchronizationProcessor($origin)
 {
     $config = new ImapConfig($origin->getHost(), $origin->getPort(), $origin->getSsl(), $origin->getUser(), $this->encryptor->decryptData($origin->getPassword()));
     return $this->syncProcessorFactory->create(new ImapEmailManager($this->connectorFactory->createImapConnector($config)), $this->getKnownEmailAddressChecker());
 }
コード例 #5
0
 /**
  * Creates a processor is used to synchronize emails
  *
  * @param ImapEmailOrigin $origin
  * @return ImapEmailSynchronizationProcessor
  */
 protected function createSynchronizationProcessor($origin)
 {
     $config = new ImapConfig($origin->getHost(), $origin->getPort(), $origin->getSsl(), $origin->getUser(), $this->encryptor->decryptData($origin->getPassword()));
     return new ImapEmailSynchronizationProcessor($this->log, $this->getEntityManager(), $this->emailEntityBuilder, $this->emailAddressManager, $this->knownEmailAddressChecker, new ImapEmailManager($this->connectorFactory->createImapConnector($config)));
 }
コード例 #6
0
 /**
  * @param ImapEmailOrigin $origin
  *
  * @return ImapEmailFolderManager
  */
 protected function createManager(ImapEmailOrigin $origin)
 {
     $config = new ImapConfig($origin->getHost(), $origin->getPort(), $origin->getSsl(), $origin->getUser(), $this->mcrypt->decryptData($origin->getPassword()));
     $connector = $this->connectorFactory->createImapConnector($config);
     return new ImapEmailFolderManager($connector, $this->doctrine->getManager(), $origin);
 }