public function testCreateService()
 {
     $helperPluginManager = new HelperPluginManager();
     $helperPluginManager->setServiceLocator(Bootstrap::getServiceManager());
     $result = $this->testedObj->createService($helperPluginManager);
     $this->assertInstanceOf(FlashMessages::class, $result);
 }
Ejemplo n.º 2
0
 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $fm = $sm->get('formElementManager');
     $result = $this->testedObj->createService($fm);
     $this->assertInstanceOf('Auth\\Form\\Register', $result);
 }
 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $fm = $sm->get('formElementManager');
     $result = $this->factory->createService($fm);
     $this->assertInstanceOf(UserStatusFieldset::class, $result);
 }
 public function testCreateService()
 {
     $controllerManager = new ControllerManager();
     $controllerManager->setServiceLocator(Bootstrap::getServiceManager());
     $result = $this->testedObj->createService($controllerManager);
     $this->assertInstanceOf(UpdateController::class, $result);
 }
Ejemplo n.º 5
0
 public function setUp()
 {
     $this->init('login');
     $this->loginFormMock = $this->getMockBuilder(LoginForm::class)->disableOriginalConstructor()->getMock();
     $this->loginService = $this->getMockBuilder(LoginService::class)->disableOriginalConstructor()->getMock();
     $this->controller = new LoginController($this->loginFormMock, $this->loginService);
     $this->controller->setEvent($this->event);
     $this->controller->getPluginManager()->setServiceLocator(Bootstrap::getServiceManager());
 }
 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $sm->setAllowOverride(true);
     $repositoriesMock = $this->getMockBuilder('Core\\Repository\\RepositoryService')->disableOriginalConstructor()->getMock();
     $sm->setService('repositories', $repositoriesMock);
     $result = $this->testedObj->createService($sm);
     $this->assertInstanceOf('Auth\\Service\\GotoResetPassword', $result);
 }
 /**
  * @param bool       $hasIdentity
  * @param UserEntity $userEntity
  */
 protected function prepareAuthenticateMock($hasIdentity = false, UserEntity $userEntity = null)
 {
     $authMock = $this->getMockBuilder(AuthenticationService::class)->disableOriginalConstructor()->getMock();
     $authMock->expects($this->any())->method('hasIdentity')->will($this->returnValue($hasIdentity));
     $authMock->expects($this->any())->method('getIdentity')->will($this->returnValue($userEntity));
     $sm = Bootstrap::getServiceManager();
     $sm->setAllowOverride(true);
     $sm->setService(AuthenticationService::class, $authMock);
     $sm->setAllowOverride(false);
 }
Ejemplo n.º 8
0
 /**
  *
  */
 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $sm->setAllowOverride(true);
     $config = $this->mockJobsOptions;
     $config->method('__isset')->with('multipostingTargetUri')->willReturn(True);
     $config->method('__get')->with('multipostingTargetUri')->willReturn('http://*****:*****@host/path');
     $sm->setService('Jobs/Options', $config);
     $result = $this->testedObj->createService($sm);
     $this->assertInstanceOf('Core\\Service\\RestClient', $result);
 }
Ejemplo n.º 9
0
 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $sm->setAllowOverride(true);
     $userRepositoryMock = $this->getMockBuilder('Auth\\Repository\\User')->disableOriginalConstructor()->getMock();
     $repositoriesMock = $this->getMockBuilder('Core\\Repository\\RepositoryService')->disableOriginalConstructor()->getMock();
     $repositoriesMock->expects($this->once())->method('get')->with('Auth/User')->willReturn($userRepositoryMock);
     $sm->setService('repositories', $repositoriesMock);
     $result = $this->testedObj->createService($sm);
     $this->assertInstanceOf('Auth\\Service\\Register', $result);
 }
