public function testEndHandler() { $mock = new HTMLPurifier_InjectorMock(); $b = new HTMLPurifier_Token_End('b'); $b->skip = array(0 => true); $b->start = new HTMLPurifier_Token_Start('b'); $b->start->skip = array(0 => true, 1 => true); $mock->expectAt(0, 'handleEnd', array($b)); $i = new HTMLPurifier_Token_End('i'); $i->start = new HTMLPurifier_Token_Start('i'); $i->skip = array(0 => true); $i->start->skip = array(0 => true, 1 => true); $mock->expectAt(1, 'handleEnd', array($i)); $mock->expectCallCount('handleEnd', 2); $mock->setReturnValue('getRewindOffset', false); $this->config->set('AutoFormat.AutoParagraph', false); $this->config->set('AutoFormat.Linkify', false); $this->config->set('AutoFormat.Custom', array($mock)); $this->assertResult('<i><b>asdf</b>', '<i><b>asdf</b></i>'); }
function test_injectorMissingNeeded() { generate_mock_once('HTMLPurifier_Injector'); $injector = new HTMLPurifier_InjectorMock(); $injector->name = 'MyInjector'; $injector->setReturnValue('checkNeeded', 'a'); $module = $this->config->getHTMLDefinition(true)->getAnonymousModule(); $module->info_injector[] = $injector; $this->assertIdentical($this->config->getHTMLDefinition()->info_injector, array()); }