Convert all to new configuration get/set format.
[htmlpurifier/darkodev.git] / tests / HTMLPurifier / Injector / PurifierLinkifyTest.php
blobbcb7903cd6a14b1c9ce8fa97fca999751bd9aae4
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('AutoFormatParam.PurifierLinkifyDocURL', '#%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