Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/3164'
Browse files Browse the repository at this point in the history
Close #3164
  • Loading branch information
weierophinney committed Dec 11, 2012
2 parents e164982 + 3b34b8b commit f55af9b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/Zend/Validator/Step.php
Expand Up @@ -98,7 +98,7 @@ public function getBaseValue()
*/ */
public function setStep($step) public function setStep($step)
{ {
$this->step = $step; $this->step = (float) $step;
return $this; return $this;
} }


Expand Down
14 changes: 14 additions & 0 deletions tests/ZendTest/Validator/StepTest.php
Expand Up @@ -190,4 +190,18 @@ public function testEqualsMessageTemplates()
$this->assertAttributeEquals($validator->getOption('messageTemplates'), $this->assertAttributeEquals($validator->getOption('messageTemplates'),
'messageTemplates', $validator); '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.