xref: /plugin/include/_test/pagemove_support.test.php (revision c76c7b123fd75386fba2a2655cc9efce4e8c0239) !
112d9bd9eSMichael Hamann<?php
212d9bd9eSMichael Hamann
312d9bd9eSMichael Hamann/**
412d9bd9eSMichael Hamann * Tests the editx support for adapting the syntax of the include plugin
5*c76c7b12SAndreas Gohr *
6*c76c7b12SAndreas Gohr * @group plugin_include
7*c76c7b12SAndreas Gohr * @group plugins
812d9bd9eSMichael Hamann */
912d9bd9eSMichael Hamannclass plugin_include_pagemove_support_test extends DokuWikiTest {
1012d9bd9eSMichael Hamann    public function setup() {
11306441b3SMichael Hamann        $this->pluginsEnabled[] = 'move';
1212d9bd9eSMichael Hamann        $this->pluginsEnabled[] = 'include';
1312d9bd9eSMichael Hamann        parent::setup();
1412d9bd9eSMichael Hamann    }
1512d9bd9eSMichael Hamann
1612d9bd9eSMichael Hamann    public function test_relative_include() {
1783d8beadSMichael Hamann        /** @var $move helper_plugin_move_op */
1883d8beadSMichael Hamann        $move = plugin_load('helper', 'move_op');
19306441b3SMichael Hamann        if (!$move) return; // disable the test when move is not installed
2012d9bd9eSMichael Hamann        saveWikiText('editx', '{{page>start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}', 'Testcase created');
2112d9bd9eSMichael Hamann        idx_addPage('editx');
2283d8beadSMichael Hamann        $this->assertTrue($move->movePage('editx', 'test:editx'));
2312d9bd9eSMichael Hamann        $this->assertEquals('{{page>:start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}',rawWiki('test:editx'));
2412d9bd9eSMichael Hamann    }
2512d9bd9eSMichael Hamann
2612d9bd9eSMichael Hamann    public function test_rename() {
2783d8beadSMichael Hamann        /** @var $move helper_plugin_move_op */
2883d8beadSMichael Hamann        $move = plugin_load('helper', 'move_op');
29306441b3SMichael Hamann        if (!$move) return; // disable the test when move is not installed
3012d9bd9eSMichael Hamann        saveWikiText('editx', 'Page to rename', 'Testcase create');
3112d9bd9eSMichael Hamann        saveWikiText('links', '{{section>links#foo}} {{page>editx}} {{page>:eDitX&nofooter}} {{section>editx#test}} {{page>editx&nofooter}}', 'Testcase created');
3212d9bd9eSMichael Hamann        idx_addPage('editx');
3312d9bd9eSMichael Hamann        idx_addPage('links');
3412d9bd9eSMichael Hamann
3583d8beadSMichael Hamann        $this->assertTrue($move->movePage('editx', 'test:edit'));
3612d9bd9eSMichael Hamann        $this->assertEquals('{{section>links#foo}} {{page>test:edit}} {{page>test:edit&nofooter}} {{section>test:edit#test}} {{page>test:edit&nofooter}}', rawWiki('links'));
3712d9bd9eSMichael Hamann    }
3812d9bd9eSMichael Hamann}
39