Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
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 @@ -413,4 +413,14 @@ public function testFactoryAllowsPassingFilterChainsInInputSpec()
$test = $input->getFilterChain();
$this->assertSame($chain, $test);
}

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 bc78b89

Please sign in to comment.