From fc0e50f64aa09a36357d6928dce0b1b65a968bb9 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 29 Sep 2009 00:19:34 -0400 Subject: [PATCH] Adding tests for multibyte validation. --- cake/tests/cases/libs/validation.test.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cake/tests/cases/libs/validation.test.php b/cake/tests/cases/libs/validation.test.php index 5893a8bc7..ac66c4a28 100644 --- a/cake/tests/cases/libs/validation.test.php +++ b/cake/tests/cases/libs/validation.test.php @@ -177,7 +177,10 @@ class ValidationTest extends CakeTestCase { function testBetween() { $this->assertTrue(Validation::between('abcdefg', 1, 7)); $this->assertTrue(Validation::between('', 0, 7)); + $this->assertTrue(Validation::between('אกあアꀀ豈', 1, 7)); + $this->assertFalse(Validation::between('abcdefg', 1, 6)); + $this->assertFalse(Validation::between('ÆΔΩЖÇ', 1, 3)); } /** @@ -1698,7 +1701,10 @@ class ValidationTest extends CakeTestCase { function testMaxLength() { $this->assertTrue(Validation::maxLength('ab', 3)); $this->assertTrue(Validation::maxLength('abc', 3)); + $this->assertTrue(Validation::maxLength('ÆΔΩЖÇ', 10)); + $this->assertFalse(Validation::maxLength('abcd', 3)); + $this->assertFalse(Validation::maxLength('ÆΔΩЖÇ', 3)); } /** @@ -1709,8 +1715,11 @@ class ValidationTest extends CakeTestCase { */ function testMinLength() { $this->assertFalse(Validation::minLength('ab', 3)); + $this->assertFalse(Validation::minLength('ÆΔΩЖÇ', 10)); + $this->assertTrue(Validation::minLength('abc', 3)); $this->assertTrue(Validation::minLength('abcd', 3)); + $this->assertTrue(Validation::minLength('ÆΔΩЖÇ', 2)); } /**