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

Remove decorator pattern from validator; we'll only have one decorator which invokes the subsystem.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1586 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2008-03-02 02:57:31 +00:00
parent fa6b6fe85f
commit d81bcbd208
10 changed files with 87 additions and 99 deletions

View File

@@ -1,23 +0,0 @@
<?php
class HTMLPurifier_ConfigSchema_Interchange_Validator_IdExistsTest extends HTMLPurifier_ConfigSchema_Interchange_ValidatorHarness
{
public function setup() {
parent::setup();
$this->validator = new HTMLPurifier_ConfigSchema_Interchange_Validator_IdExists($this->mock);
}
public function testNamespace() {
$this->mock->expectNever('addNamespace');
$this->expectSchemaException('Namespace must have ID');
$this->validator->addNamespace();
}
public function testDirective() {
$this->mock->expectNever('addDirective');
$this->expectSchemaException('Directive must have ID');
$this->validator->addDirective();
}
}

View File

@@ -0,0 +1,23 @@
<?php
class HTMLPurifier_ConfigSchema_Validator_IdExistsTest extends HTMLPurifier_ConfigSchema_ValidatorHarness
{
public function setup() {
parent::setup();
$this->validator = new HTMLPurifier_ConfigSchema_Validator_IdExists();
}
public function testValidateNamespace() {
$this->expectSchemaException('ID must exist in namespace');
$arr = array();
$this->validator->validateNamespace($arr, $this->interchange);
}
public function testValidateDirective() {
$this->expectSchemaException('ID must exist in directive');
$arr = array();
$this->validator->validateDirective($arr, $this->interchange);
}
}

View File

@@ -1,14 +1,13 @@
<?php
class HTMLPurifier_ConfigSchema_Interchange_ValidatorHarness extends UnitTestCase
class HTMLPurifier_ConfigSchema_ValidatorHarness extends UnitTestCase
{
protected $validator;
protected $mock;
protected $interchange, $validator;
public function setup() {
generate_mock_once('HTMLPurifier_ConfigSchema_Interchange');
$this->mock = new HTMLPurifier_ConfigSchema_InterchangeMock();
$this->interchange = new HTMLPurifier_ConfigSchema_InterchangeMock();
}
protected function expectSchemaException($msg) {