mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-31 03:10:09 +02:00
Implement ParseDefault.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1608 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user