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/4117' into develop
Browse files Browse the repository at this point in the history
Forward port zendframework/zendframework#4117

Conflicts:
	tests/ZendTest/InputFilter/FactoryTest.php
  • Loading branch information
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ public function createInput($inputSpecification)
$input->setRequired(!$value);
}
break;
case 'error_message':
$input->setErrorMessage($value);
break;
case 'fallback_value':
$input->setFallbackValue($value);
break;
Expand Down
10 changes: 10 additions & 0 deletions test/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,4 +428,14 @@ public function testFactoryAcceptsCollectionInputFilter()
$this->assertInstanceOf('Zend\InputFilter\InputFilter', $inputFilter->getInputFilter());
$this->assertEquals(3, $inputFilter->getCount());
}

public function testFactoryWillCreateInputWithErrorMessage()
{
$factory = new Factory();
$input = $factory->createInput(array(
'name' => 'foo',
'error_message' => 'My custom error message',
));
$this->assertEquals('My custom error message', $input->getErrorMessage());
}
}

0 comments on commit 06503d1

Please sign in to comment.