config = HTMLPurifier_Config::create(array('Core.CollectErrors' => true)); $this->context = new HTMLPurifier_Context(); generate_mock_once('HTMLPurifier_ErrorCollector'); $this->collector = new HTMLPurifier_ErrorCollectorMock($this); $this->context->register('ErrorCollector', $this->collector); } function invoke($input) { $lexer = new HTMLPurifier_Lexer_DirectLex(); $lexer->tokenizeHTML($input, $this->config, $this->context); } function invokeAttr($input) { $lexer = new HTMLPurifier_Lexer_DirectLex(); $lexer->parseAttributeString($input, $this->config, $this->context); } function expectErrorCollection($severity, $msg) { $this->collector->expectOnce('send', array($severity, $msg)); } function testUnclosedComment() { $this->expectErrorCollection(E_WARNING, 'Lexer: Unclosed comment'); $this->invoke('