public function testGetFolders()
 {
     $this->logger->expects($this->any())->method('notice');
     $inboxFolder = $this->createRemoteFolder('Inbox', '[Gmail]\\Inbox', ['\\Inbox']);
     $subFolder = $this->createRemoteFolder('Inbox', '[Gmail]\\Test');
     $sentFolder = $this->createRemoteFolder('Sent', '[Gmail]\\Sent', ['\\Sent']);
     $spamFolder = $this->createRemoteFolder('Spam', '[Gmail]\\Spam', ['\\Spam']);
     $trashFolder = $this->createRemoteFolder('Spam', '[Gmail]\\Trash', ['\\Trash']);
     $nonSelectableFolder = $this->createRemoteFolder('All', 'All', [], false);
     $this->imapManager->expects($this->once())->method('getFolders')->with(null, true)->will($this->returnValue([$inboxFolder, $subFolder, $sentFolder, $spamFolder, $trashFolder, $nonSelectableFolder]));
     $processor = $this->getProcessorMock();
     $srcFolders = ReflectionUtil::callProtectedMethod($processor, 'getFolders', []);
     $this->assertEquals([$inboxFolder, $subFolder, $sentFolder], $srcFolders);
 }
Ejemplo n.º 2
0
 /**
  * @dataProvider preciseFullEmailAddressProvider
  */
 public function testPreciseFullEmailAddress($expected, $emailAddress, $ownerClass, $ownerId)
 {
     $this->nameFormatter->expects($this->any())->method('format')->with($this->isInstanceOf('Oro\\Bundle\\EmailBundle\\Tests\\Unit\\Fixtures\\Entity\\TestUser'))->will($this->returnCallback(function ($obj) {
         return $obj->getFirstName() . ' ' . $obj->getLastName();
     }));
     if ($ownerId) {
         $this->entityRoutingHelper->expects($this->once())->method('getEntity')->with($ownerClass, $ownerId)->will($this->returnValue(new TestUser($emailAddress, 'OwnerFirstName', 'OwnerLastName')));
     }
     $srcEmailAddress = $emailAddress;
     $param = [&$emailAddress, $ownerClass, $ownerId];
     ReflectionUtil::callProtectedMethod($this->handler, 'preciseFullEmailAddress', $param);
     $this->assertEquals($expected, $emailAddress);
 }
 public function testCreateEmailAddress()
 {
     $owner = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailOwnerInterface');
     $addrManager = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\Manager\\EmailAddressManager')->disableOriginalConstructor()->getMock();
     $addr = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailAddress');
     $addrManager->expects($this->once())->method('newEmailAddress')->will($this->returnValue($addr));
     $addr->expects($this->once())->method('setEmail')->with($this->equalTo('*****@*****.**'))->will($this->returnValue($addr));
     $addr->expects($this->once())->method('setOwner')->with($this->identicalTo($owner))->will($this->returnValue($addr));
     $manager = new EmailOwnerManager($this->getEmailOwnerProviderStorageMock(), $addrManager);
     ReflectionUtil::callProtectedMethod($manager, 'createEmailAddress', array('*****@*****.**', $owner));
 }