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