Ejemplo n.º 10
0
 public function init($controllerName, $actionName = 'index', $lang = 'en')
 {
     $this->routeMatch = new RouteMatch(array('controller' => $controllerName, 'action' => $actionName, 'lang' => $lang));
     $this->event = new MvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     /** @var SimpleRouteStack $router */
     $routerFactory = new RouterFactory();
     $router = $routerFactory->createService(clone Bootstrap::getServiceManager());
     $router->setDefaultParam('lang', $lang);
     $this->event->setRouter($router);
 }
 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $sm->setAllowOverride(true);
     $organizationRepositoryMock = $this->getMockBuilder('Organizations\\Repository\\Organization')->disableOriginalConstructor()->getMock();
     $repositoriesMock = $this->getMockBuilder('Core\\Repository\\RepositoryService')->disableOriginalConstructor()->getMock();
     $repositoriesMock->expects($this->once())->method('get')->with('Organizations/Organization')->willReturn($organizationRepositoryMock);
     $sm->setService('repositories', $repositoriesMock);
     $result = $this->testedObj->createService($sm);
     $this->assertInstanceOf('Jobs\\Form\\Hydrator\\OrganizationNameHydrator', $result);
 }
 public function setUp()
 {
     $this->init('goto-reset-password');
     $this->serviceMock = $this->getMockBuilder('Auth\\Service\\GotoResetPassword')->disableOriginalConstructor()->getMock();
     $loggerMock = $this->getMock('Zend\\Log\\LoggerInterface');
     $this->controller = new GotoResetPasswordController($this->serviceMock, $loggerMock);
     $this->controller->setEvent($this->event);
     /** @var PluginManager $controllerPluginManager */
     $controllerPluginManager = clone Bootstrap::getServiceManager()->get('ControllerPluginManager');
     $this->controller->setPluginManager($controllerPluginManager);
 }
 /**
  * @runInSeparateProcess
  * @preserveGlobalState disabled
  */
 public function setUp()
 {
     $this->init('register-confirmation');
     $this->serviceMock = $this->getMockBuilder('Auth\\Service\\RegisterConfirmation')->disableOriginalConstructor()->getMock();
     $loggerMock = $this->getMockBuilder('Zend\\Log\\LoggerInterface')->getMockForAbstractClass();
     $this->controller = new RegisterConfirmationController($this->serviceMock, $loggerMock);
     $this->controller->setEvent($this->event);
     /** @var PluginManager $controllerPluginManager */
     $controllerPluginManager = clone Bootstrap::getServiceManager()->get('ControllerPluginManager');
     $this->controller->setPluginManager($controllerPluginManager);
 }
 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $sm->setAllowOverride(true);
     $gotoResetPasswordMock = $this->getMockBuilder('Auth\\Service\\GotoResetPassword')->disableOriginalConstructor()->getMock();
     $loggerMock = $this->getMockBuilder('Zend\\Log\\LoggerInterface')->getMock();
     $sm->setService('Auth\\Service\\GotoResetPassword', $gotoResetPasswordMock);
     $sm->setService('Core/Log', $loggerMock);
     $controllerManager = new ControllerManager($sm);
     $result = $this->testedObj->createService($controllerManager);
     $this->assertInstanceOf('Auth\\Controller\\GotoResetPasswordController', $result);
 }
 /**
  *
  */
 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $sm->setAllowOverride(true);
     $jobRepositoryMock = $this->getMockBuilder('Jobs\\Repository\\Job')->disableOriginalConstructor()->getMock();
     $repositoriesMock = $this->getMockBuilder('Core\\Repository\\RepositoryService')->disableOriginalConstructor()->getMock();
     $repositoriesMock->expects($this->once())->method('get')->with('Jobs/Job')->willReturn($jobRepositoryMock);
     $sm->setService('repositories', $repositoriesMock);
     $controllerManager = new ControllerManager($sm);
     $result = $this->testedObj->createService($controllerManager);
     $this->assertInstanceOf('Jobs\\Controller\\JobboardController', $result);
 }
 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $sm->setAllowOverride(true);
     $authenticationServiceMock = $this->getMockBuilder('Auth\\AuthenticationService')->disableOriginalConstructor()->getMock();
     $repositoriesMock = $this->getMockBuilder('Core\\Repository\\RepositoryService')->disableOriginalConstructor()->getMock();
     $sm->setService('AuthenticationService', $authenticationServiceMock);
     $sm->setService('repositories', $repositoriesMock);
     $controllerManager = new ControllerManager($sm);
     $result = $this->testedObj->createService($controllerManager);
     $this->assertInstanceOf('Auth\\Controller\\PasswordController', $result);
 }
