diff options
Diffstat (limited to 'platform/www/lib/plugins/include/_test/pagemove_support.test.php')
-rw-r--r-- | platform/www/lib/plugins/include/_test/pagemove_support.test.php | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/platform/www/lib/plugins/include/_test/pagemove_support.test.php b/platform/www/lib/plugins/include/_test/pagemove_support.test.php new file mode 100644 index 0000000..58c9425 --- /dev/null +++ b/platform/www/lib/plugins/include/_test/pagemove_support.test.php @@ -0,0 +1,76 @@ +<?php + +/** + * Tests the move support for adapting the syntax of the include plugin + * + * @group plugin_include + * @group plugins + */ +class plugin_include_pagemove_support_test extends DokuWikiTest { + public function setUp() : void + { + $this->pluginsEnabled[] = 'move'; + $this->pluginsEnabled[] = 'include'; + parent::setUp(); + } + + public function test_relative_include() { + /** @var $move helper_plugin_move_op */ + $move = plugin_load('helper', 'move_op'); + if (!$move) { + $this->markTestSkipped('the move plugin is not installed'); + return; + } + saveWikiText('editx', '{{page>start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}', 'Testcase created'); + idx_addPage('editx'); + $this->assertTrue($move->movePage('editx', 'test:editx')); + $this->assertEquals('{{page>:start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}',rawWiki('test:editx')); + } + + public function test_rename() { + /** @var $move helper_plugin_move_op */ + $move = plugin_load('helper', 'move_op'); + if (!$move) { + $this->markTestSkipped('the move plugin is not installed'); + return; + } + saveWikiText('editx', 'Page to rename', 'Testcase create'); + saveWikiText('links', '{{section>links#foo}} {{page>editx}} {{page>:eDitX&nofooter}} {{section>editx#test}} {{page>editx&nofooter}}', 'Testcase created'); + idx_addPage('editx'); + idx_addPage('links'); + + $this->assertTrue($move->movePage('editx', 'test:edit')); + $this->assertEquals('{{section>links#foo}} {{page>test:edit}} {{page>test:edit&nofooter}} {{section>test:edit#test}} {{page>test:edit&nofooter}}', rawWiki('links')); + } + + public function test_relative_include_adaption() { + /** @var $move helper_plugin_move_op */ + $move = plugin_load('helper', 'move_op'); + if (!$move) { + $this->markTestSkipped('the move plugin is not installed'); + return; + } + + $text = '====== Main ====== + +This is a test page + +[[.1:page_1|link]] + +{{page>.1:page_1&nofooter&noeditbutton}} + +{{page>.1:page_2&nofooter&noeditbutton}}'; + + saveWikiText('old:namespace:main', $text, 'Created'); + saveWikiText('old:namespace:1:page_1', 'Page 1', 'Created'); + saveWikiText('old:namespace:1:page_2', 'Page 2', 'Created'); + idx_addPage('old:namespace:main'); + idx_addPage('old:namespace:1:page_1'); + idx_addPage('old:namespace:1:page_2'); + + $this->assertTrue($move->movePage('old:namespace:main', 'new:namespace:main')); + $this->assertTrue($move->movePage('old:namespace:1:page_1', 'new:namespace:1:page_1')); + $this->assertTrue($move->movePage('old:namespace:1:page_2', 'new:namespace:1:page_2')); + $this->assertEquals($text, rawWiki('new:namespace:main')); + } +} |