Index: tests/Zend/Form/Element/MultiselectTest.php =================================================================== --- tests/Zend/Form/Element/MultiselectTest.php (revision 9195) +++ tests/Zend/Form/Element/MultiselectTest.php (working copy) @@ -253,6 +253,33 @@ $test = $this->element->getMultiOption('testing'); $this->assertEquals($options['testing'], $test); } + + public function testOptionsAreTranslatedWhenInASelectWithOptgroups() + { + $translations = array( + 'ThisShouldNotShow' => 'Foo Value', + 'ThisShouldNeverShow' => 'Bar Value' + ); + require_once 'Zend/Translate.php'; + $translate = new Zend_Translate('array', $translations, 'en'); + $translate->setLocale('en'); + + $options = array( + 'group' => array ( + 'foovalue' => 'ThisShouldNotShow', + 'barvalue' => 'ThisShouldNeverShow' + ) + ); + + $this->element->setTranslator($translate) + ->addMultiOptions($options); + + $html = $this->element->render($this->getView()); + foreach ($options['group'] as $value => $label) { + $this->assertNotContains($label, $html, $html); + $this->assertRegexp('/]*>' . $translations[$label] . '/s', $html, $html); + } + } public function testMultiselectIsArrayByDefault() {