/** * @group ZF-11609 */ public function testIndividualDecoratorsBeforeAndAfterRendering() { // Disable default decorators is true $element = new CaptchaElement('foo', array('captcha' => 'Dumb', 'captchaOptions' => array('sessionClass' => 'ZendTest\\Form\\Element\\TestAsset\\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 CaptchaElement('foo', array('captcha' => 'Dumb', 'captchaOptions' => array('sessionClass' => 'ZendTest\\Form\\Element\\TestAsset\\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)); }