Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Correct tests for group multicheckbox & radio attributes #4232

Closed
wants to merge 1 commit into from

2 participants

@Chintanvpatel

Correct test cases for group multicheckbox & radio attributes.

@weierophinney weierophinney commented on the diff
...s/ZendTest/Form/View/Helper/FormMultiCheckboxTest.php
((18 lines not shown))
+ $this->assertRegexp('#disabled="disabled" value="value1"#', $markup);
+
+ }
+
+ public function testGetSelectedAttributeForGroupReturnTrue()
+ {
+ $element = new MultiCheckboxElement('foo');
+ $element->setAttribute('selected', 'true' );
+ $element->setValueOptions(array(
+ array(
+ 'label' => 'label1',
+ 'value' => 'value1',
+ ),
+ ));
+ $markup = $this->helper->render($element);
+ $this->assertRegexp('#selected="selected" value="value1"#', $markup);
@weierophinney Owner

This doesn't make sense, and actually fails currently. "selected" is an invalid and unrecognized attribute for checkboxes. It should instead verify that the markup contains 'checked="checked"'. I'll make that change on merge.

Yes. I made mistake in hurry :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/4232'
Close #4232
73f7ad2
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/4232' into develop
Forward port #4232
7bfc629
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 26 additions and 3 deletions.
  1. +26 −3 tests/ZendTest/Form/View/Helper/FormMultiCheckboxTest.php
View
29 tests/ZendTest/Form/View/Helper/FormMultiCheckboxTest.php
@@ -365,11 +365,34 @@ public function testGetUncheckedValueSetToFoo()
$this->assertSame('foo', $uncheckedValue);
}
- public function testGetDisableAttributeReturnTrue()
+ public function testGetDisableAttributeForGroupReturnTrue()
{
$element = new MultiCheckboxElement('foo');
- $element->setAttribute('disabled', 'true' );
- $this->assertSame('true', $element->getAttribute('disabled'));
+ $element->setAttribute('disabled', 'true' );
+ $element->setValueOptions(array(
+ array(
+ 'label' => 'label1',
+ 'value' => 'value1',
+ ),
+ ));
+ $markup = $this->helper->render($element);
+ $this->assertRegexp('#disabled="disabled" value="value1"#', $markup);
+
+ }
+
+ public function testGetSelectedAttributeForGroupReturnTrue()
+ {
+ $element = new MultiCheckboxElement('foo');
+ $element->setAttribute('selected', 'true' );
+ $element->setValueOptions(array(
+ array(
+ 'label' => 'label1',
+ 'value' => 'value1',
+ ),
+ ));
+ $markup = $this->helper->render($element);
+ $this->assertRegexp('#selected="selected" value="value1"#', $markup);
@weierophinney Owner

This doesn't make sense, and actually fails currently. "selected" is an invalid and unrecognized attribute for checkboxes. It should instead verify that the markup contains 'checked="checked"'. I'll make that change on merge.

Yes. I made mistake in hurry :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
}
}
Something went wrong with that request. Please try again.