/** * ASCII 以外の文字を含む引数に対する validate() のテストです. * NameChar および NameStartChar の定義に従って与えられた UTF-8 のバリデーションが出来ることを確認します. * * @covers Peach\Markup\NameValidator::validate * @covers Peach\Markup\NameValidator::validateNameStartChar * @covers Peach\Markup\NameValidator::validateNameChar * @covers Peach\Markup\NameValidator_Range::validate */ public function testValidateUtf8Name() { $invalid = array("", chr(0xc2) . chr(0xb7) . "ABC", "foo" . chr(0xc3) . chr(0x97) . "bar", "test" . chr(0xe2) . chr(0x80) . chr(0xbb)); $valid = array(implode("", array_map("chr", array(0xe3, 0x83, 0x86, 0xe3, 0x82, 0xb9, 0xe3, 0x83, 0x88))), implode("", array_map("chr", array(0x41, 0xe2, 0x81, 0x80, 0x42)))); foreach ($invalid as $name) { $this->assertFalse(NameValidator::validate($name)); } foreach ($valid as $name) { $this->assertTrue(NameValidator::validate($name)); } }
public function __construct(\Happymeal\Port\Adaptor\Data\XML\Schema\NCName $tdo, \Happymeal\Port\Adaptor\Data\ValidationHandler $handler) { parent::__construct($tdo, $handler); }