"MinimumAge" rule must accept any kind of integer

This commit is contained in:
Kennedy Tedesco 2015-10-31 10:48:36 -02:00 committed by Henrique Moody
parent aaca258bed
commit b98595a5c0
2 changed files with 3 additions and 1 deletions

View file

@ -16,7 +16,7 @@ class MinimumAge extends AbstractRule
public function validate($input)
{
if (!is_int($this->age)) {
if (!filter_var($this->age, FILTER_VALIDATE_INT)) {
return false;
}

View file

@ -45,6 +45,8 @@ class MinimumAgeTest extends \PHPUnit_Framework_TestCase
array(18, 'Y-m-d', '1969-07-20'),
array(18, null, new \DateTime('1969-07-20')),
array(18, 'Y-m-d', new \DateTime('1969-07-20')),
array('18', 'Y-m-d', '1969-07-20'),
array(18.0, 'Y-m-d', '1969-07-20'),
);
}