|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Function area: Server |
|
4
|
|
|
* Sub function area: Groups |
|
5
|
|
|
* |
|
6
|
|
|
* @author Augmentum SpikeSource Team |
|
7
|
|
|
* @copyright 2005 by Augmentum, Inc. |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
// Import the precondition class. |
|
11
|
|
|
if(is_dir('../Public')) |
|
12
|
|
|
{ |
|
13
|
|
|
require_once('../Public/SetPrecondition.php'); |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* This class is to test the group management. |
|
18
|
|
|
* It includes create/drop/alter/list groups. |
|
19
|
|
|
*/ |
|
20
|
|
|
class GroupsTest extends PreconditionSet |
|
21
|
|
|
{ |
|
22
|
|
|
// Declare the member variable for group name. |
|
23
|
|
|
private $_groupName = "testgroup"; |
|
24
|
|
|
|
|
25
|
|
|
function setUp() |
|
26
|
|
|
{ |
|
27
|
|
|
global $webUrl; |
|
28
|
|
|
global $SUPER_USER_NAME; |
|
29
|
|
|
global $SUPER_USER_PASSWORD; |
|
30
|
|
|
|
|
31
|
|
|
$this->login($SUPER_USER_NAME, $SUPER_USER_PASSWORD, "$webUrl/login.php"); |
|
32
|
|
|
|
|
33
|
|
|
return TRUE; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
function tearDown() |
|
37
|
|
|
{ |
|
38
|
|
|
$this->logout(); |
|
39
|
|
|
|
|
40
|
|
|
return TRUE; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/* |
|
44
|
|
|
* TestCaseID: SCG01 |
|
45
|
|
|
* Test to create group. |
|
46
|
|
|
*/ |
|
47
|
|
|
function testCreate() |
|
48
|
|
|
{ |
|
49
|
|
|
global $webUrl; |
|
50
|
|
|
global $POWER_USER_NAME; |
|
51
|
|
|
global $NORMAL_USER_NAME; |
|
52
|
|
|
global $lang, $SERVER; |
|
53
|
|
|
|
|
54
|
|
|
// Turn to create group page. |
|
55
|
|
|
$this->assertTrue($this->get("$webUrl/groups.php", array('server' => $SERVER))); |
|
56
|
|
|
$this->assertTrue($this->clickLink($lang['strcreategroup'])); |
|
57
|
|
|
|
|
58
|
|
|
// Enter the information for creating group. |
|
59
|
|
|
$this->assertTrue($this->setField('name', $this->_groupName)); |
|
60
|
|
|
$this->assertTrue($this->setField('members[]', array($POWER_USER_NAME, $NORMAL_USER_NAME))); |
|
61
|
|
|
|
|
62
|
|
|
// Then submit and verify it. |
|
63
|
|
|
$this->assertTrue($this->clickSubmit($lang['strcreate'])); |
|
64
|
|
|
$this->assertWantedText($lang['strgroupcreated']); |
|
65
|
|
|
$this->assertWantedText($this->_groupName); |
|
66
|
|
|
|
|
67
|
|
|
return TRUE; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
|
|
71
|
|
|
/* |
|
72
|
|
|
* TestCaseID: SAG01 |
|
73
|
|
|
* Test to add users to the gruop. |
|
74
|
|
|
*/ |
|
75
|
|
|
function testAddUser() |
|
76
|
|
|
{ |
|
77
|
|
|
global $webUrl; |
|
78
|
|
|
global $SUPER_USER_NAME; |
|
79
|
|
|
global $POWER_USER_NAME; |
|
80
|
|
|
global $NORMAL_USER_NAME; |
|
81
|
|
|
global $lang, $SERVER; |
|
82
|
|
|
|
|
83
|
|
|
// Turn to the gruop's properties page. |
|
84
|
|
|
$this->assertTrue($this->get("$webUrl/groups.php", array('server' => $SERVER))); |
|
85
|
|
|
$this->assertTrue($this->get("$webUrl/groups.php", |
|
86
|
|
|
array('action' => 'properties', |
|
87
|
|
|
'group' => $this->_groupName, |
|
88
|
|
|
'server' => $SERVER)) |
|
89
|
|
|
); |
|
90
|
|
|
|
|
91
|
|
|
// Select user and add it to the group. |
|
92
|
|
|
$this->assertTrue($this->setField('user', $SUPER_USER_NAME)); |
|
93
|
|
|
$this->assertTrue($this->clickSubmit($lang['straddmember'])); |
|
94
|
|
|
$this->assertTrue($this->setField('user', $POWER_USER_NAME)); |
|
95
|
|
|
$this->assertTrue($this->clickSubmit($lang['straddmember'])); |
|
96
|
|
|
|
|
97
|
|
|
// Verify the group's memebers. |
|
98
|
|
|
$this->assertWantedText($SUPER_USER_NAME); |
|
99
|
|
|
$this->assertWantedText($POWER_USER_NAME); |
|
100
|
|
|
$this->assertWantedText($NORMAL_USER_NAME); |
|
101
|
|
|
|
|
102
|
|
|
return TRUE; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
|
|
106
|
|
|
/* |
|
107
|
|
|
* TestCaseID: SRG01 |
|
108
|
|
|
* Test to Remove users from the group. |
|
109
|
|
|
*/ |
|
110
|
|
|
function testRemoveUser() |
|
111
|
|
|
{ |
|
112
|
|
|
global $webUrl; |
|
113
|
|
|
global $SUPER_USER_NAME; |
|
114
|
|
|
global $POWER_USER_NAME; |
|
115
|
|
|
global $NORMAL_USER_NAME; |
|
116
|
|
|
global $lang, $SERVER; |
|
117
|
|
|
|
|
118
|
|
|
// Turn to the gruop properties page. |
|
119
|
|
|
$this->assertTrue($this->get("$webUrl/groups.php", array('server' => $SERVER))); |
|
120
|
|
|
$this->assertTrue($this->get("$webUrl/groups.php", |
|
121
|
|
|
array('action' => 'properties', |
|
122
|
|
|
'group' => $this->_groupName, |
|
123
|
|
|
'server' => $SERVER)) |
|
124
|
|
|
); |
|
125
|
|
|
|
|
126
|
|
|
// Drop users from the group and verify it. |
|
127
|
|
|
$this->assertTrue($this->clickLink($lang['strdrop'])); |
|
128
|
|
|
$this->assertTrue($this->clickSubmit($lang['strdrop'])); |
|
129
|
|
|
$this->assertWantedText($lang['strmemberdropped']); |
|
130
|
|
|
|
|
131
|
|
|
return TRUE; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
|
|
135
|
|
|
/* |
|
136
|
|
|
* TestCaseID: SDG01 |
|
137
|
|
|
* Test to drop the group. |
|
138
|
|
|
*/ |
|
139
|
|
|
function testDrop() |
|
140
|
|
|
{ |
|
141
|
|
|
global $webUrl; |
|
142
|
|
|
global $lang, $SERVER; |
|
143
|
|
|
|
|
144
|
|
|
// Turn to the drop group page.. |
|
145
|
|
|
$this->assertTrue($this->get("$webUrl/groups.php", array('server' => $SERVER))); |
|
146
|
|
|
$this->assertTrue($this->get("$webUrl/groups.php", |
|
147
|
|
|
array('server' => $SERVER, |
|
148
|
|
|
'action' => 'confirm_drop', |
|
149
|
|
|
'group' => $this->_groupName)) |
|
150
|
|
|
); |
|
151
|
|
|
|
|
152
|
|
|
// Confirm to drop the group and verify it. |
|
153
|
|
|
$this->assertTrue($this->clickSubmit($lang['strdrop'])); |
|
154
|
|
|
$this->assertWantedText($lang['strgroupdropped']); |
|
155
|
|
|
$this->assertNoUnWantedText($this->_groupName); |
|
156
|
|
|
|
|
157
|
|
|
return TRUE; |
|
158
|
|
|
} |
|
159
|
|
|
} |
|
160
|
|
|
?> |
|
161
|
|
|
|