diff --git a/library/Zend/Validator/Step.php b/library/Zend/Validator/Step.php index 6478ce98c9e..a6d3b14c2f0 100644 --- a/library/Zend/Validator/Step.php +++ b/library/Zend/Validator/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/tests/ZendTest/Validator/StepTest.php b/tests/ZendTest/Validator/StepTest.php index 6ea70358820..e349e5826a5 100644 --- a/tests/ZendTest/Validator/StepTest.php +++ b/tests/ZendTest/Validator/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); + } }