Typofix.
[htmlpurifier.git] / tests / HTMLPurifier / VarParserHarness.php
blob0ef23189c349694feaf079b4c8c5b3b8a13aea34
1 <?php
3 class HTMLPurifier_VarParserHarness extends UnitTestCase
6 protected $parser;
8 public function setup() {
9 $class = substr(get_class($this), 0, -4);
10 $this->parser = new $class();
13 function assertValid($var, $type, $ret = null) {
14 $ret = ($ret === null) ? $var : $ret;
15 $this->assertIdentical($this->parser->parse($var, $type), $ret);
18 function assertInvalid($var, $type, $msg = null) {
19 $caught = false;
20 try {
21 $this->parser->parse($var, $type);
22 } catch (HTMLPurifier_VarParserException $e) {
23 $caught = true;
24 if ($msg !== null) $this->assertIdentical($e->getMessage(), $msg);
26 if (!$caught) {
27 $this->fail('Did not catch expected error');
33 // vim: et sw=4 sts=4