Prepended constants with C_ to avoid reserved words as per https://www.php.net/manual...
[htmlpurifier/darkodev.git] / tests / HTMLPurifier / VarParserHarness.php
blob68708dbf8089db2ce049dcc8cdc1c381c1caf874
1 <?php
3 class HTMLPurifier_VarParserHarness extends UnitTestCase
6 protected $parser;
8 public function setup()
10 $class = substr(get_class($this), 0, -4);
11 $this->parser = new $class();
14 public function assertValid($var, $type, $ret = null)
16 $ret = ($ret === null) ? $var : $ret;
17 $this->assertIdentical($this->parser->parse($var, $type), $ret);
20 public function assertInvalid($var, $type, $msg = null)
22 $caught = false;
23 try {
24 $this->parser->parse($var, $type);
25 } catch (HTMLPurifier_VarParserException $e) {
26 $caught = true;
27 if ($msg !== null) $this->assertIdentical($e->getMessage(), $msg);
29 if (!$caught) {
30 $this->fail('Did not catch expected error');
36 // vim: et sw=4 sts=4