Skip to content

Commit

Permalink
[zendframework#7109] Falsy disabled values should not skip binding
Browse files Browse the repository at this point in the history
- Added unit test for behavior added with this pull request
  • Loading branch information
weierophinney committed Jan 13, 2015
1 parent 0f81f51 commit e0684ef
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/ZendTest/Form/FieldsetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,31 @@ public function testBindValuesSkipDisabled()
$this->assertEquals('notModified', $object->disabled);
}

/**
* @group 7109
*/
public function testBindValuesDoesNotSkipElementsWithFalsyDisabledValues()
{
$object = new \stdClass();
$object->disabled = 'notModified';
$object->not_disabled = 'notModified';

$textInput = new Element\Text('not_disabled');
$disabledInput = new Element\Text('disabled');
$disabledInput->setAttribute('disabled', '');

$form = new Form();
$form->add($textInput);
$form->add($disabledInput);

$form->setObject($object);
$form->setHydrator(new \Zend\Stdlib\Hydrator\ObjectProperty());
$form->bindValues(array('not_disabled' => 'modified', 'disabled' => 'modified'));

$this->assertEquals('modified', $object->not_disabled);
$this->assertEquals('modified', $object->disabled);
}

public function testSetObjectWithStringRaisesException()
{
$this->setExpectedException('Zend\Form\Exception\InvalidArgumentException');
Expand Down

0 comments on commit e0684ef

Please sign in to comment.