Adding test for Validation::alphaNumeric() to check empty $check.

Corrected Validation::alphaNumeric() to return false if $this->check; is empty

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4665 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-03-23 18:01:36 +00:00
parent e03c12eea3
commit 2d0eaf517b
2 changed files with 6 additions and 0 deletions

View file

@ -124,6 +124,10 @@ class Validation extends Object {
$this->_extract($check);
}
if(empty($this->check)) {
return false;
}
$this->regex = '/[^\\dA-Z]/i';
if($this->_check() === true){
return false;

View file

@ -47,6 +47,7 @@ class ValidationTestCase extends UnitTestCase {
$this->assertFalse($validation->alphaNumeric("\t"));
$this->assertFalse($validation->alphaNumeric("\r"));
$this->assertFalse($validation->alphaNumeric(' '));
$this->assertFalse($validation->alphaNumeric(''));
}
function testAlphaNumericPassedAsArray(){
@ -61,6 +62,7 @@ class ValidationTestCase extends UnitTestCase {
$this->assertFalse($validation->alphaNumeric(array('check' => "\t")));
$this->assertFalse($validation->alphaNumeric(array('check' => "\r")));
$this->assertFalse($validation->alphaNumeric(array('check' => ' ')));
$this->assertFalse($validation->alphaNumeric(array('check' => '')));
}
function testBetween(){