PSR-2 reformatting PHPDoc corrections
[htmlpurifier.git] / tests / HTMLPurifier / Injector / PurifierLinkifyTest.php
blob8a22715187bb6bfeac1a3ae38161510799e42512
1 <?php
3 class HTMLPurifier_Injector_PurifierLinkifyTest extends HTMLPurifier_InjectorHarness
6 public function setup()
8 parent::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()
30 $this->assertResult(
31 '%Namespace.Directive',
32 '<a href="#Namespace.Directive">%Namespace.Directive</a>'
36 public function testLinkifyWithAdjacentTextNodes()
38 $this->assertResult(
39 'This %Namespace.Directive thing',
40 'This <a href="#Namespace.Directive">%Namespace.Directive</a> thing'
44 public function testLinkifyInBlock()
46 $this->assertResult(
47 '<div>This %Namespace.Directive thing</div>',
48 '<div>This <a href="#Namespace.Directive">%Namespace.Directive</a> thing</div>'
52 public function testPreserveInATag()
54 $this->assertResult(
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');
68 // vim: et sw=4 sts=4