0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-24 09:11:52 +00:00
htmlpurifier/tests/HTMLPurifier/ConfigSchema/Validator/ParseDefaultTest.php
Edward Z. Yang e83573a3ad Implement ParseDefault.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1608 48356398-32a2-884e-a903-53898d9a118a
2008-03-05 05:49:18 +00:00

35 lines
977 B
PHP

<?php
class HTMLPurifier_ConfigSchema_Validator_ParseDefaultTest extends HTMLPurifier_ConfigSchema_ValidatorHarness
{
public function testValidate() {
$arr = array(
'ID' => 'N.D',
'DEFAULT' => 'true',
'_TYPE' => 'bool',
'_NULL' => false,
);
$this->validator->validate($arr, $this->interchange);
$this->assertIdentical($arr, array(
'ID' => 'N.D',
'DEFAULT' => 'true',
'_TYPE' => 'bool',
'_NULL' => false,
'_DEFAULT' => true,
));
}
public function testValidateFail() {
$arr = array(
'ID' => 'N.D',
'DEFAULT' => '"asdf"',
'_TYPE' => 'int',
'_NULL' => true,
);
$this->expectSchemaException('Invalid type for default value in N.D: Expected type int, got string');
$this->validator->validate($arr, $this->interchange);
}
}