/** * @dataProvider provideCaptchaAdapterKeys */ public function testCreateService($captchaAdapterKey) { $config = (include __DIR__ . '/../../../../../config/captcha.config.php'); $this->serviceLocator->get('Config')->willReturn($config); $application = $this->prophesize('Zend\\Mvc\\Application'); $mvcEvent = $this->prophesize('Zend\\Mvc\\MvcEvent'); $application->getMvcEvent()->willReturn($mvcEvent); $request = $this->prophesize('Zend\\Http\\PhpEnvironment\\Request'); $request->getQuery('captcha_adapter', 0)->willReturn($captchaAdapterKey); $mvcEvent->getRequest()->willReturn($request); $this->serviceLocator->get('Application')->willReturn($application); $result = $this->factory->createService($this->formElementManager->reveal()); $this->assertInstanceOf('LearnZF2Captcha\\Form\\CaptchaForm', $result); }