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/4838'
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ public function createInput($inputSpecification)
break;
case 'error_message':
$input->setErrorMessage($value);
break;
case 'fallback_value':
$input->setFallbackValue($value);
break;
Expand Down
15 changes: 14 additions & 1 deletion test/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 1214d4a

Please sign in to comment.