3 class HTMLPurifier_Injector_PurifierLinkifyTest
extends HTMLPurifier_InjectorHarness
6 public function setup()
9 $this->config
->set('AutoFormat.PurifierLinkify', true);
10 $this->config
->set('AutoFormat.PurifierLinkify.DocURL', '#%s');
13 public function testNoTriggerCharacer()
15 $this->assertResult('Foobar');
18 public function testTriggerCharacterInIrrelevantContext()
20 $this->assertResult('20% off!');
23 public function testPreserveNamespace()
25 $this->assertResult('%Core namespace (not recognized)');
28 public function testLinkifyBasic()
31 '%Namespace.Directive',
32 '<a href="#Namespace.Directive">%Namespace.Directive</a>'
36 public function testLinkifyWithAdjacentTextNodes()
39 'This %Namespace.Directive thing',
40 'This <a href="#Namespace.Directive">%Namespace.Directive</a> thing'
44 public function testLinkifyInBlock()
47 '<div>This %Namespace.Directive thing</div>',
48 '<div>This <a href="#Namespace.Directive">%Namespace.Directive</a> thing</div>'
52 public function testPreserveInATag()
55 '<a>%Namespace.Directive</a>'
59 public function testNeeded()
61 $this->config
->set('HTML.Allowed', 'b');
62 $this->expectError('Cannot enable PurifierLinkify injector because a is not allowed');
63 $this->assertResult('%Namespace.Directive');