Skip to content

Commit

Permalink
Add pass/fail test for utf8extended.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jan 2, 2016
1 parent ca89846 commit bd798d9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/TestCase/Validation/ValidatorTest.php
Expand Up @@ -1417,12 +1417,29 @@ public function testAscii()
*/
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]));
}

/**
Expand Down

0 comments on commit bd798d9

Please sign in to comment.