diff --git a/src/Step.php b/src/Step.php index 6478ce98c..a6d3b14c2 100644 --- a/src/Step.php +++ b/src/Step.php @@ -98,7 +98,7 @@ public function getBaseValue() */ public function setStep($step) { - $this->step = $step; + $this->step = (float) $step; return $this; } diff --git a/test/StepTest.php b/test/StepTest.php index 6ea703588..e349e5826 100644 --- a/test/StepTest.php +++ b/test/StepTest.php @@ -190,4 +190,18 @@ public function testEqualsMessageTemplates() $this->assertAttributeEquals($validator->getOption('messageTemplates'), 'messageTemplates', $validator); } + + public function testSetStepFloat() + { + $step = 0.01; + $this->_validator->setStep($step); + $this->assertAttributeSame($step, 'step', $this->_validator); + } + + public function testSetStepString() + { + $step = '0.01'; + $this->_validator->setStep($step); + $this->assertAttributeSame((float) $step, 'step', $this->_validator); + } }