Skip to content

Commit

Permalink
Ensure populateValues() calls setValue()
Browse files Browse the repository at this point in the history
- instead of setAttribute('value', ...)
  • Loading branch information
weierophinney committed Jul 25, 2012
1 parent 437ff0b commit 3530224
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion library/Zend/Form/Fieldset.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public function populateValues($data)
continue;
}

$element->setAttribute('value', $value);
$element->setValue($value);
}
}

Expand Down
10 changes: 5 additions & 5 deletions tests/Zend/Form/FormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ public function testSetsInputFilterToFilterFromBoundModelIfModelImplementsInputL
$this->assertSame($model->getInputFilter(), $this->form->getInputFilter());
}

public function testSettingDataShouldSetElementValueAttributes()
public function testSettingDataShouldSetElementValues()
{
$this->populateForm();
$data = array(
Expand All @@ -507,10 +507,10 @@ public function testSettingDataShouldSetElementValueAttributes()
$fieldset = $this->form->get('foobar');
foreach (array('foo', 'bar') as $name) {
$element = $this->form->get($name);
$this->assertEquals($data[$name], $element->getAttribute('value'));
$this->assertEquals($data[$name], $element->getValue());

$element = $fieldset->get($name);
$this->assertEquals($data[$name], $element->getAttribute('value'));
$this->assertEquals($data[$name], $element->getValue());
}
}

Expand All @@ -524,9 +524,9 @@ public function testElementValuesArePopulatedFollowingBind()
$this->form->bind($object);

$foo = $this->form->get('foo');
$this->assertEquals('foobar', $foo->getAttribute('value'));
$this->assertEquals('foobar', $foo->getValue());
$bar = $this->form->get('bar');
$this->assertEquals('barbaz', $bar->getAttribute('value'));
$this->assertEquals('barbaz', $bar->getValue());
}

public function testUsesBoundObjectAsDataSourceWhenNoDataSet()
Expand Down

0 comments on commit 3530224

Please sign in to comment.