Fix newline issues in tests.
[htmlpurifier/darkodev.git] / tests / HTMLPurifier / VarParserHarness.php
blob59eb6965da69277c7c80c09c00568ce98801c5ef
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');