1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-31 03:10:09 +02:00

Add ParseType validator.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1600 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2008-03-04 14:33:38 +00:00
parent c0b5bc3eea
commit b9eb44bf03
4 changed files with 67 additions and 2 deletions

View File

@@ -0,0 +1,34 @@
<?php
class HTMLPurifier_ConfigSchema_Validator_ParseTypeTest extends HTMLPurifier_ConfigSchema_ValidatorHarness
{
public function testValidatePlain() {
$arr = array('ID' => 'N.D', 'TYPE' => 'string');
$this->validator->validate($arr, $this->interchange);
$this->assertIdentical($arr, array(
'ID' => 'N.D',
'TYPE' => 'string',
'_TYPE' => 'string',
'_NULL' => false,
));
}
public function testValidateWithNull() {
$arr = array('ID' => 'N.D', 'TYPE' => 'int/null');
$this->validator->validate($arr, $this->interchange);
$this->assertIdentical($arr, array(
'ID' => 'N.D',
'TYPE' => 'int/null',
'_TYPE' => 'int',
'_NULL' => true,
));
}
public function testValidateInvalidType() {
$arr = array('ID' => 'N.D', 'TYPE' => 'aint/null');
$this->expectSchemaException('Invalid type aint for configuration directive N.D');
$this->validator->validate($arr, $this->interchange);
}
}