diff --git a/src/Factory.php b/src/Factory.php index 80f1ffa6..b1f74b0a 100644 --- a/src/Factory.php +++ b/src/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; diff --git a/test/FactoryTest.php b/test/FactoryTest.php index 6243f98a..d5c78f4e 100644 --- a/test/FactoryTest.php +++ b/test/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()); + } }