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