-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathpublish.test.php
103 lines (87 loc) · 3.07 KB
/
publish.test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
* General tests for the publish plugin
*
* @group plugin_publish_integration
* @group plugin_publish
* @group plugins
* @group integrationtests
* @author Michael Große <[email protected]>
*/
class approvel_test extends DokuWikiTest {
protected $pluginsEnabled = array('publish');
public function setUp(){
parent::setUp();
global $USERINFO;
$USERINFO = array(
'pass' => '179ad45c6ce2cb97cf1029e212046e81',
'name' => 'Arthur Dent',
'mail' => '[email protected]',
'grps' => array ('admin','user'),
);
global $default_server_vars;
$default_server_vars['REMOTE_USER'] = 'testuser'; //Hack until Issue splitbrain/dokuwiki#1099 is fixed
$_SERVER['REMOTE_USER'] = 'testuser';
global $conf;
global $AUTH_ACL;
$conf['useacl'] = 1;
$conf['superuser'] = '@admin';
$AUTH_ACL = array(
'* @ALL 4',
'* @admin 16',);
}
/**
* @coversNothing
*/
public function test_unaprroved_banner_exists() {
saveWikiText('foo', 'bar', 'foobar');
$request = new TestRequest();
$response = $request->get(array(), '/doku.php?id=foo');
$this->assertTrue(
strpos($response->getContent(), '<div class="approval approved_no">') !== false,
'The "not approved banner" is missing on a page which has not yet been aprroved with standard config.'
);
}
/**
* @coversNothing
*/
public function test_aprroval_succesful() {
global $conf;
$conf['plugin']['publish']['auto_self_approve'] = 0;
saveWikiText('foo', 'bar', 'foobar');
$request = new TestRequest();
$response = $request->get(array(), '/doku.php?id=foo&publish_approve=1');
$this->assertTrue(
strpos($response->getContent(), '<div class="approval approved_yes">') !== false,
'Approving a page failed with standard options.'
);
}
/**
* @coversNothing
*/
public function test_no_aprroved_banner() {
global $conf;
$conf['plugin']['publish']['hide_approved_banner'] = 1;
saveWikiText('foo', 'bar', 'foobar');
$request = new TestRequest();
$response = $request->get(array(), '/doku.php?id=foo&publish_approve=1');
$this->assertTrue(
strpos($response->getContent(), '<div class="approval') === false,
'The approved banner is still showing even so it is supposed not to show.'
);
}
/**
* @coversNothing
*/
public function test_self_aprrove() {
global $conf;
$conf['plugin']['publish']['auto_self_approve'] = 1;
saveWikiText('foo', 'bar', 'foobar');
$request = new TestRequest();
$response = $request->get(array(), '/doku.php?id=foo');
$this->assertTrue(
strpos($response->getContent(), '<div class="approval approved_yes') === false,
'Approving a page automatically failed.'
);
}
}