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