mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 00:48:25 +00:00
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:
parent
e03c12eea3
commit
2d0eaf517b
2 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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(){
|
||||
|
|
Loading…
Add table
Reference in a new issue