Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow specification of error message via Factory

  • Loading branch information...
commit 33f556efbb252d8ad2b9879c7d9f0385faea173c 1 parent b11af3f
@davidwindell authored
View
3  library/Zend/InputFilter/Factory.php
@@ -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;
View
10 tests/ZendTest/InputFilter/FactoryTest.php
@@ -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());
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.