Prepended constants with C_ to avoid reserved words as per https://www.php.net/manual...
[htmlpurifier/darkodev.git] / tests / HTMLPurifier / ConfigSchema / ValidatorTestCase.php
blob29a9111616a6ec31303445ace9d64c283f6fda25
1 <?php
3 /**
4 * Controller for validator test-cases.
5 */
6 class HTMLPurifier_ConfigSchema_ValidatorTestCase extends UnitTestCase
9 protected $_path, $_parser, $_builder;
10 public $validator;
12 public function __construct($path)
14 $this->_path = $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();
29 $error = null;
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'])
37 continue;
39 $this->_builder->build($interchange, new HTMLPurifier_StringHash($hash));
41 $this->validator->validate($interchange);
42 $this->pass();
47 // vim: et sw=4 sts=4