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

Commit

Permalink
Merge branch 'hotfix/zendframework/zendframework#6028-baseinputfilter…
Browse files Browse the repository at this point in the history
…-nested-inputfilter-values'

Close zendframework/zendframework#6028
  • Loading branch information
Ocramius committed Apr 2, 2014
2 parents ba3710b + dbdcc3c commit 8790ff5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/BaseInputFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,11 @@ public function getValue($name)
));
}
$input = $this->inputs[$name];

if ($input instanceof InputFilterInterface) {
return $input->getValues();
}

return $input->getValue();
}

Expand Down
24 changes: 24 additions & 0 deletions test/InputFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,30 @@ public function testCanAddUsingSpecification()
$this->assertInstanceOf('Zend\InputFilter\InputInterface', $foo);
}

/**
* @covers \Zend\InputFilter\BaseInputFilter::getValue
*
* @group 6028
*/
public function testGetValueReturnsArrayIfNestedInputFilters()
{
$inputFilter = new InputFilter();
$inputFilter->add(new Input(), 'name');

$this->filter->add($inputFilter, 'people');

$data = array(
'people' => array(
'name' => 'Wanderson'
)
);

$this->filter->setData($data);
$this->assertTrue($this->filter->isValid());

$this->assertInternalType('array', $this->filter->getValue('people'));
}

/**
* @group ZF2-5648
*/
Expand Down

0 comments on commit 8790ff5

Please sign in to comment.