Browse files

Merge branch 'hotfix/4838'

Close #4838
  • Loading branch information...
2 parents 8ffb67a + 4c8623a commit e4f35ec9523f38901a9933460b782f6983acbb02 @weierophinney weierophinney committed Jul 19, 2013
Showing with 15 additions and 1 deletion.
  1. +1 −0 library/Zend/InputFilter/Factory.php
  2. +14 −1 tests/ZendTest/InputFilter/FactoryTest.php
View
1 library/Zend/InputFilter/Factory.php
@@ -212,6 +212,7 @@ public function createInput($inputSpecification)
break;
case 'error_message':
$input->setErrorMessage($value);
+ break;
case 'fallback_value':
$input->setFallbackValue($value);
break;
View
15 tests/ZendTest/InputFilter/FactoryTest.php
@@ -520,11 +520,24 @@ public function testConflictNameWithInputFilterType()
public function testCustomFactoryInCollection()
{
$factory = new CustomFactory();
- /** @var \Zend\InputFilter\CollectionInputFilter $inputFilter */
$inputFilter = $factory->createInputFilter(array(
'type' => 'collection',
'input_filter' => new InputFilter(),
));
$this->assertInstanceOf('ZendTest\InputFilter\TestAsset\CustomFactory', $inputFilter->getFactory());
}
+
+ /**
+ * @group 4838
+ */
+ public function testCanSetInputErrorMessage()
+ {
+ $factory = new Factory();
+ $input = $factory->createInput(array(
+ 'name' => 'test',
+ 'type' => 'Zend\InputFilter\Input',
+ 'error_message' => 'Custom error message',
+ ));
+ $this->assertEquals('Custom error message', $input->getErrorMessage());
+ }
}

0 comments on commit e4f35ec

Please sign in to comment.