forked from dokufreaks/plugin-include
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocallink_conversion.test.php
38 lines (29 loc) · 1.2 KB
/
locallink_conversion.test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
if (!defined('DOKU_INC')) die();
/**
* Test the conversion of local links to internal links if the page hasn't been fully included
*/
class plugin_include_locallink_conversion_test extends DokuWikiTest {
/** @var helper_plugin_include $helper */
private $helper;
public function setUp() {
$this->pluginsEnabled[] = 'include';
parent::setUp();
$this->helper = plugin_load('helper', 'include');
saveWikiText('included', 'Example content with link [[#jump]]', 'Test setup');
idx_addPage('test:included');
saveWikiText('test:includefull', '{{page>..:included}}', 'Test setup');
idx_addPage('test:includefull');
saveWikiText('test:includefirst', '{{page>..:included&firstseconly}}', 'Test setup');
idx_addPage('test:includefirst');
}
public function testLocalConverted() {
$html = p_wiki_xhtml('test:includefirst');
$this->assertContains('href="'.wl('included').'#jump"', $html);
$this->assertNotContains('href="#jump"', $html);
}
public function testLocalExistsIfIncluded() {
$html = p_wiki_xhtml('test:includefull');
$this->assertContains('href="#jump"', $html);
}
}