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