Skip to content

Commit

Permalink
Write Some Assertions for Validation Library (#10582)
Browse files Browse the repository at this point in the history
Add additional test coverage for validation methods.
  • Loading branch information
sohelrana820 authored and markstory committed Apr 27, 2017
1 parent f720507 commit 2c30c3f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/TestCase/Validation/ValidationTest.php
Expand Up @@ -168,6 +168,7 @@ public function testLengthBetween()

$this->assertFalse(Validation::lengthBetween('abcdefg', 1, 6));
$this->assertFalse(Validation::lengthBetween('ÆΔΩЖÇ', 1, 3));
$this->assertFalse(Validation::lengthBetween(1, 1, 3));
}

/**
Expand Down Expand Up @@ -619,6 +620,8 @@ public function testCc()
$this->assertTrue(Validation::cc('869958670174621', ['voyager']));
$this->assertTrue(Validation::cc('869921250068209', ['voyager']));
$this->assertTrue(Validation::cc('869972521242198', ['voyager']));
//Credit card number should not pass as array
$this->assertFalse(Validation::cc(['869972521242198'], ['voyager']));
}

/**
Expand Down Expand Up @@ -1960,6 +1963,7 @@ public function testEmail()
$this->assertFalse(Validation::email('abc@yahoo!.com'));
$this->assertFalse(Validation::email('abc@example_underscored.com'));
$this->assertFalse(Validation::email('raw@test.ra.ru....com'));
$this->assertFalse(Validation::email(1));
}

/**
Expand Down Expand Up @@ -2813,6 +2817,9 @@ public function testContainNonAlphaNumeric()
$this->assertFalse(Validation::containsNonAlphaNumeric('abcdef##', 3));
$this->assertFalse(Validation::containsNonAlphaNumeric('abc##def', 3));
$this->assertFalse(Validation::containsNonAlphaNumeric('ab#cd#ef', 3));

//Non alpha numeric should not pass as array
$this->assertFalse(Validation::containsNonAlphaNumeric(['abc#']));
}

/**
Expand Down

0 comments on commit 2c30c3f

Please sign in to comment.