You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

47 lines
1.2 KiB

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