Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

Commit 477755e

Browse files
committed
Merge branch 'hotfix/5970' into develop
Forward port #5970
2 parents 672b84f + fdf9caa commit 477755e

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

library/Zend/Form/Element/Radio.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Radio extends MultiCheckbox
2929
*/
3030
protected function getValidator()
3131
{
32-
if (null === $this->validator) {
32+
if (null === $this->validator && !$this->disableInArrayValidator()) {
3333
$this->validator = new InArrayValidator(array(
3434
'haystack' => $this->getValueOptionsValues(),
3535
'strict' => false,

tests/ZendTest/Form/Element/RadioTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,18 @@ public function testInArrayValidationOfOptions($valueTests, $options)
8585
$this->assertTrue($inArrayValidator->isValid($valueToTest));
8686
}
8787
}
88+
89+
public function testDisableInputSpecification()
90+
{
91+
$element = new RadioElement();
92+
$element->setValueOptions(array(
93+
'Option 1' => 'option1',
94+
'Option 2' => 'option2',
95+
'Option 3' => 'option3',
96+
));
97+
$element->setDisableInArrayValidator(true);
98+
99+
$inputSpec = $element->getInputSpecification();
100+
$this->assertArrayNotHasKey('validators', $inputSpec);
101+
}
88102
}

0 commit comments

Comments
 (0)