Ejemplo n.º 17
0
 public function setUp()
 {
     $this->init('password');
     $this->formMock = $this->getMock('Auth\\Form\\UserPassword');
     $this->authenticationServiceMock = $this->getMockBuilder('Auth\\AuthenticationService')->disableOriginalConstructor()->getMock();
     $this->repositoriesMock = $this->getMockBuilder('Core\\Repository\\RepositoryService')->disableOriginalConstructor()->getMock();
     $this->controller = new PasswordController($this->authenticationServiceMock, $this->formMock, $this->repositoriesMock);
     $this->controller->setEvent($this->event);
     $serviceManager = Bootstrap::getServiceManager();
     $controllerPluginManager = $serviceManager->get('controllerPluginManager');
     $this->controller->setServiceLocator($serviceManager);
     $this->controller->setPluginManager($controllerPluginManager);
 }
 public function testCreateService()
 {
     $this->applicationMock->expects($this->once())->method('getMvcEvent')->willReturnSelf();
     $this->applicationMock->expects($this->once())->method('getRouteMatch')->willReturn(new RouteMatch([]));
     $sl = Bootstrap::getServiceManager();
     $sl->setAllowOverride(true);
     $sl->setService('Application', $this->applicationMock);
     $sl->setAllowOverride(false);
     $helperPluginManager = new HelperPluginManager();
     $helperPluginManager->setServiceLocator($sl);
     $result = $this->testedObj->createService($helperPluginManager);
     $this->assertInstanceOf(LanguagesSwitcher::class, $result);
 }
 /**
  */
 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $sm->setAllowOverride(true);
     $organizationRepositoryMock = $this->getMockBuilder('Organizations\\Repository\\Organization')->disableOriginalConstructor()->getMock();
     $repositoriesMock = $this->getMockBuilder('Core\\Repository\\RepositoryService')->disableOriginalConstructor()->getMock();
     $repositoriesMock->expects($this->once())->method('get')->with('Organizations/Organization')->willReturn($organizationRepositoryMock);
     $sm->setService('repositories', $repositoriesMock);
     $controllerManager = new ControllerManager($sm);
     $result = $this->testedObj->createService($controllerManager);
     $this->assertInstanceOf('Organizations\\Controller\\TypeAHeadController', $result);
     $this->assertAttributeSame($organizationRepositoryMock, 'organizationRepository', $result);
 }
 public function setUp()
 {
     $this->init('forgot-password');
     $this->formMock = $this->getMockBuilder('Auth\\Form\\ForgotPassword')->getMock();
     $this->serviceMock = $this->getMockBuilder('Auth\\Service\\ForgotPassword')->disableOriginalConstructor()->getMock();
     $loggerMock = $this->getMockBuilder('Zend\\Log\\LoggerInterface')->getMock();
     $this->controller = new ForgotPasswordController($this->formMock, $this->serviceMock, $loggerMock);
     $this->controller->setEvent($this->event);
     /** @var \Zend\Mvc\Controller\PluginManager $controllerPluginManager */
     $this->servicemanager = clone Bootstrap::getServiceManager();
     $controllerPluginManager = $this->servicemanager->get('ControllerPluginManager');
     $this->controller->setServiceLocator($this->servicemanager);
     $this->controller->setPluginManager($controllerPluginManager);
 }
 /**
  *
  */
 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $sm->setAllowOverride(true);
     $jobRepositoryMock = $this->getMockBuilder('Jobs\\Repository\\Job')->disableOriginalConstructor()->getMock();
     $repositoriesMock = $this->getMockBuilder('Core\\Repository\\RepositoryService')->disableOriginalConstructor()->getMock();
     $repositoriesMock->expects($this->once())->method('get')->with('Jobs/Job')->willReturn($jobRepositoryMock);
     $sm->setService('repositories', $repositoriesMock);
     $sm->setService('config', array('core_options' => array('system_message_email' => '*****@*****.**')));
     $controllerManager = new ControllerManager();
     $controllerManager->setServiceLocator($sm);
     $result = $this->testedObj->createService($controllerManager);
     $this->assertInstanceOf('Jobs\\Controller\\TemplateController', $result);
 }
Ejemplo n.º 22
0
 public function setUp()
 {
     $this->init('typeAHead');
     $sm = clone Bootstrap::getServiceManager();
     $this->organizationRepoMock = $this->getMockBuilder('Organizations\\Repository\\Organization')->disableOriginalConstructor()->getMock();
     $this->authControllerPluginMock = $this->getMockBuilder('Auth\\Controller\\Plugin\\Auth')->setMethods(array('__invoke', 'getUser'))->disableOriginalConstructor()->getMock();
     $this->controller = new TypeAHeadController($this->organizationRepoMock);
     $this->controller->setEvent($this->event);
     /** @var PluginManager $controllerPluginManager */
     $controllerPluginManager = $sm->get('ControllerPluginManager');
     $controllerPluginManager->setAllowOverride(true);
     $controllerPluginManager->setService('auth', $this->authControllerPluginMock);
     $this->controller->setPluginManager($controllerPluginManager);
 }
 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $sm->setAllowOverride(true);
     $authenticationServiceMock = $this->getMockBuilder('Auth\\AuthenticationService')->disableOriginalConstructor()->getMock();
     $formMock = $this->getMockBuilder('Auth\\Form\\Login')->getMock();
     $loggerMock = $this->getMockBuilder('Zend\\Log\\LoggerInterface')->getMock();
     $sm->setService('AuthenticationService', $authenticationServiceMock);
     $sm->setService('Core/Log', $loggerMock);
     $sm->setService('Auth\\Form\\Login', $formMock);
     $controllerManager = new ControllerManager($sm);
     $result = $this->testedObj->createService($controllerManager);
     $this->assertInstanceOf('Auth\\Controller\\IndexController', $result);
 }
 public function testCreateService()
 {
     $sm = clone Bootstrap::getServiceManager();
     $sm->setAllowOverride(true);
     $registerServiceMock = $this->getMockBuilder('Auth\\Service\\Register')->disableOriginalConstructor()->getMock();
     $loggerMock = $this->getMock('Zend\\Log\\LoggerInterface');
     $options = new ModuleOptions();
     $sm->setService('Auth\\Service\\Register', $registerServiceMock);
     $sm->setService('Core/Log', $loggerMock);
     $sm->setService('Auth/ModuleOptions', $options);
     $controllerManager = new ControllerManager();
     $controllerManager->setServiceLocator($sm);
     $result = $this->testedObj->createService($controllerManager);
     $this->assertInstanceOf('Auth\\Controller\\RegisterController', $result);
 }
