Permalink
Browse files

Merge branch 'hotfix/3164'

Close #3164
  • Loading branch information...
2 parents e164982 + 3b34b8b commit f55af9bd182114409fb0f4b64ed458a4d9cc64ee @weierophinney weierophinney committed Dec 11, 2012
Showing with 15 additions and 1 deletion.
  1. +1 −1 library/Zend/Validator/Step.php
  2. +14 −0 tests/ZendTest/Validator/StepTest.php
View
2 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;
}
View
14 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);
+ }
}

0 comments on commit f55af9b

Please sign in to comment.