Adding tests for multibyte validation.

This commit is contained in:
mark_story 2009-09-29 00:19:34 -04:00
parent 2c144a9d0d
commit fc0e50f64a

View file

@ -177,7 +177,10 @@ class ValidationTest extends CakeTestCase {
function testBetween() { function testBetween() {
$this->assertTrue(Validation::between('abcdefg', 1, 7)); $this->assertTrue(Validation::between('abcdefg', 1, 7));
$this->assertTrue(Validation::between('', 0, 7)); $this->assertTrue(Validation::between('', 0, 7));
$this->assertTrue(Validation::between('אกあアꀀ豈', 1, 7));
$this->assertFalse(Validation::between('abcdefg', 1, 6)); $this->assertFalse(Validation::between('abcdefg', 1, 6));
$this->assertFalse(Validation::between('ÆΔΩЖÇ', 1, 3));
} }
/** /**
@ -1698,7 +1701,10 @@ class ValidationTest extends CakeTestCase {
function testMaxLength() { function testMaxLength() {
$this->assertTrue(Validation::maxLength('ab', 3)); $this->assertTrue(Validation::maxLength('ab', 3));
$this->assertTrue(Validation::maxLength('abc', 3)); $this->assertTrue(Validation::maxLength('abc', 3));
$this->assertTrue(Validation::maxLength('ÆΔΩЖÇ', 10));
$this->assertFalse(Validation::maxLength('abcd', 3)); $this->assertFalse(Validation::maxLength('abcd', 3));
$this->assertFalse(Validation::maxLength('ÆΔΩЖÇ', 3));
} }
/** /**
@ -1709,8 +1715,11 @@ class ValidationTest extends CakeTestCase {
*/ */
function testMinLength() { function testMinLength() {
$this->assertFalse(Validation::minLength('ab', 3)); $this->assertFalse(Validation::minLength('ab', 3));
$this->assertFalse(Validation::minLength('ÆΔΩЖÇ', 10));
$this->assertTrue(Validation::minLength('abc', 3)); $this->assertTrue(Validation::minLength('abc', 3));
$this->assertTrue(Validation::minLength('abcd', 3)); $this->assertTrue(Validation::minLength('abcd', 3));
$this->assertTrue(Validation::minLength('ÆΔΩЖÇ', 2));
} }
/** /**