xref: /plugin/include/_test/pagemove_support.test.php (revision 306441b323f1875b372e9de7237f64143817837d)
1<?php
2
3/**
4 * Tests the editx support for adapting the syntax of the include plugin
5 */
6class plugin_include_pagemove_support_test extends DokuWikiTest {
7    public function setup() {
8        $this->pluginsEnabled[] = 'move';
9        $this->pluginsEnabled[] = 'include';
10        parent::setup();
11    }
12
13    public function test_relative_include() {
14        global $ID;
15        /** @var $move helper_plugin_move */
16        $move = plugin_load('helper', 'move');
17        if (!$move) return; // disable the test when move is not installed
18        saveWikiText('editx', '{{page>start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}', 'Testcase created');
19        idx_addPage('editx');
20        $ID = 'editx';
21        $opts['ns']      = '';
22        $opts['newname'] = 'editx';
23        $opts['newns']   = 'test';
24        $move->move_page($opts);
25        $this->assertEquals('{{page>:start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}',rawWiki('test:editx'));
26    }
27
28    public function test_rename() {
29        global $ID;
30        /** @var $move helper_plugin_move */
31        $move = plugin_load('helper', 'move');
32        if (!$move) return; // disable the test when move is not installed
33        saveWikiText('editx', 'Page to rename', 'Testcase create');
34        saveWikiText('links', '{{section>links#foo}} {{page>editx}} {{page>:eDitX&nofooter}} {{section>editx#test}} {{page>editx&nofooter}}', 'Testcase created');
35        idx_addPage('editx');
36        idx_addPage('links');
37
38        $ID = 'editx';
39        $opts['ns']      = '';
40        $opts['newname'] = 'edit';
41        $opts['newns']   = 'test';
42        $move->move_page($opts);
43        $this->assertEquals('{{section>links#foo}} {{page>test:edit}} {{page>test:edit&nofooter}} {{section>test:edit#test}} {{page>test:edit&nofooter}}', rawWiki('links'));
44    }
45}