Fix two minor bugs, updating Phorum and removing unused $dir variable.
[htmlpurifier/darkodev.git] / tests / HTMLPurifier / ConfigSchema / ValidatorTestCase.php
blob87fa14d0ddb87cf38f8fb40061dc8401c28bbf93
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) {
13 $this->_path = $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();
26 $error = null;
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'])
34 continue;
36 $this->_builder->build($interchange, new HTMLPurifier_StringHash($hash));
38 $this->validator->validate($interchange);
39 $this->pass();
44 // vim: et sw=4 sts=4