Browse Source

Add pass/fail test for utf8extended.

Mark Story 10 years ago
parent
commit
bd798d9fd7
1 changed files with 17 additions and 0 deletions
  1. 17 0
      tests/TestCase/Validation/ValidatorTest.php

+ 17 - 0
tests/TestCase/Validation/ValidatorTest.php

@@ -1417,12 +1417,29 @@ class ValidatorTest extends TestCase
      */
     public function testUtf8()
     {
+        // Grinning face
+        $extended = 'some' . "\xf0\x9f\x98\x80" . 'value';
         $validator = new Validator();
+
         $this->assertProxyMethod($validator, 'utf8', null, [['extended' => false]]);
         $this->assertEmpty($validator->errors(['username' => 'ü']));
+        $this->assertNotEmpty($validator->errors(['username' => $extended]));
+    }
+
+    /**
+     * Test utf8extended proxy method.
+     *
+     * @return void
+     */
+    public function testUtf8Extended()
+    {
+        // Grinning face
+        $extended = 'some' . "\xf0\x9f\x98\x80" . 'value';
+        $validator = new Validator();
 
         $this->assertProxyMethod($validator, 'utf8Extended', null, [['extended' => true]], 'utf8');
         $this->assertEmpty($validator->errors(['username' => 'ü']));
+        $this->assertEmpty($validator->errors(['username' => $extended]));
     }
 
     /**