protected function getUser()
 {
     $userData = array('id' => 232323, 'firstName' => 'wwrwrw', 'lastName' => 'ssfsfsf', 'username' => 'fsfsf', 'emailAddress' => 'fssffssf');
     require_once 'Conjoon/Modules/Default/User.php';
     $defaultUser = new \Conjoon_Modules_Default_User();
     $defaultUser->setId($userData['id']);
     $defaultUser->setFirstName($userData['firstName']);
     $defaultUser->setLastName($userData['lastName']);
     $defaultUser->setEmailAddress($userData['emailAddress']);
     $defaultUser->setUserName($userData['username']);
     return new \Conjoon\User\AppUser($defaultUser);
 }
 protected function setUp()
 {
     parent::setUp();
     $user = new \Conjoon_Modules_Default_User();
     $user->setId(1);
     $user->setFirstName("a");
     $user->setLastName("b");
     $user->setUsername("c");
     $user->setEmailAddress("d");
     $user = new \Conjoon\User\AppUser($user);
     $this->user = $user;
     $repository = $this->_entityManager->getRepository('\\Conjoon\\Data\\Entity\\Mail\\DefaultMailAccountEntity');
     $basicService = new DefaultAccountBasicService(array('mailAccountRepository' => $repository));
     $this->securityService = new DefaultAccountSecurityService(array('user' => $user, 'accountBasicService' => $basicService));
 }
Пример #3
0
 /**
  * Ensure everything works as expected.
  */
 public function testEquals_CN963()
 {
     $sameUserId = $this->_defaultUser->getId();
     $userData = array('id' => $sameUserId, 'firstName' => 'a', 'lastName' => 'b', 'username' => 'c', 'emailAddress' => 'd');
     $tmpUser = new \Conjoon_Modules_Default_User();
     $tmpUser->setId($userData['id']);
     $tmpUser->setFirstName($userData['firstName']);
     $tmpUser->setLastName($userData['lastName']);
     $tmpUser->setEmailAddress($userData['emailAddress']);
     $tmpUser->setUserName($userData['username']);
     $succUser = new AppUser($tmpUser);
     $tmpUser->setId($userData['id'] + 1);
     $failUser = new AppUser($tmpUser);
     $user = new AppUser($this->_defaultUser);
     $this->assertTrue($user->equals($succUser));
     $this->assertFalse($user->equals($failUser));
 }
 protected function setUp()
 {
     parent::setUp();
     $user = new \Conjoon_Modules_Default_User();
     $user->setId(1);
     $user->setFirstName("firstname");
     $user->setLastName("lastname");
     $user->setUsername("username");
     $user->setEmailAddress("emailaddress");
     $user = new \Conjoon\User\AppUser($user);
     $messageRepository = $this->_entityManager->getRepository('\\Conjoon\\Data\\Entity\\Mail\\DefaultMessageEntity');
     $repository = $this->_entityManager->getRepository('\\Conjoon\\Data\\Entity\\Mail\\DefaultMailFolderEntity');
     $mailFolderCommons = new \Conjoon\Mail\Client\Folder\DefaultFolderCommons(array('mailFolderRepository' => $repository, 'user' => $user, 'messageRepository' => $messageRepository));
     $folderSecurityService = new \Conjoon\Mail\Client\Security\DefaultFolderSecurityService(array('mailFolderRepository' => $repository, 'user' => $user, 'mailFolderCommons' => $mailFolderCommons));
     $folderNamingForMovingStrategy = new \Conjoon\Mail\Client\Folder\Strategy\DefaultFolderNamingForMovingStrategy(array('template' => '{0} {1}'));
     $this->service = new DefaultFolderService(array('folderSecurityService' => $folderSecurityService, 'mailFolderRepository' => $repository, 'user' => $user, 'mailFolderCommons' => $mailFolderCommons, 'folderNamingForMovingStrategy' => $folderNamingForMovingStrategy));
 }
