public function setUp() { $this->formElementManager = $this->prophesize('Zend\\Mvc\\Controller\\ControllerManager'); $this->serviceLocator = $this->prophesize('Zend\\ServiceManager\\ServiceLocatorInterface'); $this->formElementManager->getServiceLocator()->willReturn($this->serviceLocator); $factory = new CaptchaFormFactory(); $this->factory = $factory; }
/** * __invoke * * @param FormElementManager $formElementManager The form element manager. * @param string $name The name of the form to create. * @param string $requestedName The requested name of the form to create. * * @return Login */ public function __invoke(FormElementManager $formElementManager, $name, $requestedName) { /** @var ServiceManager $serviceManager */ $serviceManager = $formElementManager->getServiceLocator(); /** @var AuthenticationOptions $authenticationOptions */ $authenticationOptions = $serviceManager->get('ArpAuth\\Service\\AuthenticationOptions'); return new Login($authenticationOptions, 'login'); }
/** * @param FormElementManager $formElementManager * * @return CurrencySelect */ public function __invoke(FormElementManager $formElementManager) { $serviceManager = $formElementManager->getServiceLocator(); $config = $serviceManager->get('Config'); if (!isset($config['money']['currencies'])) { throw new InvalidArgumentException('Couldn\'t find currencies configuration.'); } $select = new CurrencySelect(); $select->setValueOptions($config['money']['currencies']); return $select; }