3 class HTMLPurifier_Lexer_DirectLex_ErrorsTest
extends HTMLPurifier_ErrorsHarness
6 function invoke($input) {
7 $lexer = new HTMLPurifier_Lexer_DirectLex();
8 $lexer->tokenizeHTML($input, $this->config
, $this->context
);
11 function invokeAttr($input) {
12 $lexer = new HTMLPurifier_Lexer_DirectLex();
13 $lexer->parseAttributeString($input, $this->config
, $this->context
);
16 function testUnclosedComment() {
17 $this->expectErrorCollection(E_WARNING
, 'Lexer: Unclosed comment');
18 $this->expectContext('CurrentLine', 1);
19 $this->invoke('<!-- >');
22 function testUnescapedLt() {
23 $this->expectErrorCollection(E_NOTICE
, 'Lexer: Unescaped lt');
24 $this->expectContext('CurrentLine', 1);
25 $this->invoke('< foo>');
28 function testMissingGt() {
29 $this->expectErrorCollection(E_WARNING
, 'Lexer: Missing gt');
30 $this->expectContext('CurrentLine', 1);
31 $this->invoke('<a href=""');
34 // these are sub-errors, will only be thrown in context of collector
36 function testMissingAttributeKey1() {
37 $this->expectErrorCollection(E_ERROR
, 'Lexer: Missing attribute key');
38 $this->invokeAttr('=""');
41 function testMissingAttributeKey2() {
42 $this->expectErrorCollection(E_ERROR
, 'Lexer: Missing attribute key');
43 $this->invokeAttr('foo="bar" =""');
46 function testMissingEndQuote() {
47 $this->expectErrorCollection(E_ERROR
, 'Lexer: Missing end quote');
48 $this->invokeAttr('src="foo');