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:
34
tests/HTMLPurifier/ConfigSchema/Validator/ParseTypeTest.php
Normal file
34
tests/HTMLPurifier/ConfigSchema/Validator/ParseTypeTest.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user