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