3 class HTMLPurifier_Injector_PurifierLinkifyTest
extends HTMLPurifier_InjectorHarness
8 $this->config
->set('AutoFormat.PurifierLinkify', true);
9 $this->config
->set('AutoFormat.PurifierLinkify.DocURL', '#%s');
12 function testNoTriggerCharacer() {
13 $this->assertResult('Foobar');
16 function testTriggerCharacterInIrrelevantContext() {
17 $this->assertResult('20% off!');
20 function testPreserveNamespace() {
21 $this->assertResult('%Core namespace (not recognized)');
24 function testLinkifyBasic() {
26 '%Namespace.Directive',
27 '<a href="#Namespace.Directive">%Namespace.Directive</a>'
31 function testLinkifyWithAdjacentTextNodes() {
33 'This %Namespace.Directive thing',
34 'This <a href="#Namespace.Directive">%Namespace.Directive</a> thing'
38 function testLinkifyInBlock() {
40 '<div>This %Namespace.Directive thing</div>',
41 '<div>This <a href="#Namespace.Directive">%Namespace.Directive</a> thing</div>'
45 function testPreserveInATag() {
47 '<a>%Namespace.Directive</a>'
51 function testNeeded() {
52 $this->config
->set('HTML.Allowed', 'b');
53 $this->expectError('Cannot enable PurifierLinkify injector because a is not allowed');
54 $this->assertResult('%Namespace.Directive');