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