1<?php
2/*
3 * @group plugin_include
4 * @group plugins
5 */
6class plugin_include_safeindex_test extends DokuWikiTest {
7    public function setUp() : void
8    {
9        $this->pluginsEnabled[] = 'include';
10        parent::setUp();
11    }
12
13    public function test_safeindex() {
14        global $conf;
15        global $AUTH_ACL;
16        $conf['superuser'] = 'john';
17        $conf['useacl']    = 1;
18
19        $AUTH_ACL = array(
20            '*           @ALL           0',
21            '*           @user          8',
22            'public      @ALL           1',
23        );
24
25        $_SERVER['REMOTE_USER'] = 'john';
26
27        saveWikiText('parent', "{{page>child}}\n\n[[public_link]]\n\n{{page>public}}", 'Test parent created');
28        saveWikiText('child', "[[foo:private]]", 'Test child created');
29        saveWikiText('public', "[[foo:public]]", 'Public page created');
30
31        idx_addPage('parent');
32        idx_addPage('child');
33        idx_addPage('public');
34
35        $this->assertEquals(array('parent', 'public'), ft_backlinks('foo:public'));
36        $this->assertEquals(array('child'), ft_backlinks('foo:private'));
37        $this->assertEquals(array('parent'), ft_backlinks('public_link'));
38    }
39}
40
41