Beispiel #1
0
 /**
  * @group ZF-11609
  */
 public function testIndividualDecoratorsBeforeAndAfterRendering()
 {
     // Disable default decorators is true
     $element = new Zend_Form_Element_Captcha('foo', array('captcha' => 'Dumb', 'captchaOptions' => array('sessionClass' => 'Zend_Form_Element_CaptchaTest_SessionContainer'), 'disableLoadDefaultDecorators' => true, 'decorators' => array('Description', 'Errors', 'Captcha_Word', 'Captcha', 'Label')));
     // Before rendering
     $decorators = array_keys($element->getDecorators());
     $this->assertSame(array('Zend_Form_Decorator_Description', 'Zend_Form_Decorator_Errors', 'Zend_Form_Decorator_Captcha_Word', 'Zend_Form_Decorator_Captcha', 'Zend_Form_Decorator_Label'), $decorators, var_export($decorators, true));
     $element->render();
     // After rendering
     $decorators = array_keys($element->getDecorators());
     $this->assertSame(array('Zend_Form_Decorator_Description', 'Zend_Form_Decorator_Errors', 'Zend_Form_Decorator_Captcha_Word', 'Zend_Form_Decorator_Captcha', 'Zend_Form_Decorator_Label'), $decorators, var_export($decorators, true));
     // Disable default decorators is false
     $element = new Zend_Form_Element_Captcha('foo', array('captcha' => 'Dumb', 'captchaOptions' => array('sessionClass' => 'Zend_Form_Element_CaptchaTest_SessionContainer'), 'decorators' => array('Description', 'Errors', 'Captcha_Word', 'Captcha', 'Label')));
     // Before rendering
     $decorators = array_keys($element->getDecorators());
     $this->assertSame(array('Zend_Form_Decorator_Description', 'Zend_Form_Decorator_Errors', 'Zend_Form_Decorator_Captcha_Word', 'Zend_Form_Decorator_Captcha', 'Zend_Form_Decorator_Label'), $decorators, var_export($decorators, true));
     $element->render();
     // After rendering
     $decorators = array_keys($element->getDecorators());
     $this->assertSame(array('Zend_Form_Decorator_Description', 'Zend_Form_Decorator_Errors', 'Zend_Form_Decorator_Captcha_Word', 'Zend_Form_Decorator_Captcha', 'Zend_Form_Decorator_Label'), $decorators, var_export($decorators, true));
 }