Esempio n. 1
0
 /**
  * testPreRenderInputFieldIsCalledOnInnerRenderers
  */
 public function testPreRenderInputFieldIsCalledOnInnerRenderers()
 {
     $elemMock = $this->getMock('Zend\\Form\\ElementInterface');
     /** @var $renderer \PHPUnit_Framework_MockObject_MockObject */
     foreach ($this->rendererCollection->getRenderers() as $renderer) {
         $renderer->expects($this->once())->method('preRenderInputField')->with($this->equalTo($elemMock));
     }
     $this->rendererCollection->preRenderInputField($elemMock);
 }
Esempio n. 2
0
 /**
  * Create service
  *
  * @param  ServiceLocatorInterface                 $serviceLocator
  * @return \StrokerForm\Renderer\RendererInterface
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /** @var $options \StrokerForm\Options\ModuleOptions */
     $options = $serviceLocator->get('StrokerForm\\Options\\ModuleOptions');
     $rendererCollection = new RendererCollection();
     foreach ($options->getActiveRenderers() as $rendererAlias) {
         /** @var $renderer \StrokerForm\Renderer\RendererInterface */
         $renderer = $serviceLocator->get($rendererAlias);
         $renderer->setDefaultOptions($options->getRendererOptions($rendererAlias));
         $renderer->setFormManager($serviceLocator->get('StrokerForm\\FormManager'));
         if ($serviceLocator->has('translator')) {
             $renderer->setTranslator($serviceLocator->get('translator'));
         }
         $renderer->setHttpRouter($serviceLocator->get('HttpRouter'));
         $rendererCollection->addRenderer($renderer);
     }
     return $rendererCollection;
 }