1<?php 2 3/** 4 * Tests the move support for adapting the syntax of the include plugin 5 * 6 * @group plugin_include 7 * @group plugins 8 */ 9class plugin_include_pagemove_support_test extends DokuWikiTest { 10 public function setup() { 11 $this->pluginsEnabled[] = 'move'; 12 $this->pluginsEnabled[] = 'include'; 13 parent::setup(); 14 } 15 16 public function test_relative_include() { 17 /** @var $move helper_plugin_move_op */ 18 $move = plugin_load('helper', 'move_op'); 19 if (!$move) { 20 $this->markTestSkipped('the move plugin is not installed'); 21 return; 22 } 23 saveWikiText('editx', '{{page>start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}', 'Testcase created'); 24 idx_addPage('editx'); 25 $this->assertTrue($move->movePage('editx', 'test:editx')); 26 $this->assertEquals('{{page>:start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}',rawWiki('test:editx')); 27 } 28 29 public function test_rename() { 30 /** @var $move helper_plugin_move_op */ 31 $move = plugin_load('helper', 'move_op'); 32 if (!$move) { 33 $this->markTestSkipped('the move plugin is not installed'); 34 return; 35 } 36 saveWikiText('editx', 'Page to rename', 'Testcase create'); 37 saveWikiText('links', '{{section>links#foo}} {{page>editx}} {{page>:eDitX&nofooter}} {{section>editx#test}} {{page>editx&nofooter}}', 'Testcase created'); 38 idx_addPage('editx'); 39 idx_addPage('links'); 40 41 $this->assertTrue($move->movePage('editx', 'test:edit')); 42 $this->assertEquals('{{section>links#foo}} {{page>test:edit}} {{page>test:edit&nofooter}} {{section>test:edit#test}} {{page>test:edit&nofooter}}', rawWiki('links')); 43 } 44 45 public function test_relative_include_adaption() { 46 /** @var $move helper_plugin_move_op */ 47 $move = plugin_load('helper', 'move_op'); 48 if (!$move) { 49 $this->markTestSkipped('the move plugin is not installed'); 50 return; 51 } 52 53 $text = '====== Main ====== 54 55This is a test page 56 57[[.1:page_1|link]] 58 59{{page>.1:page_1&nofooter&noeditbutton}} 60 61{{page>.1:page_2&nofooter&noeditbutton}}'; 62 63 saveWikiText('old:namespace:main', $text, 'Created'); 64 saveWikiText('old:namespace:1:page_1', 'Page 1', 'Created'); 65 saveWikiText('old:namespace:1:page_2', 'Page 2', 'Created'); 66 idx_addPage('old:namespace:main'); 67 idx_addPage('old:namespace:1:page_1'); 68 idx_addPage('old:namespace:1:page_2'); 69 70 $this->assertTrue($move->movePage('old:namespace:main', 'new:namespace:main')); 71 $this->assertTrue($move->movePage('old:namespace:1:page_1', 'new:namespace:1:page_1')); 72 $this->assertTrue($move->movePage('old:namespace:1:page_2', 'new:namespace:1:page_2')); 73 $this->assertEquals($text, rawWiki('new:namespace:main')); 74 } 75} 76