diff --git a/src/Validator/Float.php b/src/Validator/Float.php index af146089..746ef33c 100644 --- a/src/Validator/Float.php +++ b/src/Validator/Float.php @@ -162,6 +162,8 @@ public function isValid($value) //We have seperators, and they are flipped. i.e. 2.000,000 for en-US if ($groupSeparatorPosition && $decSeparatorPosition && $groupSeparatorPosition > $decSeparatorPosition) { + $this->error(self::NOT_FLOAT); + return false; } @@ -237,6 +239,8 @@ public function isValid($value) return true; } + $this->error(self::NOT_FLOAT); + return false; } } diff --git a/test/Validator/FloatTest.php b/test/Validator/FloatTest.php index d418a76a..bd9a9cec 100644 --- a/test/Validator/FloatTest.php +++ b/test/Validator/FloatTest.php @@ -220,4 +220,16 @@ public function testEqualsMessageTemplates() $validator = $this->validator; $this->assertAttributeEquals($validator->getOption('messageTemplates'), 'messageTemplates', $validator); } + + /** + * @group 6647 + * @group 6648 + */ + public function testNotFloat() + { + $this->assertFalse($this->validator->isValid('2.000.000,00')); + + $message = $this->validator->getMessages(); + $this->assertContains('does not appear to be a float', $message['notFloat']); + } }