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

[3.1.0] Implement Duplicate validator, also modify some design things

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1596 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2008-03-04 04:13:07 +00:00
parent 1b434f0ecc
commit 4c798bd17e
8 changed files with 68 additions and 17 deletions

View File

@@ -0,0 +1,25 @@
<?php
class HTMLPurifier_ConfigSchema_Validator_DuplicateTest extends HTMLPurifier_ConfigSchema_ValidatorHarness
{
public function setup() {
parent::setup();
$this->validator = new HTMLPurifier_ConfigSchema_Validator_Duplicate();
}
public function testValidateNamespace() {
$this->interchange->addNamespace(array('ID' => 'Namespace'));
$this->expectSchemaException('Cannot redefine namespace');
$arr = array('ID' => 'Namespace');
$this->validator->validate($arr, $this->interchange);
}
public function testValidateDirective() {
$this->interchange->addDirective(array('ID' => 'Namespace.Directive'));
$this->expectSchemaException('Cannot redefine directive');
$arr = array('ID' => 'Namespace.Directive');
$this->validator->validate($arr, $this->interchange);
}
}

View File

@@ -6,8 +6,7 @@ class HTMLPurifier_ConfigSchema_ValidatorHarness extends UnitTestCase
protected $interchange, $validator;
public function setup() {
generate_mock_once('HTMLPurifier_ConfigSchema_Interchange');
$this->interchange = new HTMLPurifier_ConfigSchema_InterchangeMock();
$this->interchange = new HTMLPurifier_ConfigSchema_Interchange();
}
protected function expectSchemaException($msg) {