1<?php 2/** 3 * General tests for the publish plugin 4 * 5 * @group plugin_publish 6 * @group plugin_publish_integration 7 * @group plugins 8 * @group integrationtests 9 * @author Michael Große <grosse@cosmocode.de> 10 */ 11class publish_mail_test extends DokuWikiTest { 12 13 protected $pluginsEnabled = array('publish'); 14 15 public function setUp(): void 16 { 17 parent::setUp(); 18 19 global $USERINFO; 20 $USERINFO = array( 21 'pass' => '179ad45c6ce2cb97cf1029e212046e81', 22 'name' => 'Arthur Dent', 23 'mail' => 'arthur@example.com', 24 'grps' => array ('admin','user'), 25 ); 26 27 global $default_server_vars; 28 $default_server_vars['REMOTE_USER'] = 'testuser'; //Hack until Issue splitbrain/dokuwiki#1099 is fixed 29 $_SERVER['REMOTE_USER'] = 'testuser'; 30 31 global $conf; 32 $conf['superuser'] = '@admin'; 33 } 34 35 /** 36 * Blackbox integration test of action_plugin_publish_mail::getLastApproved 37 * 38 * @coversNothing 39 */ 40 public function test_getLastApproved () { 41 global $ID; 42 $ID = 'foo'; 43 saveWikiText('foo', 'bar old', 'foobar'); 44 saveWikiText('foo', 'bar approved', 'foobar'); 45 $data = pageinfo(); 46 $expected_revision = $data['currentrev']; 47 48 //Make sure we have the rights to actully approve a revision 49 $this->assertSame(255,auth_quickaclcheck('foo')); 50 51 $request = new TestRequest(); 52 $request->get(array(), '/doku.php?id=foo&publish_approve'); 53 54 saveWikiText('foo', 'bar new', 'foobar'); 55 56 /** @var helper_plugin_publish $helper */ 57 $helper = plugin_load('helper','publish'); 58 $actual_lastapproved_helper = $helper->getLatestApprovedRevision($ID); 59 60 $this->assertSame($expected_revision, $actual_lastapproved_helper); 61 } 62 63 64} 65