Ejemplo n.º 25
0
 public function setUp()
 {
     $connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
     $connection->expects($this->any())->method('getDatabasePlatform')->willReturn(new MySqlPlatform());
     $this->entityManagerMock = $this->getMockBuilder(EntityManager::class)->disableOriginalConstructor()->setMethods(['persist', 'flush', 'remove', 'getConnection', 'getClassMetadata', 'createQueryBuilder', 'getConfiguration'])->getMock();
     $this->queryBuilderMock = $this->getMockBuilder(QueryBuilder::class)->setMethods(['__construct'])->setConstructorArgs([$this->entityManagerMock])->getMock();
     $this->queryMock = $this->getMockBuilder(AbstractQuery::class)->setMethods(['getResult'])->disableOriginalConstructor()->getMockForAbstractClass();
     $this->queryBuilderMock->expects($this->any())->method('getQuery')->willReturn($this->queryMock);
     $this->entityManagerMock->expects($this->any())->method('createQueryBuilder')->willReturn($this->queryBuilderMock);
     $this->entityManagerMock->expects($this->any())->method('getConnection')->willReturn($connection);
     $configurationFactory = new ConfigurationFactory('orm_default');
     /** @var Configuration $configuration */
     $configuration = $configurationFactory->createService(clone Bootstrap::getServiceManager());
     $this->entityManagerMock->expects($this->any())->method('getConfiguration')->willReturn($configuration);
 }
Ejemplo n.º 26
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->object = new IndexController();
     $serviceManager = Bootstrap::getServiceManager();
     $this->controller = new IndexController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'Index'));
     $this->event = new MvcEvent();
     $config = $serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($serviceManager);
 }
Ejemplo n.º 27
0
 public function setUp()
 {
     $this->init('register');
     $captureOptions = new CaptchaOptions();
     $this->formMock = $this->getMockBuilder('Auth\\Form\\Register')->setConstructorArgs([null, $captureOptions])->getMock();
     $this->serviceMock = $this->getMockBuilder('Auth\\Service\\Register')->disableOriginalConstructor()->getMock();
     $this->paramsMock = $this->getMockBuilder('Zend\\Mvc\\Controller\\Plugin\\Params')->getMock();
     $loggerMock = $this->getMockBuilder('Zend\\Log\\LoggerInterface')->getMock();
     $options = new ModuleOptions();
     $this->controller = new RegisterController($this->formMock, $this->serviceMock, $loggerMock, $options);
     $this->controller->setEvent($this->event);
     /** @var PluginManager $controllerPluginManager */
     $controllerPluginManager = clone Bootstrap::getServiceManager()->get('ControllerPluginManager');
     $controllerPluginManager->setService('params', $this->paramsMock);
     $this->controller->setPluginManager($controllerPluginManager);
 }
Ejemplo n.º 28
0
 public function setUp()
 {
     $this->setApplicationConfig(include dirname(dirname(dirname(dirname(dirname(dirname(__DIR__)))))) . '/config/application.config.php');
     $this->serviceManager = Bootstrap::getServiceManager();
     parent::setUp();
 }
Ejemplo n.º 29
0
 private function prepareEvent($forApi = false)
 {
     if ($forApi) {
         $controllerMock = $this->getMock(AbstractApiActionController::class);
     } else {
         $controllerMock = $this->getMock(AbstractActionController::class);
     }
     $routerFactory = new RouterFactory();
     $router = $routerFactory->createService(Bootstrap::getServiceManager());
     $event = new MvcEvent();
     $event->setTarget($controllerMock);
     $event->setRouter($router);
     $event->setResponse(new Response());
     return $event;
 }
 public function testCreate()
 {
     $result = $this->testedObject->createService(Bootstrap::getServiceManager());
     $this->assertInstanceOf(UsersRepository::class, $result);
 }