1<?php 2 3/** 4 * Test cases log functionality of the move plugin 5 * 6 * @group plugin_move 7 * @group plugin_move_unittests 8 * @group plugins 9 * @group unittests 10 */ 11class plugin_move_log_test extends DokuWikiTest { 12 13 protected $pluginsEnabled = array('move',); 14 15 public function test_log_one_line_success() { 16 /** @var helper_plugin_move_plan $plan */ 17 $plan = plugin_load('helper', 'move_plan'); 18 $now = time(); 19 $date = date('Y-m-d H:i:s', $now); 20 21 $actual_log = $plan->build_log_line('P','oldpage','newpage',true); 22 23 $expected_log = "$now\t$date\tP\toldpage\tnewpage\tsuccess\t\n"; 24 25 $this->assertSame($expected_log, $actual_log); 26 } 27 28 public function test_log_build_line_failure() { 29 global $MSG; 30 $MSG = array(); 31 $msg = array('msg'=>"TestMessage01",); 32 array_push($MSG,$msg); 33 34 /** @var helper_plugin_move_plan $plan */ 35 $plan = plugin_load('helper', 'move_plan'); 36 $now = time(); 37 $date = date('Y-m-d H:i:s', $now); 38 39 $actual_log = $plan->build_log_line('P','oldpage','newpage',false); 40 41 $expected_log = "$now\t$date\tP\toldpage\tnewpage\tfailed\tTestMessage01\n"; 42 43 $this->assertSame($expected_log, $actual_log); 44 } 45 46} 47