From 6ba750f81a23cdf5072f8ac3c5ff0f834c43931d Mon Sep 17 00:00:00 2001 From: blanchonvincent Date: Thu, 30 Aug 2012 12:28:44 +0200 Subject: [PATCH] Fix type for multicheckbox Fix type for multicheckbox and add unit tests --- library/Zend/Form/Element/MultiCheckbox.php | 9 +++++++++ tests/ZendTest/Form/View/Helper/FormElementTest.php | 3 +++ 2 files changed, 12 insertions(+) diff --git a/library/Zend/Form/Element/MultiCheckbox.php b/library/Zend/Form/Element/MultiCheckbox.php index 33f4d1c7e97..ac53f17f32d 100644 --- a/library/Zend/Form/Element/MultiCheckbox.php +++ b/library/Zend/Form/Element/MultiCheckbox.php @@ -21,6 +21,15 @@ */ class MultiCheckbox extends Checkbox { + /** + * Seed attributes + * + * @var array + */ + protected $attributes = array( + 'type' => 'multi_checkbox' + ); + /** * @var bool */ diff --git a/tests/ZendTest/Form/View/Helper/FormElementTest.php b/tests/ZendTest/Form/View/Helper/FormElementTest.php index b86fe15c34f..6b9931c46e8 100644 --- a/tests/ZendTest/Form/View/Helper/FormElementTest.php +++ b/tests/ZendTest/Form/View/Helper/FormElementTest.php @@ -112,10 +112,13 @@ public function testRendersMultiElementsAsExpected($type, $inputType, $additiona { if ($type === 'radio') { $element = new Element\Radio('foo'); + $this->assertEquals('radio', $element->getAttribute('type')); } elseif ($type === 'multi_checkbox') { $element = new Element\MultiCheckbox('foo'); + $this->assertEquals('multi_checkbox', $element->getAttribute('type')); } elseif ($type === 'select') { $element = new Element\Select('foo'); + $this->assertEquals('select', $element->getAttribute('type')); } else { $element = new Element('foo'); }