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

BC break introduced in 2.8.4 #103

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions test/FormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,35 @@ public function testSettingValidationGroupBindsOnlyThoseValuesToModel()
$this->assertObjectNotHasAttribute('foobar', $model);
}

public function testSettingValidationGroupWithoutCollectionBindsOnlyThoseValuesToModel()
{
$model = new stdClass;
$dataWithoutCollection = [
'foo' => 'abcde'
];
$this->populateForm();
$this->form->add([
'type' => 'Zend\Form\Element\Collection',
'name' => 'categories',
'options' => [
'count' => 0,
'target_element' => [
'type' => 'ZendTest\Form\TestAsset\CategoryFieldset'
]
]
]);
$this->form->setHydrator(new Hydrator\ObjectProperty());
$this->form->bind($model);
$this->form->setData($dataWithoutCollection);
$this->form->setValidationGroup(array('foo'));
$this->form->isValid();

$this->assertObjectHasAttribute('foo', $model);
$this->assertEquals('abcde', $model->foo);
$this->assertObjectNotHasAttribute('categories', $model);
$this->assertObjectNotHasAttribute('foobar', $model);
}

public function testCanBindModelsToArraySerializableObjects()
{
$model = new TestAsset\Model();
Expand Down