Ejemplo n.º 1
0
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $renderer = new Renderer();
     $pluginManager = new RulePluginManager();
     $pluginManager->setServiceLocator($serviceLocator);
     $renderer->setRulePluginManager($pluginManager);
     return $renderer;
 }
Ejemplo n.º 2
0
 public function testIfRulesAreResetWithMultipleForms()
 {
     $form1 = $this->createForm('test', 'customEmailName');
     $inputFilter1 = new InputFilter();
     $inputFilter1->add(array('name' => 'email', 'required' => true, 'validators' => array(array('name' => 'emailAddress'))));
     $inputFilter1->add(array('name' => 'name', 'required' => true));
     $form1->setInputFilter($inputFilter1);
     $this->renderer->preRenderForm('test', $this->view);
     $form2 = $this->createForm('test2', 'email');
     $inputFilter2 = new InputFilter();
     $inputFilter2->add(array('name' => 'otherfieldname', 'required' => true, 'validators' => array(array('name' => 'emailAddress'))));
     $inputFilter2->add(array('name' => 'name', 'required' => true));
     $form2->setInputFilter($inputFilter2);
     $this->renderer->preRenderForm('test2', $this->view);
     $inlineScript = $this->view->plugin('inlineScript');
     $inlineString = preg_replace('/(\\r\\n|\\r|\\n|\\t)+/', '', $inlineScript->toString());
     $explodedString = explode('form[name="test2"]', $inlineString);
     $lastPart = end($explodedString);
     $this->assertNotContains('customEmailName', $lastPart);
 }