forked from dokufreaks/plugin-include
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsafeindex.test.php
36 lines (28 loc) · 1.11 KB
/
safeindex.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
<?php
class plugin_include_safeindex_test extends DokuWikiTest {
public function setup() {
$this->pluginsEnabled[] = 'include';
parent::setup();
}
public function test_safeindex() {
global $conf;
global $AUTH_ACL;
$conf['superuser'] = 'john';
$conf['useacl'] = 1;
$AUTH_ACL = array(
'* @ALL 0',
'* @user 8',
'public @ALL 1',
);
$_SERVER['REMOTE_USER'] = 'john';
saveWikiText('parent', "{{page>child}}\n\n[[public_link]]\n\n{{page>public}}", 'Test parent created');
saveWikiText('child', "[[foo:private]]", 'Test child created');
saveWikiText('public', "[[foo:public]]", 'Public page created');
idx_addPage('parent');
idx_addPage('child');
idx_addPage('public');
$this->assertEquals(array('parent', 'public'), ft_backlinks('foo:public'));
$this->assertEquals(array('child'), ft_backlinks('foo:private'));
$this->assertEquals(array('parent'), ft_backlinks('public_link'));
}
}