Rename AutoFormatParam.PurifierLinkifyDocURL.
[htmlpurifier.git] / tests / HTMLPurifier / Injector / PurifierLinkifyTest.php
blob774b234ad41e9d17ab16a6ddc1beb1f346f0371b
1 <?php
3 class HTMLPurifier_Injector_PurifierLinkifyTest extends HTMLPurifier_InjectorHarness
6 function setup() {
7 parent::setup();
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() {
25 $this->assertResult(
26 '%Namespace.Directive',
27 '<a href="#Namespace.Directive">%Namespace.Directive</a>'
31 function testLinkifyWithAdjacentTextNodes() {
32 $this->assertResult(
33 'This %Namespace.Directive thing',
34 'This <a href="#Namespace.Directive">%Namespace.Directive</a> thing'
38 function testLinkifyInBlock() {
39 $this->assertResult(
40 '<div>This %Namespace.Directive thing</div>',
41 '<div>This <a href="#Namespace.Directive">%Namespace.Directive</a> thing</div>'
45 function testPreserveInATag() {
46 $this->assertResult(
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');
59 // vim: et sw=4 sts=4