xref: /plugin/include/_test/pagemove_support.test.php (revision 83d8bead9c154c952bf7cc14f2397211607699ee)
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() {
8306441b3SMichael Hamann        $this->pluginsEnabled[] = 'move';
912d9bd9eSMichael Hamann        $this->pluginsEnabled[] = 'include';
1012d9bd9eSMichael Hamann        parent::setup();
1112d9bd9eSMichael Hamann    }
1212d9bd9eSMichael Hamann
1312d9bd9eSMichael Hamann    public function test_relative_include() {
14*83d8beadSMichael Hamann        /** @var $move helper_plugin_move_op */
15*83d8beadSMichael Hamann        $move = plugin_load('helper', 'move_op');
16306441b3SMichael Hamann        if (!$move) return; // disable the test when move is not installed
1712d9bd9eSMichael Hamann        saveWikiText('editx', '{{page>start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}', 'Testcase created');
1812d9bd9eSMichael Hamann        idx_addPage('editx');
19*83d8beadSMichael Hamann        $this->assertTrue($move->movePage('editx', 'test:editx'));
2012d9bd9eSMichael Hamann        $this->assertEquals('{{page>:start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}',rawWiki('test:editx'));
2112d9bd9eSMichael Hamann    }
2212d9bd9eSMichael Hamann
2312d9bd9eSMichael Hamann    public function test_rename() {
24*83d8beadSMichael Hamann        /** @var $move helper_plugin_move_op */
25*83d8beadSMichael Hamann        $move = plugin_load('helper', 'move_op');
26306441b3SMichael Hamann        if (!$move) return; // disable the test when move is not installed
2712d9bd9eSMichael Hamann        saveWikiText('editx', 'Page to rename', 'Testcase create');
2812d9bd9eSMichael Hamann        saveWikiText('links', '{{section>links#foo}} {{page>editx}} {{page>:eDitX&nofooter}} {{section>editx#test}} {{page>editx&nofooter}}', 'Testcase created');
2912d9bd9eSMichael Hamann        idx_addPage('editx');
3012d9bd9eSMichael Hamann        idx_addPage('links');
3112d9bd9eSMichael Hamann
32*83d8beadSMichael Hamann        $this->assertTrue($move->movePage('editx', 'test:edit'));
3312d9bd9eSMichael Hamann        $this->assertEquals('{{section>links#foo}} {{page>test:edit}} {{page>test:edit&nofooter}} {{section>test:edit#test}} {{page>test:edit&nofooter}}', rawWiki('links'));
3412d9bd9eSMichael Hamann    }
3512d9bd9eSMichael Hamann}