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() { 16 parent::setUp(); 17 18 global $USERINFO; 19 $USERINFO = array( 20 'pass' => '179ad45c6ce2cb97cf1029e212046e81', 21 'name' => 'Arthur Dent', 22 'mail' => 'arthur@example.com', 23 'grps' => array ('admin','user'), 24 ); 25 26 global $default_server_vars; 27 $default_server_vars['REMOTE_USER'] = 'testuser'; //Hack until Issue splitbrain/dokuwiki#1099 is fixed 28 $_SERVER['REMOTE_USER'] = 'testuser'; 29 30 global $conf; 31 $conf['superuser'] = '@admin'; 32 } 33 34 /** 35 * Blackbox integration test of action_plugin_publish_mail::getLastApproved 36 * 37 * @coversNothing 38 */ 39 public function test_getLastApproved () { 40 global $ID; 41 $ID = 'foo'; 42 saveWikiText('foo', 'bar old', 'foobar'); 43 saveWikiText('foo', 'bar approved', 'foobar'); 44 $data = pageinfo(); 45 $expected_revision = $data['currentrev']; 46 47 //Make sure we have the rights to actully approve a revision 48 $this->assertSame(255,auth_quickaclcheck('foo')); 49 50 $request = new TestRequest(); 51 $request->get(array(), '/doku.php?id=foo&publish_approve'); 52 53 saveWikiText('foo', 'bar new', 'foobar'); 54 55 /** @var helper_plugin_publish $helper */ 56 $helper = plugin_load('helper','publish'); 57 $actual_lastapproved_helper = $helper->getLatestApprovedRevision($ID); 58 59 $this->assertSame($expected_revision, $actual_lastapproved_helper); 60 } 61 62 63} 64