xref: /plugin/include/_test/pagemove_support.test.php (revision c76c7b123fd75386fba2a2655cc9efce4e8c0239)
1<?php
2
3/**
4 * Tests the editx 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) return; // disable the test when move is not installed
20        saveWikiText('editx', '{{page>start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}', 'Testcase created');
21        idx_addPage('editx');
22        $this->assertTrue($move->movePage('editx', 'test:editx'));
23        $this->assertEquals('{{page>:start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}',rawWiki('test:editx'));
24    }
25
26    public function test_rename() {
27        /** @var $move helper_plugin_move_op */
28        $move = plugin_load('helper', 'move_op');
29        if (!$move) return; // disable the test when move is not installed
30        saveWikiText('editx', 'Page to rename', 'Testcase create');
31        saveWikiText('links', '{{section>links#foo}} {{page>editx}} {{page>:eDitX&nofooter}} {{section>editx#test}} {{page>editx&nofooter}}', 'Testcase created');
32        idx_addPage('editx');
33        idx_addPage('links');
34
35        $this->assertTrue($move->movePage('editx', 'test:edit'));
36        $this->assertEquals('{{section>links#foo}} {{page>test:edit}} {{page>test:edit&nofooter}} {{section>test:edit#test}} {{page>test:edit&nofooter}}', rawWiki('links'));
37    }
38}
39