4 * Controller for validator test-cases.
6 class HTMLPurifier_ConfigSchema_ValidatorTestCase
extends UnitTestCase
9 protected $_path, $_parser, $_builder;
12 public function __construct($path) {
14 $this->_parser
= new HTMLPurifier_StringHashParser();
15 $this->_builder
= new HTMLPurifier_ConfigSchema_InterchangeBuilder();
16 parent
::__construct($path);
19 public function setup() {
20 $this->validator
= new HTMLPurifier_ConfigSchema_Validator();
23 function testValidator() {
24 $hashes = $this->_parser
->parseMultiFile($this->_path
);
25 $interchange = new HTMLPurifier_ConfigSchema_Interchange();
27 foreach ($hashes as $hash) {
28 if (!isset($hash['ID'])) {
29 if (isset($hash['ERROR'])) {
30 $this->expectException(
31 new HTMLPurifier_ConfigSchema_Exception($hash['ERROR'])
36 $this->_builder
->build($interchange, new HTMLPurifier_StringHash($hash));
38 $this->validator
->validate($interchange);