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

Commit

Permalink
Merge branch 'master' into feature/math-biginteger
Browse files Browse the repository at this point in the history
  • Loading branch information
denixport committed Jun 13, 2012
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/BaseInputFilter.php
Expand Up @@ -152,7 +152,7 @@ public function isValid()
foreach ($inputs as $name) {
$input = $this->inputs[$name];

if (!isset($this->data[$name])) {
if (!array_key_exists($name, $this->data)) {
// Not sure how to handle input filters in this case
if ($input instanceof InputFilterInterface) {
if (!$input->isValid()) {
Expand Down
19 changes: 19 additions & 0 deletions test/BaseInputFilterTest.php
Expand Up @@ -458,4 +458,23 @@ public function testCanRetrieveUnvalidatedButFilteredInputValue()
$test = $filter->getValue('foo');
$this->assertSame('bazbat', $test);
}

public function testGetRequiredNotEmptyValidationMessages()
{
$filter = new InputFilter();

$foo = new Input();
$foo->setRequired(true);
$foo->setAllowEmpty(false);

$filter->add($foo, 'foo');

$data = array('foo' => null);
$filter->setData($data);

$this->assertFalse($filter->isValid());
$messages = $filter->getMessages();
$this->assertArrayHasKey('foo', $messages);
$this->assertNotEmpty($messages['foo']);
}
}

0 comments on commit 956acc6

Please sign in to comment.