Пример #5
0
 protected function setUp()
 {
     parent::setUp();
     $this->protocolAdaptee = new SimpleProtocolAdaptee();
     $this->failProtocolAdaptee = new SimpleProtocolAdaptee(false);
     $folder = new \Conjoon\Mail\Client\Folder\Folder(new \Conjoon\Mail\Client\Folder\DefaultFolderPath('["root", "79", "INBOXtttt", "rfwe2", "New folder (7)"]'));
     $flags = new \Conjoon\Mail\Client\Message\Flag\DefaultFlagCollection('[{"id":"173","isRead":false},{"id":"172","isRead":true}]');
     $this->folderFlagCollection = new \Conjoon\Mail\Client\Message\Flag\FolderFlagCollection($flags, $folder);
     $userData = array('id' => 232323, 'firstName' => 'wwrwrw', 'lastName' => 'ssfsfsf', 'username' => 'fsfsf', 'emailAddress' => 'fssffssf');
     require_once 'Conjoon/Modules/Default/User.php';
     $defaultUser = new \Conjoon_Modules_Default_User();
     $defaultUser->setId($userData['id']);
     $defaultUser->setFirstName($userData['firstName']);
     $defaultUser->setLastName($userData['lastName']);
     $defaultUser->setEmailAddress($userData['emailAddress']);
     $defaultUser->setUserName($userData['username']);
     $this->user = new \Conjoon\User\AppUser($defaultUser);
 }
 /**
  * Helper function for creating DefaultFolderCommons with regular/mocked
  * FolderRepository.
  *
  * @param bool $useSecurityMockRepository true to create a mock repository
  */
 protected function getFolderService($useSecurityMockRepository = false)
 {
     $this->accountRepository = $this->_entityManager->getRepository('\\Conjoon\\Data\\Entity\\Mail\\DefaultMailAccountEntity');
     $user = new \Conjoon_Modules_Default_User();
     $user->setId(1);
     $user->setFirstName("f");
     $user->setLastName("l");
     $user->setUsername("u");
     $user->setEmailAddress("ea");
     $this->user = new \Conjoon\User\AppUser($user);
     $user = $this->user;
     $messageRepository = $this->_entityManager->getRepository('\\Conjoon\\Data\\Entity\\Mail\\DefaultMessageEntity');
     $mailFolderRepository = $this->_entityManager->getRepository('\\Conjoon\\Data\\Entity\\Mail\\DefaultMailFolderEntity');
     $mailFolderCommons = new \Conjoon\Mail\Client\Folder\DefaultFolderCommons(array('messageRepository' => $messageRepository, 'mailFolderRepository' => $mailFolderRepository, 'user' => $this->user));
     $folderSecurityService = new \Conjoon\Mail\Client\Security\DefaultFolderSecurityService(array('mailFolderRepository' => $mailFolderRepository, 'user' => $user, 'mailFolderCommons' => new \Conjoon\Mail\Client\Folder\DefaultFolderCommons(array('messageRepository' => $messageRepository, 'mailFolderRepository' => $mailFolderRepository, 'user' => $this->user))));
     $folderNamingForMovingStrategy = new \Conjoon\Mail\Client\Folder\Strategy\DefaultFolderNamingForMovingStrategy(array('template' => '{0} {1}'));
     return new DefaultFolderService(array('folderSecurityService' => $useSecurityMockRepository !== true ? $folderSecurityService : new TestSecurityMockRepository(array()), 'mailFolderRepository' => $mailFolderRepository, 'user' => $user, 'mailFolderCommons' => $mailFolderCommons, 'folderNamingForMovingStrategy' => $folderNamingForMovingStrategy));
 }
 /**
  * @ticket CN-963
  */
 public function testEquals_CN963()
 {
     $sameId = 1234;
     $user = new DefaultUserEntity();
     $reflector = new \ReflectionClass($user);
     $id = $reflector->getProperty('id');
     $id->setAccessible(true);
     $id->setValue($user, $sameId);
     $userData = array('id' => $sameId, 'firstName' => 'a', 'lastName' => 'b', 'username' => 'c', 'emailAddress' => 'd');
     $tmpUser = new \Conjoon_Modules_Default_User();
     $tmpUser->setId($userData['id']);
     $tmpUser->setFirstName($userData['firstName']);
     $tmpUser->setLastName($userData['lastName']);
     $tmpUser->setEmailAddress($userData['emailAddress']);
     $tmpUser->setUserName($userData['username']);
     $succUser = new AppUser($tmpUser);
     $tmpUser->setId($userData['id'] + 1);
     $failUser = new AppUser($tmpUser);
     $this->assertTrue($user->equals($succUser));
     $this->assertFalse($user->equals($failUser));
     $this->assertTrue($user->equals($user));
 }
 protected function getService($useMock = false)
 {
     $user = new \Conjoon_Modules_Default_User();
     $user->setId(1);
     $user->setFirstName("f");
     $user->setLastName("l");
     $user->setUsername("u");
     $user->setEmailAddress("ea");
     $this->user = new \Conjoon\User\AppUser($user);
     $user->setId(2);
     $this->userAccessibleFail = new \Conjoon\User\AppUser($user);
     $this->clientMailFolderNoRemote = new Folder(new DefaultFolderPath('["root", "2", "INBOXtttt", "rfwe2", "New folder (7)"]'));
     $this->rootMailFolder = new Folder(new DefaultFolderPath('["root", "2"]'));
     $this->accountsRootMailFolder = new Folder(new DefaultFolderPath('["root", "3"]'));
     $this->clientMailFolder = new Folder(new DefaultFolderPath('["root", "1", "INBOXtttt", "rfwe2", "New folder (7)"]'));
     $this->clientMailFolderFail = new Folder(new DefaultFolderPath('["root", "ettwe2e", "INBOXtttt", "rfwe2", "New folder (7)"]'));
     $this->messageRepository = $this->_entityManager->getRepository('\\Conjoon\\Data\\Entity\\Mail\\DefaultMessageEntity');
     $repository = $this->_entityManager->getRepository('\\Conjoon\\Data\\Entity\\Mail\\DefaultMailFolderEntity');
     if ($useMock) {
         $mailFolderCommons = new MockFolderCommons(array('mailFolderRepository' => $repository, 'user' => $this->user, 'messageRepository' => $this->messageRepository));
     } else {
         $mailFolderCommons = new \Conjoon\Mail\Client\Folder\DefaultFolderCommons(array('mailFolderRepository' => $repository, 'user' => $this->user, 'messageRepository' => $this->messageRepository));
     }
     $folderSecurityService = new \Conjoon\Mail\Client\Security\DefaultFolderSecurityService(array('mailFolderRepository' => $repository, 'user' => $this->user, 'mailFolderCommons' => $mailFolderCommons));
     $folderNamingForMovingStrategy = new \Conjoon\Mail\Client\Folder\Strategy\DefaultFolderNamingForMovingStrategy(array('template' => '{0} {1}'));
     return new DefaultFolderService(array('folderSecurityService' => $folderSecurityService, 'user' => $this->user, 'mailFolderCommons' => $mailFolderCommons, 'folderNamingForMovingStrategy' => $folderNamingForMovingStrategy));
 }
 protected function getCommons($bUseMock = false)
 {
     $repository = $this->_entityManager->getRepository('\\Conjoon\\Data\\Entity\\Mail\\DefaultMailFolderEntity');
     $this->mailFolderRepository = $repository;
     $this->messageRepository = $this->_entityManager->getRepository('\\Conjoon\\Data\\Entity\\Mail\\DefaultMessageEntity');
     $user = new \Conjoon_Modules_Default_User();
     $user->setId(1);
     $user->setFirstName("f");
     $user->setLastName("l");
     $user->setUsername("u");
     $user->setEmailAddress("ea");
     $this->user = new \Conjoon\User\AppUser($user);
     return new DefaultFolderCommons(array('messageRepository' => $this->messageRepository, 'mailFolderRepository' => $bUseMock !== true ? $repository : new TestFolderMockRepository(), 'user' => $this->user));
 }
 /**
  * Helper to retrieve SecurityService.
  *
  * @param boolean $mockRepository true to return the service with
  * a mock repository which throws InvalidArgumentExceptions in its
  * findById-method
  */
 protected function getSecurityService($mockRepository = false)
 {
     $user = new \Conjoon_Modules_Default_User();
     $user->setId(1);
     $user->setFirstName("f");
     $user->setLastName("l");
     $user->setUsername("u");
     $user->setEmailAddress("ea");
     $user = new \Conjoon\User\AppUser($user);
     if ($mockRepository !== true) {
         $repository = $this->_entityManager->getRepository('\\Conjoon\\Data\\Entity\\Mail\\DefaultMailFolderEntity');
     } else {
         $repository = new TestFolderMockRepository();
     }
     $messageRepository = $this->_entityManager->getRepository('\\Conjoon\\Data\\Entity\\Mail\\DefaultMessageEntity');
     return new DefaultFolderSecurityService(array('mailFolderRepository' => $repository, 'user' => $user, 'mailFolderCommons' => new \Conjoon\Mail\Client\Folder\DefaultFolderCommons(array('mailFolderRepository' => $repository, 'user' => $user, 'messageRepository' => $messageRepository))));
 }