xref: /plugin/include/_test/pagemove_support.test.php (revision 306441b323f1875b372e9de7237f64143817837d)
112d9bd9eSMichael Hamann<?php
212d9bd9eSMichael Hamann
312d9bd9eSMichael Hamann/**
412d9bd9eSMichael Hamann * Tests the editx support for adapting the syntax of the include plugin
512d9bd9eSMichael Hamann */
612d9bd9eSMichael Hamannclass plugin_include_pagemove_support_test extends DokuWikiTest {
712d9bd9eSMichael Hamann    public function setup() {
8*306441b3SMichael Hamann        $this->pluginsEnabled[] = 'move';
912d9bd9eSMichael Hamann        $this->pluginsEnabled[] = 'include';
1012d9bd9eSMichael Hamann        parent::setup();
1112d9bd9eSMichael Hamann    }
1212d9bd9eSMichael Hamann
1312d9bd9eSMichael Hamann    public function test_relative_include() {
1412d9bd9eSMichael Hamann        global $ID;
15*306441b3SMichael Hamann        /** @var $move helper_plugin_move */
16*306441b3SMichael Hamann        $move = plugin_load('helper', 'move');
17*306441b3SMichael Hamann        if (!$move) return; // disable the test when move is not installed
1812d9bd9eSMichael Hamann        saveWikiText('editx', '{{page>start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}', 'Testcase created');
1912d9bd9eSMichael Hamann        idx_addPage('editx');
2012d9bd9eSMichael Hamann        $ID = 'editx';
2112d9bd9eSMichael Hamann        $opts['ns']      = '';
2212d9bd9eSMichael Hamann        $opts['newname'] = 'editx';
2312d9bd9eSMichael Hamann        $opts['newns']   = 'test';
24*306441b3SMichael Hamann        $move->move_page($opts);
2512d9bd9eSMichael Hamann        $this->assertEquals('{{page>:start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}',rawWiki('test:editx'));
2612d9bd9eSMichael Hamann    }
2712d9bd9eSMichael Hamann
2812d9bd9eSMichael Hamann    public function test_rename() {
2912d9bd9eSMichael Hamann        global $ID;
30*306441b3SMichael Hamann        /** @var $move helper_plugin_move */
31*306441b3SMichael Hamann        $move = plugin_load('helper', 'move');
32*306441b3SMichael Hamann        if (!$move) return; // disable the test when move is not installed
3312d9bd9eSMichael Hamann        saveWikiText('editx', 'Page to rename', 'Testcase create');
3412d9bd9eSMichael Hamann        saveWikiText('links', '{{section>links#foo}} {{page>editx}} {{page>:eDitX&nofooter}} {{section>editx#test}} {{page>editx&nofooter}}', 'Testcase created');
3512d9bd9eSMichael Hamann        idx_addPage('editx');
3612d9bd9eSMichael Hamann        idx_addPage('links');
3712d9bd9eSMichael Hamann
3812d9bd9eSMichael Hamann        $ID = 'editx';
3912d9bd9eSMichael Hamann        $opts['ns']      = '';
4012d9bd9eSMichael Hamann        $opts['newname'] = 'edit';
4112d9bd9eSMichael Hamann        $opts['newns']   = 'test';
42*306441b3SMichael Hamann        $move->move_page($opts);
4312d9bd9eSMichael Hamann        $this->assertEquals('{{section>links#foo}} {{page>test:edit}} {{page>test:edit&nofooter}} {{section>test:edit#test}} {{page>test:edit&nofooter}}', rawWiki('links'));
4412d9bd9eSMichael Hamann    }
4512d9bd9eSMichael Hamann}