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));
 }
 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));
 }
 /**
  * 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));
 }
 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))));
 }