Browse files

Adding the Unit testing method for the modification on

Zend/Form/Element/MultiCheckbox
  • Loading branch information...
1 parent 9d57fd9 commit 22768c61622cea9afa952b5d8d43df589f12c7f8 igor committed Sep 20, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 tests/ZendTest/Form/Element/MultiCheckboxTest.php
View
20 tests/ZendTest/Form/Element/MultiCheckboxTest.php
@@ -105,6 +105,26 @@ public function testInArrayValidationOfOptions($valueTests, $options)
$this->assertTrue($explodeValidator->isValid($valueTests));
}
+ /**
+ * Testing that InArray Validator Haystack is Updated if the Options
+ * are added after the validator is attached
+ *
+ * @dataProvider multiCheckboxOptionsDataProvider
+ */
+ public function testInArrayValidatorHaystakIsUpdated($valueTests, $options)
+ {
+ $element = new MultiCheckboxElement('my-checkbox');
+ $inputSpec = $element->getInputSpecification();
+ $inArrayValidator=$inputSpec['validators'][0]->getValidator();
+
+ $element->setAttributes(array(
+ 'options' => $options,
+ ));
+ $haystack=$inArrayValidator->getHaystack();
+ $this->assertCount(count($options), $haystack);
+ }
+
+
public function testAttributeType()
{
$element = new MultiCheckboxElement();

0 comments on commit 22768c6

Please sign in to comment.