3 class HTMLPurifier_Lexer_DirectLex_ErrorsTest
extends HTMLPurifier_ErrorsHarness
6 public function invoke($input)
8 $lexer = new HTMLPurifier_Lexer_DirectLex();
9 $lexer->tokenizeHTML($input, $this->config
, $this->context
);
12 public function invokeAttr($input)
14 $lexer = new HTMLPurifier_Lexer_DirectLex();
15 $lexer->parseAttributeString($input, $this->config
, $this->context
);
18 public function testExtractBody()
20 $this->expectErrorCollection(E_WARNING
, 'Lexer: Extracted body');
21 $this->invoke('<body>foo</body>');
24 public function testUnclosedComment()
26 $this->expectErrorCollection(E_WARNING
, 'Lexer: Unclosed comment');
27 $this->expectContext('CurrentLine', 1);
28 $this->invoke('<!-- >');
31 public function testUnescapedLt()
33 $this->expectErrorCollection(E_NOTICE
, 'Lexer: Unescaped lt');
34 $this->expectContext('CurrentLine', 1);
35 $this->invoke('< foo>');
38 public function testMissingGt()
40 $this->expectErrorCollection(E_WARNING
, 'Lexer: Missing gt');
41 $this->expectContext('CurrentLine', 1);
42 $this->invoke('<a href=""');
45 // these are sub-errors, will only be thrown in context of collector
47 public function testMissingAttributeKey1()
49 $this->expectErrorCollection(E_ERROR
, 'Lexer: Missing attribute key');
50 $this->invokeAttr('=""');
53 public function testMissingAttributeKey2()
55 $this->expectErrorCollection(E_ERROR
, 'Lexer: Missing attribute key');
56 $this->invokeAttr('foo="bar" =""');
59 public function testMissingEndQuote()
61 $this->expectErrorCollection(E_ERROR
, 'Lexer: Missing end quote');
62 $this->invokeAttr('src="foo');