@@ -4,320 +4,320 @@ discard block |
||
4 | 4 | class SecurityGroupTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | 6 | |
7 | - public function testSecurityGroup(){ |
|
7 | + public function testSecurityGroup(){ |
|
8 | 8 | |
9 | - //execute the contructor and check for the Object type and attributes |
|
10 | - $securityGroup = new SecurityGroup(); |
|
9 | + //execute the contructor and check for the Object type and attributes |
|
10 | + $securityGroup = new SecurityGroup(); |
|
11 | 11 | |
12 | - $this->assertInstanceOf('SecurityGroup',$securityGroup); |
|
13 | - $this->assertInstanceOf('Basic',$securityGroup); |
|
14 | - $this->assertInstanceOf('SugarBean',$securityGroup); |
|
12 | + $this->assertInstanceOf('SecurityGroup',$securityGroup); |
|
13 | + $this->assertInstanceOf('Basic',$securityGroup); |
|
14 | + $this->assertInstanceOf('SugarBean',$securityGroup); |
|
15 | 15 | |
16 | - $this->assertAttributeEquals('securitygroups', 'table_name', $securityGroup); |
|
17 | - $this->assertAttributeEquals('SecurityGroups', 'module_dir', $securityGroup); |
|
18 | - $this->assertAttributeEquals('SecurityGroup', 'object_name', $securityGroup); |
|
16 | + $this->assertAttributeEquals('securitygroups', 'table_name', $securityGroup); |
|
17 | + $this->assertAttributeEquals('SecurityGroups', 'module_dir', $securityGroup); |
|
18 | + $this->assertAttributeEquals('SecurityGroup', 'object_name', $securityGroup); |
|
19 | 19 | |
20 | - } |
|
20 | + } |
|
21 | 21 | |
22 | 22 | |
23 | - public function testgetGroupWhere() |
|
24 | - { |
|
25 | - error_reporting(E_ERROR | E_PARSE); |
|
23 | + public function testgetGroupWhere() |
|
24 | + { |
|
25 | + error_reporting(E_ERROR | E_PARSE); |
|
26 | 26 | |
27 | - $securityGroup = new SecurityGroup(); |
|
27 | + $securityGroup = new SecurityGroup(); |
|
28 | 28 | |
29 | - //test with securitygroups module |
|
30 | - $expected = " securitygroups.id in (\n select secg.id from securitygroups secg\n inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n where secg.deleted = 0\n )"; |
|
31 | - $actual = $securityGroup->getGroupWhere("securitygroups","SecurityGroups",1); |
|
32 | - $this->assertSame($expected,$actual); |
|
29 | + //test with securitygroups module |
|
30 | + $expected = " securitygroups.id in (\n select secg.id from securitygroups secg\n inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n where secg.deleted = 0\n )"; |
|
31 | + $actual = $securityGroup->getGroupWhere("securitygroups","SecurityGroups",1); |
|
32 | + $this->assertSame($expected,$actual); |
|
33 | 33 | |
34 | 34 | |
35 | - //test with //test with securitygroups module module |
|
36 | - $expected = " EXISTS (SELECT 1\n FROM securitygroups secg\n INNER JOIN securitygroups_users secu \n ON secg.id = secu.securitygroup_id \n AND secu.deleted = 0 \n AND secu.user_id = '1'\n INNER JOIN securitygroups_records secr \n ON secg.id = secr.securitygroup_id \n AND secr.deleted = 0 \n AND secr.module = 'Users'\n WHERE secr.record_id = users.id\n AND secg.deleted = 0) "; |
|
37 | - $actual = $securityGroup->getGroupWhere("users","Users",1); |
|
38 | - $this->assertSame($expected,$actual); |
|
35 | + //test with //test with securitygroups module module |
|
36 | + $expected = " EXISTS (SELECT 1\n FROM securitygroups secg\n INNER JOIN securitygroups_users secu \n ON secg.id = secu.securitygroup_id \n AND secu.deleted = 0 \n AND secu.user_id = '1'\n INNER JOIN securitygroups_records secr \n ON secg.id = secr.securitygroup_id \n AND secr.deleted = 0 \n AND secr.module = 'Users'\n WHERE secr.record_id = users.id\n AND secg.deleted = 0) "; |
|
37 | + $actual = $securityGroup->getGroupWhere("users","Users",1); |
|
38 | + $this->assertSame($expected,$actual); |
|
39 | 39 | |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | - public function testgetGroupUsersWhere() |
|
43 | - { |
|
44 | - $securityGroup = new SecurityGroup(); |
|
42 | + public function testgetGroupUsersWhere() |
|
43 | + { |
|
44 | + $securityGroup = new SecurityGroup(); |
|
45 | 45 | |
46 | - $expected = " users.id in (\n select sec.user_id from securitygroups_users sec\n inner join securitygroups_users secu on sec.securitygroup_id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n where sec.deleted = 0\n )"; |
|
47 | - $actual = $securityGroup->getGroupUsersWhere(1); |
|
46 | + $expected = " users.id in (\n select sec.user_id from securitygroups_users sec\n inner join securitygroups_users secu on sec.securitygroup_id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n where sec.deleted = 0\n )"; |
|
47 | + $actual = $securityGroup->getGroupUsersWhere(1); |
|
48 | 48 | |
49 | - $this->assertSame($expected,$actual); |
|
49 | + $this->assertSame($expected,$actual); |
|
50 | 50 | |
51 | - } |
|
51 | + } |
|
52 | 52 | |
53 | - public function testgetGroupJoin() |
|
54 | - { |
|
53 | + public function testgetGroupJoin() |
|
54 | + { |
|
55 | 55 | |
56 | - $securityGroup = new SecurityGroup(); |
|
56 | + $securityGroup = new SecurityGroup(); |
|
57 | 57 | |
58 | - //test with securitygroups module |
|
59 | - $expected = " LEFT JOIN (select distinct secg.id from securitygroups secg\n inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n where secg.deleted = 0\n) securitygroup_join on securitygroup_join.id = securitygroups.id "; |
|
60 | - $actual = $securityGroup->getGroupJoin("securitygroups","SecurityGroups",1); |
|
61 | - $this->assertSame($expected,$actual); |
|
58 | + //test with securitygroups module |
|
59 | + $expected = " LEFT JOIN (select distinct secg.id from securitygroups secg\n inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n where secg.deleted = 0\n) securitygroup_join on securitygroup_join.id = securitygroups.id "; |
|
60 | + $actual = $securityGroup->getGroupJoin("securitygroups","SecurityGroups",1); |
|
61 | + $this->assertSame($expected,$actual); |
|
62 | 62 | |
63 | 63 | |
64 | - //test with //test with securitygroups module |
|
65 | - $expected = " LEFT JOIN (select distinct secr.record_id as id from securitygroups secg\n inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n inner join securitygroups_records secr on secg.id = secr.securitygroup_id and secr.deleted = 0\n and secr.module = 'Users'\n where secg.deleted = 0\n) securitygroup_join on securitygroup_join.id = users.id "; |
|
66 | - $actual = $securityGroup->getGroupJoin("users","Users",1); |
|
67 | - $this->assertSame($expected,$actual); |
|
64 | + //test with //test with securitygroups module |
|
65 | + $expected = " LEFT JOIN (select distinct secr.record_id as id from securitygroups secg\n inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n inner join securitygroups_records secr on secg.id = secr.securitygroup_id and secr.deleted = 0\n and secr.module = 'Users'\n where secg.deleted = 0\n) securitygroup_join on securitygroup_join.id = users.id "; |
|
66 | + $actual = $securityGroup->getGroupJoin("users","Users",1); |
|
67 | + $this->assertSame($expected,$actual); |
|
68 | 68 | |
69 | - } |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | - public function testgetGroupUsersJoin() |
|
73 | - { |
|
72 | + public function testgetGroupUsersJoin() |
|
73 | + { |
|
74 | 74 | |
75 | - $securityGroup = new SecurityGroup(); |
|
75 | + $securityGroup = new SecurityGroup(); |
|
76 | 76 | |
77 | - $expected = " LEFT JOIN (\n select distinct sec.user_id as id from securitygroups_users sec\n inner join securitygroups_users secu on sec.securitygroup_id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n where sec.deleted = 0\n ) securitygroup_join on securitygroup_join.id = users.id "; |
|
78 | - $actual = $securityGroup->getGroupUsersJoin(1); |
|
79 | - $this->assertSame($expected,$actual); |
|
77 | + $expected = " LEFT JOIN (\n select distinct sec.user_id as id from securitygroups_users sec\n inner join securitygroups_users secu on sec.securitygroup_id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n where sec.deleted = 0\n ) securitygroup_join on securitygroup_join.id = users.id "; |
|
78 | + $actual = $securityGroup->getGroupUsersJoin(1); |
|
79 | + $this->assertSame($expected,$actual); |
|
80 | 80 | |
81 | - } |
|
81 | + } |
|
82 | 82 | |
83 | 83 | |
84 | - public function testgroupHasAccess() |
|
85 | - { |
|
84 | + public function testgroupHasAccess() |
|
85 | + { |
|
86 | 86 | |
87 | - //test for listview |
|
88 | - $result = SecurityGroup::groupHasAccess('', '[SELECT_ID_LIST]'); |
|
89 | - $this->assertEquals(True,$result); |
|
87 | + //test for listview |
|
88 | + $result = SecurityGroup::groupHasAccess('', '[SELECT_ID_LIST]'); |
|
89 | + $this->assertEquals(True,$result); |
|
90 | 90 | |
91 | 91 | |
92 | - //test with invalid values |
|
93 | - $result = SecurityGroup::groupHasAccess('', ''); |
|
94 | - $this->assertEquals(false,$result); |
|
92 | + //test with invalid values |
|
93 | + $result = SecurityGroup::groupHasAccess('', ''); |
|
94 | + $this->assertEquals(false,$result); |
|
95 | 95 | |
96 | 96 | |
97 | - //test with valid values |
|
98 | - $result = SecurityGroup::groupHasAccess('Users', '1'); |
|
99 | - $this->assertEquals(false,$result); |
|
97 | + //test with valid values |
|
98 | + $result = SecurityGroup::groupHasAccess('Users', '1'); |
|
99 | + $this->assertEquals(false,$result); |
|
100 | 100 | |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | - public function testinherit() |
|
104 | - { |
|
105 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
106 | - global $db; |
|
107 | - unset ($db->database); |
|
108 | - $db->checkConnection(); |
|
103 | + public function testinherit() |
|
104 | + { |
|
105 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
106 | + global $db; |
|
107 | + unset ($db->database); |
|
108 | + $db->checkConnection(); |
|
109 | 109 | |
110 | - $account = new Account(); |
|
111 | - $account->id = 1; |
|
110 | + $account = new Account(); |
|
111 | + $account->id = 1; |
|
112 | 112 | |
113 | - $_REQUEST['subpanel_field_name'] = "id"; |
|
113 | + $_REQUEST['subpanel_field_name'] = "id"; |
|
114 | 114 | |
115 | - //execute the method and test if it works and does not throws an exception. |
|
116 | - try { |
|
117 | - SecurityGroup::inherit($account,false); |
|
118 | - $this->assertTrue(true); |
|
119 | - } |
|
120 | - catch (Exception $e) { |
|
121 | - $this->fail(); |
|
122 | - } |
|
123 | - |
|
124 | - } |
|
125 | - |
|
126 | - public function testassign_default_groups() |
|
127 | - { |
|
115 | + //execute the method and test if it works and does not throws an exception. |
|
116 | + try { |
|
117 | + SecurityGroup::inherit($account,false); |
|
118 | + $this->assertTrue(true); |
|
119 | + } |
|
120 | + catch (Exception $e) { |
|
121 | + $this->fail(); |
|
122 | + } |
|
123 | + |
|
124 | + } |
|
125 | + |
|
126 | + public function testassign_default_groups() |
|
127 | + { |
|
128 | 128 | |
129 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
130 | - global $db; |
|
131 | - unset ($db->database); |
|
132 | - $db->checkConnection(); |
|
133 | - |
|
134 | - $account = new Account(); |
|
135 | - $account->id = 1; |
|
136 | - |
|
137 | - //execute the method and test if it works and does not throws an exception. |
|
138 | - try { |
|
139 | - SecurityGroup::assign_default_groups($account,false); |
|
140 | - $this->assertTrue(true); |
|
141 | - } |
|
142 | - catch (Exception $e) { |
|
143 | - $this->fail(); |
|
144 | - } |
|
145 | - |
|
146 | - } |
|
147 | - |
|
148 | - public function testinherit_creator() |
|
149 | - { |
|
150 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
151 | - global $db; |
|
152 | - unset ($db->database); |
|
153 | - $db->checkConnection(); |
|
129 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
130 | + global $db; |
|
131 | + unset ($db->database); |
|
132 | + $db->checkConnection(); |
|
133 | + |
|
134 | + $account = new Account(); |
|
135 | + $account->id = 1; |
|
136 | + |
|
137 | + //execute the method and test if it works and does not throws an exception. |
|
138 | + try { |
|
139 | + SecurityGroup::assign_default_groups($account,false); |
|
140 | + $this->assertTrue(true); |
|
141 | + } |
|
142 | + catch (Exception $e) { |
|
143 | + $this->fail(); |
|
144 | + } |
|
145 | + |
|
146 | + } |
|
147 | + |
|
148 | + public function testinherit_creator() |
|
149 | + { |
|
150 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
151 | + global $db; |
|
152 | + unset ($db->database); |
|
153 | + $db->checkConnection(); |
|
154 | 154 | |
155 | - $account = new Account(); |
|
156 | - $account->id = 1; |
|
157 | - |
|
158 | - //execute the method and test if it works and does not throws an exception. |
|
159 | - try { |
|
160 | - SecurityGroup::inherit_creator($account,false); |
|
161 | - $this->assertTrue(true); |
|
162 | - } |
|
163 | - catch (Exception $e) { |
|
164 | - $this->fail(); |
|
165 | - } |
|
155 | + $account = new Account(); |
|
156 | + $account->id = 1; |
|
157 | + |
|
158 | + //execute the method and test if it works and does not throws an exception. |
|
159 | + try { |
|
160 | + SecurityGroup::inherit_creator($account,false); |
|
161 | + $this->assertTrue(true); |
|
162 | + } |
|
163 | + catch (Exception $e) { |
|
164 | + $this->fail(); |
|
165 | + } |
|
166 | 166 | |
167 | - } |
|
167 | + } |
|
168 | 168 | |
169 | - public function testinherit_assigned() |
|
170 | - { |
|
169 | + public function testinherit_assigned() |
|
170 | + { |
|
171 | 171 | |
172 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
173 | - global $db; |
|
174 | - unset ($db->database); |
|
175 | - $db->checkConnection(); |
|
172 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
173 | + global $db; |
|
174 | + unset ($db->database); |
|
175 | + $db->checkConnection(); |
|
176 | 176 | |
177 | - $account = new Account(); |
|
178 | - $account->id = 1; |
|
179 | - $account->assigned_user_id = 1; |
|
177 | + $account = new Account(); |
|
178 | + $account->id = 1; |
|
179 | + $account->assigned_user_id = 1; |
|
180 | 180 | |
181 | - //execute the method and test if it works and does not throws an exception. |
|
182 | - try { |
|
183 | - SecurityGroup::inherit_assigned($account,false); |
|
184 | - $this->assertTrue(true); |
|
185 | - } |
|
186 | - catch (Exception $e) { |
|
187 | - $this->fail(); |
|
188 | - } |
|
181 | + //execute the method and test if it works and does not throws an exception. |
|
182 | + try { |
|
183 | + SecurityGroup::inherit_assigned($account,false); |
|
184 | + $this->assertTrue(true); |
|
185 | + } |
|
186 | + catch (Exception $e) { |
|
187 | + $this->fail(); |
|
188 | + } |
|
189 | 189 | |
190 | - } |
|
190 | + } |
|
191 | 191 | |
192 | - public function testinherit_parent() |
|
193 | - { |
|
192 | + public function testinherit_parent() |
|
193 | + { |
|
194 | 194 | |
195 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
196 | - global $db; |
|
197 | - unset ($db->database); |
|
198 | - $db->checkConnection(); |
|
195 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
196 | + global $db; |
|
197 | + unset ($db->database); |
|
198 | + $db->checkConnection(); |
|
199 | 199 | |
200 | - $account = new Account(); |
|
201 | - $account->id = 1; |
|
200 | + $account = new Account(); |
|
201 | + $account->id = 1; |
|
202 | 202 | |
203 | - //execute the method and test if it works and does not throws an exception. |
|
204 | - try { |
|
205 | - SecurityGroup::inherit_parent($account,false); |
|
206 | - $this->assertTrue(true); |
|
207 | - } |
|
208 | - catch (Exception $e) { |
|
209 | - $this->fail(); |
|
210 | - } |
|
203 | + //execute the method and test if it works and does not throws an exception. |
|
204 | + try { |
|
205 | + SecurityGroup::inherit_parent($account,false); |
|
206 | + $this->assertTrue(true); |
|
207 | + } |
|
208 | + catch (Exception $e) { |
|
209 | + $this->fail(); |
|
210 | + } |
|
211 | 211 | |
212 | 212 | |
213 | - } |
|
213 | + } |
|
214 | 214 | |
215 | - public function testinherit_parentQuery() |
|
216 | - { |
|
217 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
218 | - global $db; |
|
219 | - unset ($db->database); |
|
220 | - $db->checkConnection(); |
|
215 | + public function testinherit_parentQuery() |
|
216 | + { |
|
217 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
218 | + global $db; |
|
219 | + unset ($db->database); |
|
220 | + $db->checkConnection(); |
|
221 | 221 | |
222 | - $account = new Account(); |
|
223 | - $account->id = 1; |
|
222 | + $account = new Account(); |
|
223 | + $account->id = 1; |
|
224 | 224 | |
225 | - //execute the method and test if it works and does not throws an exception. |
|
226 | - try { |
|
227 | - SecurityGroup::inherit_parentQuery($account, "Accounts", 1, 1 , $account->module_dir); |
|
228 | - $this->assertTrue(true); |
|
229 | - } |
|
230 | - catch (Exception $e) { |
|
231 | - $this->fail(); |
|
232 | - } |
|
225 | + //execute the method and test if it works and does not throws an exception. |
|
226 | + try { |
|
227 | + SecurityGroup::inherit_parentQuery($account, "Accounts", 1, 1 , $account->module_dir); |
|
228 | + $this->assertTrue(true); |
|
229 | + } |
|
230 | + catch (Exception $e) { |
|
231 | + $this->fail(); |
|
232 | + } |
|
233 | 233 | |
234 | - } |
|
234 | + } |
|
235 | 235 | |
236 | 236 | |
237 | - public function testinheritOne() { |
|
237 | + public function testinheritOne() { |
|
238 | 238 | |
239 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
240 | - global $db; |
|
241 | - unset ($db->database); |
|
242 | - $db->checkConnection(); |
|
239 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
240 | + global $db; |
|
241 | + unset ($db->database); |
|
242 | + $db->checkConnection(); |
|
243 | 243 | |
244 | - $securityGroup = new SecurityGroup(); |
|
244 | + $securityGroup = new SecurityGroup(); |
|
245 | 245 | |
246 | - $result = $securityGroup->inheritOne(1, 1, "Accounts"); |
|
247 | - $this->assertEquals(false, $result); |
|
246 | + $result = $securityGroup->inheritOne(1, 1, "Accounts"); |
|
247 | + $this->assertEquals(false, $result); |
|
248 | 248 | |
249 | - } |
|
249 | + } |
|
250 | 250 | |
251 | 251 | |
252 | - public function testgetMembershipCount() { |
|
252 | + public function testgetMembershipCount() { |
|
253 | 253 | |
254 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
255 | - global $db; |
|
256 | - unset ($db->database); |
|
257 | - $db->checkConnection(); |
|
254 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
255 | + global $db; |
|
256 | + unset ($db->database); |
|
257 | + $db->checkConnection(); |
|
258 | 258 | |
259 | - $securityGroup = new SecurityGroup(); |
|
259 | + $securityGroup = new SecurityGroup(); |
|
260 | 260 | |
261 | - $result = $securityGroup->getMembershipCount("1"); |
|
262 | - $this->assertEquals(0, $result); |
|
261 | + $result = $securityGroup->getMembershipCount("1"); |
|
262 | + $this->assertEquals(0, $result); |
|
263 | 263 | |
264 | - } |
|
264 | + } |
|
265 | 265 | |
266 | 266 | |
267 | - public function testSaveAndRetrieveAndRemoveDefaultGroups() { |
|
267 | + public function testSaveAndRetrieveAndRemoveDefaultGroups() { |
|
268 | 268 | |
269 | 269 | |
270 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
271 | - global $db; |
|
272 | - unset ($db->database); |
|
273 | - $db->checkConnection(); |
|
270 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
271 | + global $db; |
|
272 | + unset ($db->database); |
|
273 | + $db->checkConnection(); |
|
274 | 274 | |
275 | - $securityGroup = new SecurityGroup(); |
|
275 | + $securityGroup = new SecurityGroup(); |
|
276 | 276 | |
277 | - //create a security group first |
|
278 | - $securityGroup->name = "test"; |
|
279 | - $securityGroup->save(); |
|
277 | + //create a security group first |
|
278 | + $securityGroup->name = "test"; |
|
279 | + $securityGroup->save(); |
|
280 | 280 | |
281 | 281 | |
282 | - //execute saveDefaultGroup method |
|
283 | - $securityGroup->saveDefaultGroup($securityGroup->id, "test_module"); |
|
282 | + //execute saveDefaultGroup method |
|
283 | + $securityGroup->saveDefaultGroup($securityGroup->id, "test_module"); |
|
284 | 284 | |
285 | - //execute retrieveDefaultGroups method |
|
286 | - $result = $securityGroup->retrieveDefaultGroups(); |
|
285 | + //execute retrieveDefaultGroups method |
|
286 | + $result = $securityGroup->retrieveDefaultGroups(); |
|
287 | 287 | |
288 | - //verify that default group is created |
|
289 | - $this->assertTrue(is_array($result)); |
|
290 | - $this->assertGreaterThan(0, count($result)); |
|
288 | + //verify that default group is created |
|
289 | + $this->assertTrue(is_array($result)); |
|
290 | + $this->assertGreaterThan(0, count($result)); |
|
291 | 291 | |
292 | 292 | |
293 | - //execute removeDefaultGroup method for each default group |
|
294 | - foreach($result as $key=>$value){ |
|
295 | - $securityGroup->removeDefaultGroup($key); |
|
296 | - } |
|
293 | + //execute removeDefaultGroup method for each default group |
|
294 | + foreach($result as $key=>$value){ |
|
295 | + $securityGroup->removeDefaultGroup($key); |
|
296 | + } |
|
297 | 297 | |
298 | 298 | |
299 | - //retrieve back and verify that default securith groups are deleted |
|
300 | - $result = $securityGroup->retrieveDefaultGroups(); |
|
301 | - $this->assertEquals(0, count($result)); |
|
299 | + //retrieve back and verify that default securith groups are deleted |
|
300 | + $result = $securityGroup->retrieveDefaultGroups(); |
|
301 | + $this->assertEquals(0, count($result)); |
|
302 | 302 | |
303 | 303 | |
304 | - //delete the security group as well for cleanup |
|
305 | - $securityGroup->mark_deleted($securityGroup->id); |
|
304 | + //delete the security group as well for cleanup |
|
305 | + $securityGroup->mark_deleted($securityGroup->id); |
|
306 | 306 | |
307 | 307 | |
308 | - } |
|
308 | + } |
|
309 | 309 | |
310 | 310 | |
311 | - public function testgetSecurityModules() { |
|
311 | + public function testgetSecurityModules() { |
|
312 | 312 | |
313 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
314 | - global $db; |
|
315 | - unset ($db->database); |
|
316 | - $db->checkConnection(); |
|
313 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
314 | + global $db; |
|
315 | + unset ($db->database); |
|
316 | + $db->checkConnection(); |
|
317 | 317 | |
318 | - $securityGroup = new SecurityGroup(); |
|
318 | + $securityGroup = new SecurityGroup(); |
|
319 | 319 | |
320 | - $expected = array ( |
|
320 | + $expected = array ( |
|
321 | 321 | 'Meetings', |
322 | 322 | 'Cases', |
323 | 323 | 'AOS_Products', |
@@ -352,142 +352,142 @@ discard block |
||
352 | 352 | 'ACLRoles', |
353 | 353 | 'jjwg_Maps', |
354 | 354 | 'AOS_Product_Categories', |
355 | - ); |
|
355 | + ); |
|
356 | 356 | |
357 | 357 | |
358 | - $actual = $securityGroup->getSecurityModules(); |
|
358 | + $actual = $securityGroup->getSecurityModules(); |
|
359 | 359 | $actualKeys = array_keys($actual); |
360 | 360 | sort($expected); |
361 | 361 | sort($actualKeys); |
362 | - $this->assertSame($expected,$actualKeys); |
|
362 | + $this->assertSame($expected,$actualKeys); |
|
363 | 363 | |
364 | - } |
|
364 | + } |
|
365 | 365 | |
366 | 366 | |
367 | - public function testgetLinkName() { |
|
367 | + public function testgetLinkName() { |
|
368 | 368 | |
369 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
370 | - global $db; |
|
371 | - unset ($db->database); |
|
372 | - $db->checkConnection(); |
|
369 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
370 | + global $db; |
|
371 | + unset ($db->database); |
|
372 | + $db->checkConnection(); |
|
373 | 373 | |
374 | 374 | |
375 | - $securityGroup = new SecurityGroup(); |
|
375 | + $securityGroup = new SecurityGroup(); |
|
376 | 376 | |
377 | - $result = $securityGroup->getLinkName("Accounts","Contacts"); |
|
378 | - $this->assertEquals("contacts",$result); |
|
377 | + $result = $securityGroup->getLinkName("Accounts","Contacts"); |
|
378 | + $this->assertEquals("contacts",$result); |
|
379 | 379 | |
380 | 380 | |
381 | - $result = $securityGroup->getLinkName("SecurityGroups","ACLRoles"); |
|
382 | - $this->assertEquals("aclroles",$result); |
|
381 | + $result = $securityGroup->getLinkName("SecurityGroups","ACLRoles"); |
|
382 | + $this->assertEquals("aclroles",$result); |
|
383 | 383 | |
384 | - error_reporting(E_ALL); |
|
385 | - //error_reporting(E_ERROR | E_PARSE); |
|
386 | - } |
|
384 | + error_reporting(E_ALL); |
|
385 | + //error_reporting(E_ERROR | E_PARSE); |
|
386 | + } |
|
387 | 387 | |
388 | 388 | |
389 | - public function testaddGroupToRecord() |
|
390 | - { |
|
391 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
392 | - global $db; |
|
393 | - unset ($db->database); |
|
394 | - $db->checkConnection(); |
|
389 | + public function testaddGroupToRecord() |
|
390 | + { |
|
391 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
392 | + global $db; |
|
393 | + unset ($db->database); |
|
394 | + $db->checkConnection(); |
|
395 | 395 | |
396 | - $securityGroup = new SecurityGroup(); |
|
396 | + $securityGroup = new SecurityGroup(); |
|
397 | 397 | |
398 | - //execute the method and test if it works and does not throws an exception. |
|
399 | - try { |
|
400 | - $securityGroup->addGroupToRecord("Accounts", 1, 1); |
|
401 | - $this->assertTrue(true); |
|
402 | - } |
|
403 | - catch (Exception $e) { |
|
404 | - $this->fail(); |
|
405 | - } |
|
398 | + //execute the method and test if it works and does not throws an exception. |
|
399 | + try { |
|
400 | + $securityGroup->addGroupToRecord("Accounts", 1, 1); |
|
401 | + $this->assertTrue(true); |
|
402 | + } |
|
403 | + catch (Exception $e) { |
|
404 | + $this->fail(); |
|
405 | + } |
|
406 | 406 | |
407 | - } |
|
407 | + } |
|
408 | 408 | |
409 | 409 | |
410 | - public function testremoveGroupFromRecord() |
|
411 | - { |
|
412 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
413 | - global $db; |
|
414 | - unset ($db->database); |
|
415 | - $db->checkConnection(); |
|
410 | + public function testremoveGroupFromRecord() |
|
411 | + { |
|
412 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
413 | + global $db; |
|
414 | + unset ($db->database); |
|
415 | + $db->checkConnection(); |
|
416 | 416 | |
417 | - $securityGroup = new SecurityGroup(); |
|
417 | + $securityGroup = new SecurityGroup(); |
|
418 | 418 | |
419 | - //execute the method and test if it works and does not throws an exception. |
|
420 | - try { |
|
421 | - $securityGroup->removeGroupFromRecord("Accounts", 1, 1); |
|
422 | - $this->assertTrue(true); |
|
423 | - } |
|
424 | - catch (Exception $e) { |
|
425 | - $this->fail(); |
|
426 | - } |
|
419 | + //execute the method and test if it works and does not throws an exception. |
|
420 | + try { |
|
421 | + $securityGroup->removeGroupFromRecord("Accounts", 1, 1); |
|
422 | + $this->assertTrue(true); |
|
423 | + } |
|
424 | + catch (Exception $e) { |
|
425 | + $this->fail(); |
|
426 | + } |
|
427 | 427 | |
428 | - } |
|
428 | + } |
|
429 | 429 | |
430 | 430 | |
431 | - public function testgetUserSecurityGroups() |
|
432 | - { |
|
433 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
434 | - global $db; |
|
435 | - unset ($db->database); |
|
436 | - $db->checkConnection(); |
|
431 | + public function testgetUserSecurityGroups() |
|
432 | + { |
|
433 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
434 | + global $db; |
|
435 | + unset ($db->database); |
|
436 | + $db->checkConnection(); |
|
437 | 437 | |
438 | - $securityGroup = new SecurityGroup(); |
|
438 | + $securityGroup = new SecurityGroup(); |
|
439 | 439 | |
440 | - $result = $securityGroup->getUserSecurityGroups("1"); |
|
440 | + $result = $securityGroup->getUserSecurityGroups("1"); |
|
441 | 441 | |
442 | - $this->assertTrue(is_array($result)); |
|
442 | + $this->assertTrue(is_array($result)); |
|
443 | 443 | |
444 | - } |
|
444 | + } |
|
445 | 445 | |
446 | - public function testgetAllSecurityGroups() |
|
447 | - { |
|
448 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
449 | - global $db; |
|
450 | - unset ($db->database); |
|
451 | - $db->checkConnection(); |
|
446 | + public function testgetAllSecurityGroups() |
|
447 | + { |
|
448 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
449 | + global $db; |
|
450 | + unset ($db->database); |
|
451 | + $db->checkConnection(); |
|
452 | 452 | |
453 | - $securityGroup = new SecurityGroup(); |
|
453 | + $securityGroup = new SecurityGroup(); |
|
454 | 454 | |
455 | - $result = $securityGroup->getAllSecurityGroups(); |
|
455 | + $result = $securityGroup->getAllSecurityGroups(); |
|
456 | 456 | |
457 | - $this->assertTrue(is_array($result)); |
|
457 | + $this->assertTrue(is_array($result)); |
|
458 | 458 | |
459 | - } |
|
459 | + } |
|
460 | 460 | |
461 | - public function testgetMembers() |
|
462 | - { |
|
463 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
464 | - global $db; |
|
465 | - unset ($db->database); |
|
466 | - $db->checkConnection(); |
|
461 | + public function testgetMembers() |
|
462 | + { |
|
463 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
464 | + global $db; |
|
465 | + unset ($db->database); |
|
466 | + $db->checkConnection(); |
|
467 | 467 | |
468 | - $securityGroup = new SecurityGroup(); |
|
468 | + $securityGroup = new SecurityGroup(); |
|
469 | 469 | |
470 | - $result = $securityGroup->getMembers(); |
|
470 | + $result = $securityGroup->getMembers(); |
|
471 | 471 | |
472 | - $this->assertTrue(is_array($result)); |
|
472 | + $this->assertTrue(is_array($result)); |
|
473 | 473 | |
474 | - } |
|
474 | + } |
|
475 | 475 | |
476 | 476 | |
477 | - public function testgetPrimaryGroupID() |
|
478 | - { |
|
479 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
480 | - global $db; |
|
481 | - unset ($db->database); |
|
482 | - $db->checkConnection(); |
|
477 | + public function testgetPrimaryGroupID() |
|
478 | + { |
|
479 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
480 | + global $db; |
|
481 | + unset ($db->database); |
|
482 | + $db->checkConnection(); |
|
483 | 483 | |
484 | - $securityGroup = new SecurityGroup(); |
|
484 | + $securityGroup = new SecurityGroup(); |
|
485 | 485 | |
486 | - $result = $securityGroup->getPrimaryGroupID(); |
|
486 | + $result = $securityGroup->getPrimaryGroupID(); |
|
487 | 487 | |
488 | - $this->assertEquals(null, $result); |
|
488 | + $this->assertEquals(null, $result); |
|
489 | 489 | |
490 | - } |
|
490 | + } |
|
491 | 491 | |
492 | 492 | } |
493 | 493 | ?> |
494 | 494 | \ No newline at end of file |
@@ -4,14 +4,14 @@ discard block |
||
4 | 4 | class SecurityGroupTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | 6 | |
7 | - public function testSecurityGroup(){ |
|
7 | + public function testSecurityGroup() { |
|
8 | 8 | |
9 | 9 | //execute the contructor and check for the Object type and attributes |
10 | 10 | $securityGroup = new SecurityGroup(); |
11 | 11 | |
12 | - $this->assertInstanceOf('SecurityGroup',$securityGroup); |
|
13 | - $this->assertInstanceOf('Basic',$securityGroup); |
|
14 | - $this->assertInstanceOf('SugarBean',$securityGroup); |
|
12 | + $this->assertInstanceOf('SecurityGroup', $securityGroup); |
|
13 | + $this->assertInstanceOf('Basic', $securityGroup); |
|
14 | + $this->assertInstanceOf('SugarBean', $securityGroup); |
|
15 | 15 | |
16 | 16 | $this->assertAttributeEquals('securitygroups', 'table_name', $securityGroup); |
17 | 17 | $this->assertAttributeEquals('SecurityGroups', 'module_dir', $securityGroup); |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | |
29 | 29 | //test with securitygroups module |
30 | 30 | $expected = " securitygroups.id in (\n select secg.id from securitygroups secg\n inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n where secg.deleted = 0\n )"; |
31 | - $actual = $securityGroup->getGroupWhere("securitygroups","SecurityGroups",1); |
|
32 | - $this->assertSame($expected,$actual); |
|
31 | + $actual = $securityGroup->getGroupWhere("securitygroups", "SecurityGroups", 1); |
|
32 | + $this->assertSame($expected, $actual); |
|
33 | 33 | |
34 | 34 | |
35 | 35 | //test with //test with securitygroups module module |
36 | 36 | $expected = " EXISTS (SELECT 1\n FROM securitygroups secg\n INNER JOIN securitygroups_users secu \n ON secg.id = secu.securitygroup_id \n AND secu.deleted = 0 \n AND secu.user_id = '1'\n INNER JOIN securitygroups_records secr \n ON secg.id = secr.securitygroup_id \n AND secr.deleted = 0 \n AND secr.module = 'Users'\n WHERE secr.record_id = users.id\n AND secg.deleted = 0) "; |
37 | - $actual = $securityGroup->getGroupWhere("users","Users",1); |
|
38 | - $this->assertSame($expected,$actual); |
|
37 | + $actual = $securityGroup->getGroupWhere("users", "Users", 1); |
|
38 | + $this->assertSame($expected, $actual); |
|
39 | 39 | |
40 | 40 | } |
41 | 41 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $expected = " users.id in (\n select sec.user_id from securitygroups_users sec\n inner join securitygroups_users secu on sec.securitygroup_id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n where sec.deleted = 0\n )"; |
47 | 47 | $actual = $securityGroup->getGroupUsersWhere(1); |
48 | 48 | |
49 | - $this->assertSame($expected,$actual); |
|
49 | + $this->assertSame($expected, $actual); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | |
58 | 58 | //test with securitygroups module |
59 | 59 | $expected = " LEFT JOIN (select distinct secg.id from securitygroups secg\n inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n where secg.deleted = 0\n) securitygroup_join on securitygroup_join.id = securitygroups.id "; |
60 | - $actual = $securityGroup->getGroupJoin("securitygroups","SecurityGroups",1); |
|
61 | - $this->assertSame($expected,$actual); |
|
60 | + $actual = $securityGroup->getGroupJoin("securitygroups", "SecurityGroups", 1); |
|
61 | + $this->assertSame($expected, $actual); |
|
62 | 62 | |
63 | 63 | |
64 | 64 | //test with //test with securitygroups module |
65 | 65 | $expected = " LEFT JOIN (select distinct secr.record_id as id from securitygroups secg\n inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n inner join securitygroups_records secr on secg.id = secr.securitygroup_id and secr.deleted = 0\n and secr.module = 'Users'\n where secg.deleted = 0\n) securitygroup_join on securitygroup_join.id = users.id "; |
66 | - $actual = $securityGroup->getGroupJoin("users","Users",1); |
|
67 | - $this->assertSame($expected,$actual); |
|
66 | + $actual = $securityGroup->getGroupJoin("users", "Users", 1); |
|
67 | + $this->assertSame($expected, $actual); |
|
68 | 68 | |
69 | 69 | } |
70 | 70 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | $expected = " LEFT JOIN (\n select distinct sec.user_id as id from securitygroups_users sec\n inner join securitygroups_users secu on sec.securitygroup_id = secu.securitygroup_id and secu.deleted = 0\n and secu.user_id = '1'\n where sec.deleted = 0\n ) securitygroup_join on securitygroup_join.id = users.id "; |
78 | 78 | $actual = $securityGroup->getGroupUsersJoin(1); |
79 | - $this->assertSame($expected,$actual); |
|
79 | + $this->assertSame($expected, $actual); |
|
80 | 80 | |
81 | 81 | } |
82 | 82 | |
@@ -86,17 +86,17 @@ discard block |
||
86 | 86 | |
87 | 87 | //test for listview |
88 | 88 | $result = SecurityGroup::groupHasAccess('', '[SELECT_ID_LIST]'); |
89 | - $this->assertEquals(True,$result); |
|
89 | + $this->assertEquals(True, $result); |
|
90 | 90 | |
91 | 91 | |
92 | 92 | //test with invalid values |
93 | 93 | $result = SecurityGroup::groupHasAccess('', ''); |
94 | - $this->assertEquals(false,$result); |
|
94 | + $this->assertEquals(false, $result); |
|
95 | 95 | |
96 | 96 | |
97 | 97 | //test with valid values |
98 | 98 | $result = SecurityGroup::groupHasAccess('Users', '1'); |
99 | - $this->assertEquals(false,$result); |
|
99 | + $this->assertEquals(false, $result); |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | //execute the method and test if it works and does not throws an exception. |
116 | 116 | try { |
117 | - SecurityGroup::inherit($account,false); |
|
117 | + SecurityGroup::inherit($account, false); |
|
118 | 118 | $this->assertTrue(true); |
119 | 119 | } |
120 | 120 | catch (Exception $e) { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | //execute the method and test if it works and does not throws an exception. |
138 | 138 | try { |
139 | - SecurityGroup::assign_default_groups($account,false); |
|
139 | + SecurityGroup::assign_default_groups($account, false); |
|
140 | 140 | $this->assertTrue(true); |
141 | 141 | } |
142 | 142 | catch (Exception $e) { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | //execute the method and test if it works and does not throws an exception. |
159 | 159 | try { |
160 | - SecurityGroup::inherit_creator($account,false); |
|
160 | + SecurityGroup::inherit_creator($account, false); |
|
161 | 161 | $this->assertTrue(true); |
162 | 162 | } |
163 | 163 | catch (Exception $e) { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | //execute the method and test if it works and does not throws an exception. |
182 | 182 | try { |
183 | - SecurityGroup::inherit_assigned($account,false); |
|
183 | + SecurityGroup::inherit_assigned($account, false); |
|
184 | 184 | $this->assertTrue(true); |
185 | 185 | } |
186 | 186 | catch (Exception $e) { |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | //execute the method and test if it works and does not throws an exception. |
204 | 204 | try { |
205 | - SecurityGroup::inherit_parent($account,false); |
|
205 | + SecurityGroup::inherit_parent($account, false); |
|
206 | 206 | $this->assertTrue(true); |
207 | 207 | } |
208 | 208 | catch (Exception $e) { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | //execute the method and test if it works and does not throws an exception. |
226 | 226 | try { |
227 | - SecurityGroup::inherit_parentQuery($account, "Accounts", 1, 1 , $account->module_dir); |
|
227 | + SecurityGroup::inherit_parentQuery($account, "Accounts", 1, 1, $account->module_dir); |
|
228 | 228 | $this->assertTrue(true); |
229 | 229 | } |
230 | 230 | catch (Exception $e) { |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | |
292 | 292 | |
293 | 293 | //execute removeDefaultGroup method for each default group |
294 | - foreach($result as $key=>$value){ |
|
294 | + foreach ($result as $key=>$value) { |
|
295 | 295 | $securityGroup->removeDefaultGroup($key); |
296 | 296 | } |
297 | 297 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | $securityGroup = new SecurityGroup(); |
319 | 319 | |
320 | - $expected = array ( |
|
320 | + $expected = array( |
|
321 | 321 | 'Meetings', |
322 | 322 | 'Cases', |
323 | 323 | 'AOS_Products', |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | $actualKeys = array_keys($actual); |
360 | 360 | sort($expected); |
361 | 361 | sort($actualKeys); |
362 | - $this->assertSame($expected,$actualKeys); |
|
362 | + $this->assertSame($expected, $actualKeys); |
|
363 | 363 | |
364 | 364 | } |
365 | 365 | |
@@ -374,12 +374,12 @@ discard block |
||
374 | 374 | |
375 | 375 | $securityGroup = new SecurityGroup(); |
376 | 376 | |
377 | - $result = $securityGroup->getLinkName("Accounts","Contacts"); |
|
378 | - $this->assertEquals("contacts",$result); |
|
377 | + $result = $securityGroup->getLinkName("Accounts", "Contacts"); |
|
378 | + $this->assertEquals("contacts", $result); |
|
379 | 379 | |
380 | 380 | |
381 | - $result = $securityGroup->getLinkName("SecurityGroups","ACLRoles"); |
|
382 | - $this->assertEquals("aclroles",$result); |
|
381 | + $result = $securityGroup->getLinkName("SecurityGroups", "ACLRoles"); |
|
382 | + $this->assertEquals("aclroles", $result); |
|
383 | 383 | |
384 | 384 | error_reporting(E_ALL); |
385 | 385 | //error_reporting(E_ERROR | E_PARSE); |
@@ -116,8 +116,7 @@ discard block |
||
116 | 116 | try { |
117 | 117 | SecurityGroup::inherit($account,false); |
118 | 118 | $this->assertTrue(true); |
119 | - } |
|
120 | - catch (Exception $e) { |
|
119 | + } catch (Exception $e) { |
|
121 | 120 | $this->fail(); |
122 | 121 | } |
123 | 122 | |
@@ -138,8 +137,7 @@ discard block |
||
138 | 137 | try { |
139 | 138 | SecurityGroup::assign_default_groups($account,false); |
140 | 139 | $this->assertTrue(true); |
141 | - } |
|
142 | - catch (Exception $e) { |
|
140 | + } catch (Exception $e) { |
|
143 | 141 | $this->fail(); |
144 | 142 | } |
145 | 143 | |
@@ -159,8 +157,7 @@ discard block |
||
159 | 157 | try { |
160 | 158 | SecurityGroup::inherit_creator($account,false); |
161 | 159 | $this->assertTrue(true); |
162 | - } |
|
163 | - catch (Exception $e) { |
|
160 | + } catch (Exception $e) { |
|
164 | 161 | $this->fail(); |
165 | 162 | } |
166 | 163 | |
@@ -182,8 +179,7 @@ discard block |
||
182 | 179 | try { |
183 | 180 | SecurityGroup::inherit_assigned($account,false); |
184 | 181 | $this->assertTrue(true); |
185 | - } |
|
186 | - catch (Exception $e) { |
|
182 | + } catch (Exception $e) { |
|
187 | 183 | $this->fail(); |
188 | 184 | } |
189 | 185 | |
@@ -204,8 +200,7 @@ discard block |
||
204 | 200 | try { |
205 | 201 | SecurityGroup::inherit_parent($account,false); |
206 | 202 | $this->assertTrue(true); |
207 | - } |
|
208 | - catch (Exception $e) { |
|
203 | + } catch (Exception $e) { |
|
209 | 204 | $this->fail(); |
210 | 205 | } |
211 | 206 | |
@@ -226,8 +221,7 @@ discard block |
||
226 | 221 | try { |
227 | 222 | SecurityGroup::inherit_parentQuery($account, "Accounts", 1, 1 , $account->module_dir); |
228 | 223 | $this->assertTrue(true); |
229 | - } |
|
230 | - catch (Exception $e) { |
|
224 | + } catch (Exception $e) { |
|
231 | 225 | $this->fail(); |
232 | 226 | } |
233 | 227 | |
@@ -399,8 +393,7 @@ discard block |
||
399 | 393 | try { |
400 | 394 | $securityGroup->addGroupToRecord("Accounts", 1, 1); |
401 | 395 | $this->assertTrue(true); |
402 | - } |
|
403 | - catch (Exception $e) { |
|
396 | + } catch (Exception $e) { |
|
404 | 397 | $this->fail(); |
405 | 398 | } |
406 | 399 | |
@@ -420,8 +413,7 @@ discard block |
||
420 | 413 | try { |
421 | 414 | $securityGroup->removeGroupFromRecord("Accounts", 1, 1); |
422 | 415 | $this->assertTrue(true); |
423 | - } |
|
424 | - catch (Exception $e) { |
|
416 | + } catch (Exception $e) { |
|
425 | 417 | $this->fail(); |
426 | 418 | } |
427 | 419 |
@@ -3,117 +3,117 @@ |
||
3 | 3 | class ReleaseTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | 5 | |
6 | - public function testRelease() { |
|
6 | + public function testRelease() { |
|
7 | 7 | |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $release = new Release(); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $release = new Release(); |
|
10 | 10 | |
11 | - $this->assertInstanceOf('Release',$release); |
|
12 | - $this->assertInstanceOf('SugarBean',$release); |
|
11 | + $this->assertInstanceOf('Release',$release); |
|
12 | + $this->assertInstanceOf('SugarBean',$release); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('releases', 'table_name', $release); |
|
15 | - $this->assertAttributeEquals('Releases', 'module_dir', $release); |
|
16 | - $this->assertAttributeEquals('Release', 'object_name', $release); |
|
14 | + $this->assertAttributeEquals('releases', 'table_name', $release); |
|
15 | + $this->assertAttributeEquals('Releases', 'module_dir', $release); |
|
16 | + $this->assertAttributeEquals('Release', 'object_name', $release); |
|
17 | 17 | |
18 | - $this->assertAttributeEquals(true, 'new_schema', $release); |
|
18 | + $this->assertAttributeEquals(true, 'new_schema', $release); |
|
19 | 19 | |
20 | - } |
|
20 | + } |
|
21 | 21 | |
22 | - public function testget_summary_text() |
|
23 | - { |
|
24 | - error_reporting(E_ERROR | E_PARSE); |
|
22 | + public function testget_summary_text() |
|
23 | + { |
|
24 | + error_reporting(E_ERROR | E_PARSE); |
|
25 | 25 | |
26 | - $release = new Release(); |
|
26 | + $release = new Release(); |
|
27 | 27 | |
28 | - //test without setting name |
|
29 | - $this->assertEquals(Null,$release->get_summary_text()); |
|
28 | + //test without setting name |
|
29 | + $this->assertEquals(Null,$release->get_summary_text()); |
|
30 | 30 | |
31 | - //test with name set |
|
32 | - $release->name = "test"; |
|
33 | - $this->assertEquals('test',$release->get_summary_text()); |
|
34 | - } |
|
31 | + //test with name set |
|
32 | + $release->name = "test"; |
|
33 | + $this->assertEquals('test',$release->get_summary_text()); |
|
34 | + } |
|
35 | 35 | |
36 | - public function testget_releases() |
|
37 | - { |
|
38 | - $release = new Release(); |
|
36 | + public function testget_releases() |
|
37 | + { |
|
38 | + $release = new Release(); |
|
39 | 39 | |
40 | - //test with default params |
|
41 | - $result = $release->get_releases(); |
|
42 | - $this->assertTrue(is_array($result)); |
|
40 | + //test with default params |
|
41 | + $result = $release->get_releases(); |
|
42 | + $this->assertTrue(is_array($result)); |
|
43 | 43 | |
44 | - //test with custom params |
|
45 | - $result = $release->get_releases(true,'Hidden','name is not null'); |
|
46 | - $this->assertTrue(is_array($result)); |
|
44 | + //test with custom params |
|
45 | + $result = $release->get_releases(true,'Hidden','name is not null'); |
|
46 | + $this->assertTrue(is_array($result)); |
|
47 | 47 | |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | - public function testfill_in_additional_list_fields() |
|
51 | - { |
|
52 | - $release = new Release(); |
|
50 | + public function testfill_in_additional_list_fields() |
|
51 | + { |
|
52 | + $release = new Release(); |
|
53 | 53 | |
54 | - //execute the method and test if it works and does not throws an exception. |
|
55 | - try { |
|
56 | - $release->fill_in_additional_list_fields(); |
|
57 | - $this->assertTrue(true); |
|
58 | - } |
|
59 | - catch (Exception $e) { |
|
60 | - $this->fail(); |
|
61 | - } |
|
54 | + //execute the method and test if it works and does not throws an exception. |
|
55 | + try { |
|
56 | + $release->fill_in_additional_list_fields(); |
|
57 | + $this->assertTrue(true); |
|
58 | + } |
|
59 | + catch (Exception $e) { |
|
60 | + $this->fail(); |
|
61 | + } |
|
62 | 62 | |
63 | - } |
|
63 | + } |
|
64 | 64 | |
65 | - public function testfill_in_additional_detail_fields() { |
|
65 | + public function testfill_in_additional_detail_fields() { |
|
66 | 66 | |
67 | - $release = new Release(); |
|
67 | + $release = new Release(); |
|
68 | 68 | |
69 | - //execute the method and test if it works and does not throws an exception. |
|
70 | - try { |
|
71 | - $release->fill_in_additional_detail_fields(); |
|
72 | - $this->assertTrue(true); |
|
73 | - } |
|
74 | - catch (Exception $e) { |
|
75 | - $this->fail(); |
|
76 | - } |
|
69 | + //execute the method and test if it works and does not throws an exception. |
|
70 | + try { |
|
71 | + $release->fill_in_additional_detail_fields(); |
|
72 | + $this->assertTrue(true); |
|
73 | + } |
|
74 | + catch (Exception $e) { |
|
75 | + $this->fail(); |
|
76 | + } |
|
77 | 77 | |
78 | - } |
|
78 | + } |
|
79 | 79 | |
80 | - public function testget_list_view_data(){ |
|
80 | + public function testget_list_view_data(){ |
|
81 | 81 | |
82 | - $release = new Release(); |
|
82 | + $release = new Release(); |
|
83 | 83 | |
84 | - $release->name = "test"; |
|
85 | - $release->status = "Hidden"; |
|
84 | + $release->name = "test"; |
|
85 | + $release->status = "Hidden"; |
|
86 | 86 | |
87 | - $expected = array ( |
|
88 | - 'NAME' => 'test', |
|
89 | - 'STATUS' => 'Hidden', |
|
90 | - 'ENCODED_NAME' => 'test', |
|
91 | - 'ENCODED_STATUS' => null |
|
92 | - ); |
|
87 | + $expected = array ( |
|
88 | + 'NAME' => 'test', |
|
89 | + 'STATUS' => 'Hidden', |
|
90 | + 'ENCODED_NAME' => 'test', |
|
91 | + 'ENCODED_STATUS' => null |
|
92 | + ); |
|
93 | 93 | |
94 | - $actual = $release->get_list_view_data(); |
|
94 | + $actual = $release->get_list_view_data(); |
|
95 | 95 | |
96 | - $this->assertSame($expected, $actual); |
|
96 | + $this->assertSame($expected, $actual); |
|
97 | 97 | |
98 | - } |
|
98 | + } |
|
99 | 99 | |
100 | 100 | |
101 | - public function testbuild_generic_where_clause () { |
|
101 | + public function testbuild_generic_where_clause () { |
|
102 | 102 | |
103 | - $release = new Release(); |
|
103 | + $release = new Release(); |
|
104 | 104 | |
105 | - //test with empty string params |
|
106 | - $expected = "name like '%'"; |
|
107 | - $actual = $release->build_generic_where_clause(''); |
|
108 | - $this->assertSame($expected,$actual); |
|
105 | + //test with empty string params |
|
106 | + $expected = "name like '%'"; |
|
107 | + $actual = $release->build_generic_where_clause(''); |
|
108 | + $this->assertSame($expected,$actual); |
|
109 | 109 | |
110 | 110 | |
111 | - //test with valid string params |
|
112 | - $expected = "name like '%'"; |
|
113 | - $actual = $release->build_generic_where_clause('test'); |
|
114 | - $this->assertSame($expected,$actual); |
|
111 | + //test with valid string params |
|
112 | + $expected = "name like '%'"; |
|
113 | + $actual = $release->build_generic_where_clause('test'); |
|
114 | + $this->assertSame($expected,$actual); |
|
115 | 115 | |
116 | - } |
|
116 | + } |
|
117 | 117 | |
118 | 118 | |
119 | 119 | } |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | //execute the contructor and check for the Object type and attributes |
9 | 9 | $release = new Release(); |
10 | 10 | |
11 | - $this->assertInstanceOf('Release',$release); |
|
12 | - $this->assertInstanceOf('SugarBean',$release); |
|
11 | + $this->assertInstanceOf('Release', $release); |
|
12 | + $this->assertInstanceOf('SugarBean', $release); |
|
13 | 13 | |
14 | 14 | $this->assertAttributeEquals('releases', 'table_name', $release); |
15 | 15 | $this->assertAttributeEquals('Releases', 'module_dir', $release); |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | $release = new Release(); |
27 | 27 | |
28 | 28 | //test without setting name |
29 | - $this->assertEquals(Null,$release->get_summary_text()); |
|
29 | + $this->assertEquals(Null, $release->get_summary_text()); |
|
30 | 30 | |
31 | 31 | //test with name set |
32 | 32 | $release->name = "test"; |
33 | - $this->assertEquals('test',$release->get_summary_text()); |
|
33 | + $this->assertEquals('test', $release->get_summary_text()); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function testget_releases() |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $this->assertTrue(is_array($result)); |
43 | 43 | |
44 | 44 | //test with custom params |
45 | - $result = $release->get_releases(true,'Hidden','name is not null'); |
|
45 | + $result = $release->get_releases(true, 'Hidden', 'name is not null'); |
|
46 | 46 | $this->assertTrue(is_array($result)); |
47 | 47 | |
48 | 48 | } |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | - public function testget_list_view_data(){ |
|
80 | + public function testget_list_view_data() { |
|
81 | 81 | |
82 | 82 | $release = new Release(); |
83 | 83 | |
84 | 84 | $release->name = "test"; |
85 | 85 | $release->status = "Hidden"; |
86 | 86 | |
87 | - $expected = array ( |
|
87 | + $expected = array( |
|
88 | 88 | 'NAME' => 'test', |
89 | 89 | 'STATUS' => 'Hidden', |
90 | 90 | 'ENCODED_NAME' => 'test', |
@@ -98,20 +98,20 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | - public function testbuild_generic_where_clause () { |
|
101 | + public function testbuild_generic_where_clause() { |
|
102 | 102 | |
103 | 103 | $release = new Release(); |
104 | 104 | |
105 | 105 | //test with empty string params |
106 | 106 | $expected = "name like '%'"; |
107 | 107 | $actual = $release->build_generic_where_clause(''); |
108 | - $this->assertSame($expected,$actual); |
|
108 | + $this->assertSame($expected, $actual); |
|
109 | 109 | |
110 | 110 | |
111 | 111 | //test with valid string params |
112 | 112 | $expected = "name like '%'"; |
113 | 113 | $actual = $release->build_generic_where_clause('test'); |
114 | - $this->assertSame($expected,$actual); |
|
114 | + $this->assertSame($expected, $actual); |
|
115 | 115 | |
116 | 116 | } |
117 | 117 |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | try { |
56 | 56 | $release->fill_in_additional_list_fields(); |
57 | 57 | $this->assertTrue(true); |
58 | - } |
|
59 | - catch (Exception $e) { |
|
58 | + } catch (Exception $e) { |
|
60 | 59 | $this->fail(); |
61 | 60 | } |
62 | 61 | |
@@ -70,8 +69,7 @@ discard block |
||
70 | 69 | try { |
71 | 70 | $release->fill_in_additional_detail_fields(); |
72 | 71 | $this->assertTrue(true); |
73 | - } |
|
74 | - catch (Exception $e) { |
|
72 | + } catch (Exception $e) { |
|
75 | 73 | $this->fail(); |
76 | 74 | } |
77 | 75 |
@@ -4,179 +4,179 @@ discard block |
||
4 | 4 | class CallTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | 6 | |
7 | - public function testCall() |
|
8 | - { |
|
9 | - //execute the contructor and check for the Object type and attributes |
|
10 | - $call = new Call(); |
|
11 | - $this->assertInstanceOf('Call',$call); |
|
12 | - $this->assertInstanceOf('SugarBean',$call); |
|
7 | + public function testCall() |
|
8 | + { |
|
9 | + //execute the contructor and check for the Object type and attributes |
|
10 | + $call = new Call(); |
|
11 | + $this->assertInstanceOf('Call',$call); |
|
12 | + $this->assertInstanceOf('SugarBean',$call); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('Calls', 'module_dir', $call); |
|
15 | - $this->assertAttributeEquals('Call', 'object_name', $call); |
|
16 | - $this->assertAttributeEquals('calls', 'table_name', $call); |
|
17 | - $this->assertAttributeEquals('calls_users', 'rel_users_table', $call); |
|
18 | - $this->assertAttributeEquals('calls_contacts', 'rel_contacts_table', $call); |
|
19 | - $this->assertAttributeEquals('calls_leads', 'rel_leads_table', $call); |
|
20 | - $this->assertAttributeEquals(true, 'new_schema', $call); |
|
21 | - $this->assertAttributeEquals(true, 'importable', $call); |
|
22 | - $this->assertAttributeEquals(false, 'syncing', $call); |
|
23 | - $this->assertAttributeEquals(true, 'update_vcal', $call); |
|
24 | - $this->assertAttributeEquals(array (0 => '00', 15 => '15', 30 => '30', 45 => '45'), 'minutes_values', $call); |
|
25 | - |
|
26 | - } |
|
14 | + $this->assertAttributeEquals('Calls', 'module_dir', $call); |
|
15 | + $this->assertAttributeEquals('Call', 'object_name', $call); |
|
16 | + $this->assertAttributeEquals('calls', 'table_name', $call); |
|
17 | + $this->assertAttributeEquals('calls_users', 'rel_users_table', $call); |
|
18 | + $this->assertAttributeEquals('calls_contacts', 'rel_contacts_table', $call); |
|
19 | + $this->assertAttributeEquals('calls_leads', 'rel_leads_table', $call); |
|
20 | + $this->assertAttributeEquals(true, 'new_schema', $call); |
|
21 | + $this->assertAttributeEquals(true, 'importable', $call); |
|
22 | + $this->assertAttributeEquals(false, 'syncing', $call); |
|
23 | + $this->assertAttributeEquals(true, 'update_vcal', $call); |
|
24 | + $this->assertAttributeEquals(array (0 => '00', 15 => '15', 30 => '30', 45 => '45'), 'minutes_values', $call); |
|
25 | + |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | - public function testACLAccess() |
|
30 | - { |
|
31 | - error_reporting(E_ERROR | E_PARSE); |
|
29 | + public function testACLAccess() |
|
30 | + { |
|
31 | + error_reporting(E_ERROR | E_PARSE); |
|
32 | 32 | |
33 | - $call = new Call(); |
|
33 | + $call = new Call(); |
|
34 | 34 | |
35 | - //test without setting recurring_source attribute |
|
36 | - $this->assertTrue($call->ACLAccess('')); |
|
37 | - $this->assertTrue($call->ACLAccess('edit')); |
|
35 | + //test without setting recurring_source attribute |
|
36 | + $this->assertTrue($call->ACLAccess('')); |
|
37 | + $this->assertTrue($call->ACLAccess('edit')); |
|
38 | 38 | |
39 | - //test with recurring_source attribute set |
|
40 | - $call->recurring_source = "test"; |
|
41 | - $this->assertFalse($call->ACLAccess('edit')); |
|
39 | + //test with recurring_source attribute set |
|
40 | + $call->recurring_source = "test"; |
|
41 | + $this->assertFalse($call->ACLAccess('edit')); |
|
42 | 42 | |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - public function testSaveAndMarkDeleted() |
|
47 | - { |
|
48 | - $call = new Call(); |
|
46 | + public function testSaveAndMarkDeleted() |
|
47 | + { |
|
48 | + $call = new Call(); |
|
49 | 49 | |
50 | - $call->name = "test"; |
|
51 | - $call->id = $call->save(); |
|
50 | + $call->name = "test"; |
|
51 | + $call->id = $call->save(); |
|
52 | 52 | |
53 | - //test for record ID to verify that record is saved |
|
54 | - $this->assertTrue(isset($call->id)); |
|
55 | - $this->assertEquals(36, strlen($call->id)); |
|
53 | + //test for record ID to verify that record is saved |
|
54 | + $this->assertTrue(isset($call->id)); |
|
55 | + $this->assertEquals(36, strlen($call->id)); |
|
56 | 56 | |
57 | 57 | |
58 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
59 | - $call->mark_deleted($call->id); |
|
60 | - $result = $call->retrieve($call->id); |
|
61 | - $this->assertEquals(null,$result); |
|
58 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
59 | + $call->mark_deleted($call->id); |
|
60 | + $result = $call->retrieve($call->id); |
|
61 | + $this->assertEquals(null,$result); |
|
62 | 62 | |
63 | - } |
|
63 | + } |
|
64 | 64 | |
65 | 65 | |
66 | - public function testget_contacts() |
|
67 | - { |
|
68 | - $call = new Call(); |
|
69 | - $call->id = 1; |
|
66 | + public function testget_contacts() |
|
67 | + { |
|
68 | + $call = new Call(); |
|
69 | + $call->id = 1; |
|
70 | 70 | |
71 | - //execute the method and verify if it returns an array |
|
72 | - $result = $call->get_contacts(); |
|
73 | - $this->assertTrue(is_array($result)); |
|
71 | + //execute the method and verify if it returns an array |
|
72 | + $result = $call->get_contacts(); |
|
73 | + $this->assertTrue(is_array($result)); |
|
74 | 74 | |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - public function testget_summary_text() |
|
79 | - { |
|
80 | - $call = new Call(); |
|
78 | + public function testget_summary_text() |
|
79 | + { |
|
80 | + $call = new Call(); |
|
81 | 81 | |
82 | - //test without setting name |
|
83 | - $this->assertEquals(Null,$call->get_summary_text()); |
|
82 | + //test without setting name |
|
83 | + $this->assertEquals(Null,$call->get_summary_text()); |
|
84 | 84 | |
85 | - //test with name set |
|
86 | - $call->name = "test"; |
|
87 | - $this->assertEquals('test',$call->get_summary_text()); |
|
85 | + //test with name set |
|
86 | + $call->name = "test"; |
|
87 | + $this->assertEquals('test',$call->get_summary_text()); |
|
88 | 88 | |
89 | - } |
|
89 | + } |
|
90 | 90 | |
91 | - public function testcreate_list_query() |
|
92 | - { |
|
93 | - $call = new Call(); |
|
91 | + public function testcreate_list_query() |
|
92 | + { |
|
93 | + $call = new Call(); |
|
94 | 94 | |
95 | 95 | |
96 | - //test with empty string params |
|
97 | - $expected = "SELECT \n calls.*,\n users.user_name as assigned_user_name FROM calls \n LEFT JOIN users\n ON calls.assigned_user_id=users.id where calls.deleted=0 ORDER BY calls.name"; |
|
98 | - $actual = $call->create_list_query('',''); |
|
99 | - $this->assertSame($expected,$actual); |
|
96 | + //test with empty string params |
|
97 | + $expected = "SELECT \n calls.*,\n users.user_name as assigned_user_name FROM calls \n LEFT JOIN users\n ON calls.assigned_user_id=users.id where calls.deleted=0 ORDER BY calls.name"; |
|
98 | + $actual = $call->create_list_query('',''); |
|
99 | + $this->assertSame($expected,$actual); |
|
100 | 100 | |
101 | 101 | |
102 | - //test with valid string params |
|
103 | - $expected = "SELECT \n calls.*,\n users.user_name as assigned_user_name FROM calls \n LEFT JOIN users\n ON calls.assigned_user_id=users.id where users.user_name=\"\" AND calls.deleted=0 ORDER BY calls.name"; |
|
104 | - $actual = $call->create_list_query('name','users.user_name=""'); |
|
105 | - $this->assertSame($expected,$actual); |
|
102 | + //test with valid string params |
|
103 | + $expected = "SELECT \n calls.*,\n users.user_name as assigned_user_name FROM calls \n LEFT JOIN users\n ON calls.assigned_user_id=users.id where users.user_name=\"\" AND calls.deleted=0 ORDER BY calls.name"; |
|
104 | + $actual = $call->create_list_query('name','users.user_name=""'); |
|
105 | + $this->assertSame($expected,$actual); |
|
106 | 106 | |
107 | - } |
|
107 | + } |
|
108 | 108 | |
109 | - public function testcreate_export_query() |
|
110 | - { |
|
111 | - $call = new Call(); |
|
109 | + public function testcreate_export_query() |
|
110 | + { |
|
111 | + $call = new Call(); |
|
112 | 112 | |
113 | 113 | |
114 | - //test with empty string params |
|
115 | - $expected = "SELECT calls.*, users.user_name as assigned_user_name FROM calls LEFT JOIN users ON calls.assigned_user_id=users.id where calls.deleted=0 ORDER BY calls.name"; |
|
116 | - $actual = $call->create_export_query('',''); |
|
117 | - $this->assertSame($expected,$actual); |
|
118 | - //var_dump($actual); |
|
114 | + //test with empty string params |
|
115 | + $expected = "SELECT calls.*, users.user_name as assigned_user_name FROM calls LEFT JOIN users ON calls.assigned_user_id=users.id where calls.deleted=0 ORDER BY calls.name"; |
|
116 | + $actual = $call->create_export_query('',''); |
|
117 | + $this->assertSame($expected,$actual); |
|
118 | + //var_dump($actual); |
|
119 | 119 | |
120 | - //test with empty string params |
|
121 | - $expected = "SELECT calls.*, users.user_name as assigned_user_name FROM calls LEFT JOIN users ON calls.assigned_user_id=users.id where users.user_name=\"\" AND calls.deleted=0 ORDER BY calls.name"; |
|
122 | - $actual = $call->create_export_query('name','users.user_name=""'); |
|
123 | - $this->assertSame($expected,$actual); |
|
124 | - //var_dump($actual); |
|
120 | + //test with empty string params |
|
121 | + $expected = "SELECT calls.*, users.user_name as assigned_user_name FROM calls LEFT JOIN users ON calls.assigned_user_id=users.id where users.user_name=\"\" AND calls.deleted=0 ORDER BY calls.name"; |
|
122 | + $actual = $call->create_export_query('name','users.user_name=""'); |
|
123 | + $this->assertSame($expected,$actual); |
|
124 | + //var_dump($actual); |
|
125 | 125 | |
126 | 126 | |
127 | - } |
|
127 | + } |
|
128 | 128 | |
129 | - public function testfill_in_additional_detail_fields() |
|
130 | - { |
|
129 | + public function testfill_in_additional_detail_fields() |
|
130 | + { |
|
131 | 131 | |
132 | - $call = new Call(); |
|
132 | + $call = new Call(); |
|
133 | 133 | |
134 | - //execute the method and verify it sets up the intended fields |
|
135 | - $call->fill_in_additional_detail_fields(); |
|
134 | + //execute the method and verify it sets up the intended fields |
|
135 | + $call->fill_in_additional_detail_fields(); |
|
136 | 136 | |
137 | - $this->assertEquals("0", $call->duration_hours); |
|
138 | - $this->assertEquals("15", $call->duration_minutes); |
|
139 | - $this->assertEquals(-1, $call->reminder_time); |
|
140 | - $this->assertEquals(false, $call->reminder_checked); |
|
141 | - $this->assertEquals(-1, $call->email_reminder_time); |
|
142 | - $this->assertEquals(false, $call->email_reminder_checked); |
|
143 | - $this->assertEquals("Accounts", $call->parent_type); |
|
144 | - |
|
145 | - } |
|
137 | + $this->assertEquals("0", $call->duration_hours); |
|
138 | + $this->assertEquals("15", $call->duration_minutes); |
|
139 | + $this->assertEquals(-1, $call->reminder_time); |
|
140 | + $this->assertEquals(false, $call->reminder_checked); |
|
141 | + $this->assertEquals(-1, $call->email_reminder_time); |
|
142 | + $this->assertEquals(false, $call->email_reminder_checked); |
|
143 | + $this->assertEquals("Accounts", $call->parent_type); |
|
144 | + |
|
145 | + } |
|
146 | 146 | |
147 | 147 | |
148 | - public function testget_list_view_data(){ |
|
149 | - |
|
150 | - $call = new Call(); |
|
151 | - |
|
152 | - $call->assigned_user_id = 1; |
|
153 | - $call->created_by = 1; |
|
154 | - $call->modified_user_id = 1; |
|
155 | - |
|
156 | - //execute the method and verify that it retunrs expected results |
|
157 | - $expected = array ( |
|
158 | - 'MODIFIED_USER_ID' => 1, |
|
159 | - 'CREATED_BY' => 1, |
|
160 | - 'DELETED' => 0, |
|
161 | - 'ASSIGNED_USER_ID' => 1, |
|
162 | - 'STATUS' => 'Planned', |
|
163 | - 'REMINDER_TIME' => '-1', |
|
164 | - 'EMAIL_REMINDER_TIME' => '-1', |
|
165 | - 'EMAIL_REMINDER_SENT' => '0', |
|
166 | - 'REPEAT_INTERVAL' => '1', |
|
167 | - 'SET_COMPLETE' => '~' |
|
168 | - . preg_quote('<a id=\'\' onclick=\'SUGAR.util.closeActivityPanel.show("Calls","","Held","listview","1");\'><img src="themes/SuiteR/images/close_inline.png?v=') |
|
169 | - .'[\w-]+' |
|
170 | - .preg_quote('" border=\'0\' alt="Close" /></a>').'~', |
|
171 | - 'DATE_START' => '<font class=\'overdueTask\'></font>', |
|
172 | - 'CONTACT_ID' => NULL, |
|
173 | - 'CONTACT_NAME' => NULL, |
|
174 | - 'PARENT_NAME' => '', |
|
175 | - 'REMINDER_CHECKED' => false, |
|
176 | - 'EMAIL_REMINDER_CHECKED' => false, |
|
177 | - ); |
|
178 | - |
|
179 | - $actual = $call->get_list_view_data(); |
|
148 | + public function testget_list_view_data(){ |
|
149 | + |
|
150 | + $call = new Call(); |
|
151 | + |
|
152 | + $call->assigned_user_id = 1; |
|
153 | + $call->created_by = 1; |
|
154 | + $call->modified_user_id = 1; |
|
155 | + |
|
156 | + //execute the method and verify that it retunrs expected results |
|
157 | + $expected = array ( |
|
158 | + 'MODIFIED_USER_ID' => 1, |
|
159 | + 'CREATED_BY' => 1, |
|
160 | + 'DELETED' => 0, |
|
161 | + 'ASSIGNED_USER_ID' => 1, |
|
162 | + 'STATUS' => 'Planned', |
|
163 | + 'REMINDER_TIME' => '-1', |
|
164 | + 'EMAIL_REMINDER_TIME' => '-1', |
|
165 | + 'EMAIL_REMINDER_SENT' => '0', |
|
166 | + 'REPEAT_INTERVAL' => '1', |
|
167 | + 'SET_COMPLETE' => '~' |
|
168 | + . preg_quote('<a id=\'\' onclick=\'SUGAR.util.closeActivityPanel.show("Calls","","Held","listview","1");\'><img src="themes/SuiteR/images/close_inline.png?v=') |
|
169 | + .'[\w-]+' |
|
170 | + .preg_quote('" border=\'0\' alt="Close" /></a>').'~', |
|
171 | + 'DATE_START' => '<font class=\'overdueTask\'></font>', |
|
172 | + 'CONTACT_ID' => NULL, |
|
173 | + 'CONTACT_NAME' => NULL, |
|
174 | + 'PARENT_NAME' => '', |
|
175 | + 'REMINDER_CHECKED' => false, |
|
176 | + 'EMAIL_REMINDER_CHECKED' => false, |
|
177 | + ); |
|
178 | + |
|
179 | + $actual = $call->get_list_view_data(); |
|
180 | 180 | foreach($expected as $expectedKey => $expectedVal){ |
181 | 181 | if($expectedKey == 'SET_COMPLETE'){ |
182 | 182 | $this->assertRegExp($expected[$expectedKey],$actual[$expectedKey]); |
@@ -185,145 +185,145 @@ discard block |
||
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | - $this->assertEquals("Administrator", $call->assigned_user_name); |
|
189 | - $this->assertEquals("Administrator", $call->created_by_name); |
|
190 | - $this->assertEquals("Administrator", $call->modified_by_name); |
|
188 | + $this->assertEquals("Administrator", $call->assigned_user_name); |
|
189 | + $this->assertEquals("Administrator", $call->created_by_name); |
|
190 | + $this->assertEquals("Administrator", $call->modified_by_name); |
|
191 | 191 | |
192 | - } |
|
192 | + } |
|
193 | 193 | |
194 | 194 | |
195 | - public function testset_notification_body() |
|
196 | - { |
|
195 | + public function testset_notification_body() |
|
196 | + { |
|
197 | 197 | |
198 | - $call = new Call(); |
|
198 | + $call = new Call(); |
|
199 | 199 | |
200 | - //test with attributes preset and verify template variables are set accordingly |
|
200 | + //test with attributes preset and verify template variables are set accordingly |
|
201 | 201 | |
202 | - $call->name = "test"; |
|
203 | - $call->duration_hours = "1"; |
|
204 | - $call->duration_minutes = "10"; |
|
205 | - $call->status = "Planned"; |
|
206 | - $call->description = "some text"; |
|
207 | - $call->date_start = '2015-09-01 00:02:03'; |
|
208 | - $call->current_notify_user = new User(1); |
|
209 | - $call->current_notify_user->new_assigned_user_name = "Admin"; |
|
202 | + $call->name = "test"; |
|
203 | + $call->duration_hours = "1"; |
|
204 | + $call->duration_minutes = "10"; |
|
205 | + $call->status = "Planned"; |
|
206 | + $call->description = "some text"; |
|
207 | + $call->date_start = '2015-09-01 00:02:03'; |
|
208 | + $call->current_notify_user = new User(1); |
|
209 | + $call->current_notify_user->new_assigned_user_name = "Admin"; |
|
210 | 210 | |
211 | - $result = $call->set_notification_body(new Sugar_Smarty(), $call); |
|
211 | + $result = $call->set_notification_body(new Sugar_Smarty(), $call); |
|
212 | 212 | |
213 | - $this->assertEquals($call->name ,$result->_tpl_vars['CALL_SUBJECT']); |
|
214 | - $this->assertEquals($call->current_notify_user->new_assigned_user_name ,$result->_tpl_vars['CALL_TO']); |
|
215 | - $this->assertEquals($call->duration_hours ,$result->_tpl_vars['CALL_HOURS']); |
|
216 | - $this->assertEquals($call->duration_minutes ,$result->_tpl_vars['CALL_MINUTES']); |
|
217 | - $this->assertEquals($call->status ,$result->_tpl_vars['CALL_STATUS']); |
|
218 | - $this->assertEquals('09/01/2015 00:02 UTC(+00:00)' ,$result->_tpl_vars['CALL_STARTDATE']); |
|
219 | - $this->assertEquals($call->description ,$result->_tpl_vars['CALL_DESCRIPTION']); |
|
213 | + $this->assertEquals($call->name ,$result->_tpl_vars['CALL_SUBJECT']); |
|
214 | + $this->assertEquals($call->current_notify_user->new_assigned_user_name ,$result->_tpl_vars['CALL_TO']); |
|
215 | + $this->assertEquals($call->duration_hours ,$result->_tpl_vars['CALL_HOURS']); |
|
216 | + $this->assertEquals($call->duration_minutes ,$result->_tpl_vars['CALL_MINUTES']); |
|
217 | + $this->assertEquals($call->status ,$result->_tpl_vars['CALL_STATUS']); |
|
218 | + $this->assertEquals('09/01/2015 00:02 UTC(+00:00)' ,$result->_tpl_vars['CALL_STARTDATE']); |
|
219 | + $this->assertEquals($call->description ,$result->_tpl_vars['CALL_DESCRIPTION']); |
|
220 | 220 | |
221 | - } |
|
221 | + } |
|
222 | 222 | |
223 | 223 | |
224 | - public function testget_call_users() |
|
225 | - { |
|
224 | + public function testget_call_users() |
|
225 | + { |
|
226 | 226 | |
227 | - $call = new Call(); |
|
228 | - $call->id = 1; |
|
227 | + $call = new Call(); |
|
228 | + $call->id = 1; |
|
229 | 229 | |
230 | - //execute the method and verify it returns an array |
|
231 | - $result = $call->get_call_users(); |
|
232 | - $this->assertTrue(is_array($result)); |
|
230 | + //execute the method and verify it returns an array |
|
231 | + $result = $call->get_call_users(); |
|
232 | + $this->assertTrue(is_array($result)); |
|
233 | 233 | |
234 | - } |
|
234 | + } |
|
235 | 235 | |
236 | 236 | |
237 | - public function testget_invite_calls() |
|
238 | - { |
|
237 | + public function testget_invite_calls() |
|
238 | + { |
|
239 | 239 | |
240 | - $call = new Call(); |
|
241 | - $user = new User(1); |
|
240 | + $call = new Call(); |
|
241 | + $user = new User(1); |
|
242 | 242 | |
243 | - //execute the method and verify it returns an array |
|
244 | - $result = $call->get_invite_calls($user); |
|
245 | - $this->assertTrue(is_array($result)); |
|
243 | + //execute the method and verify it returns an array |
|
244 | + $result = $call->get_invite_calls($user); |
|
245 | + $this->assertTrue(is_array($result)); |
|
246 | 246 | |
247 | - } |
|
247 | + } |
|
248 | 248 | |
249 | 249 | |
250 | - public function testset_accept_status() |
|
251 | - { |
|
252 | - $call = new Call(); |
|
253 | - $call->id = 1; |
|
250 | + public function testset_accept_status() |
|
251 | + { |
|
252 | + $call = new Call(); |
|
253 | + $call->id = 1; |
|
254 | 254 | |
255 | 255 | |
256 | - //test for calls Users and delete the created linked records afterwards |
|
257 | - $user = new User(); |
|
258 | - $user->id = '1'; |
|
256 | + //test for calls Users and delete the created linked records afterwards |
|
257 | + $user = new User(); |
|
258 | + $user->id = '1'; |
|
259 | 259 | |
260 | - $call->set_accept_status($user,"test"); |
|
260 | + $call->set_accept_status($user,"test"); |
|
261 | 261 | |
262 | - $call_users = $call->get_linked_beans('users', $call->object_name); |
|
263 | - $this->assertEquals(1, count($call_users) ); |
|
262 | + $call_users = $call->get_linked_beans('users', $call->object_name); |
|
263 | + $this->assertEquals(1, count($call_users) ); |
|
264 | 264 | |
265 | 265 | |
266 | - $call->delete_linked($call->id); |
|
266 | + $call->delete_linked($call->id); |
|
267 | 267 | |
268 | - } |
|
268 | + } |
|
269 | 269 | |
270 | 270 | |
271 | - public function testget_notification_recipients() |
|
272 | - { |
|
271 | + public function testget_notification_recipients() |
|
272 | + { |
|
273 | 273 | |
274 | - $call = new Call(); |
|
274 | + $call = new Call(); |
|
275 | 275 | |
276 | - //test without setting any user list |
|
277 | - $result = $call->get_notification_recipients(); |
|
278 | - $this->assertTrue(is_array($result)); |
|
276 | + //test without setting any user list |
|
277 | + $result = $call->get_notification_recipients(); |
|
278 | + $this->assertTrue(is_array($result)); |
|
279 | 279 | |
280 | - //test with a user in notofication list set |
|
281 | - $call->users_arr = array(1); |
|
282 | - $result = $call->get_notification_recipients(); |
|
283 | - $this->assertTrue(is_array($result)); |
|
284 | - $this->assertEquals(1,count($result)); |
|
280 | + //test with a user in notofication list set |
|
281 | + $call->users_arr = array(1); |
|
282 | + $result = $call->get_notification_recipients(); |
|
283 | + $this->assertTrue(is_array($result)); |
|
284 | + $this->assertEquals(1,count($result)); |
|
285 | 285 | |
286 | - } |
|
286 | + } |
|
287 | 287 | |
288 | 288 | public function testbean_implements() |
289 | 289 | { |
290 | - $call = new Call(); |
|
291 | - $this->assertEquals(false, $call->bean_implements('')); //test with blank value |
|
292 | - $this->assertEquals(false, $call->bean_implements('test')); //test with invalid value |
|
293 | - $this->assertEquals(true, $call->bean_implements('ACL')); //test with valid value |
|
290 | + $call = new Call(); |
|
291 | + $this->assertEquals(false, $call->bean_implements('')); //test with blank value |
|
292 | + $this->assertEquals(false, $call->bean_implements('test')); //test with invalid value |
|
293 | + $this->assertEquals(true, $call->bean_implements('ACL')); //test with valid value |
|
294 | 294 | |
295 | - } |
|
295 | + } |
|
296 | 296 | |
297 | - public function testlistviewACLHelper() |
|
298 | - { |
|
297 | + public function testlistviewACLHelper() |
|
298 | + { |
|
299 | 299 | |
300 | - $call = new Call(); |
|
301 | - $expected = array( "MAIN"=>"a", "PARENT"=>"a", "CONTACT"=>"a"); |
|
302 | - $actual = $call->listviewACLHelper(); |
|
303 | - $this->assertSame($expected,$actual); |
|
300 | + $call = new Call(); |
|
301 | + $expected = array( "MAIN"=>"a", "PARENT"=>"a", "CONTACT"=>"a"); |
|
302 | + $actual = $call->listviewACLHelper(); |
|
303 | + $this->assertSame($expected,$actual); |
|
304 | 304 | |
305 | - } |
|
305 | + } |
|
306 | 306 | |
307 | - public function testsave_relationship_changes() |
|
308 | - { |
|
309 | - $call = new Call(); |
|
310 | - |
|
311 | - //execute the method and test if it works and does not throws an exception. |
|
312 | - try { |
|
313 | - $call->save_relationship_changes(true); |
|
314 | - $this->assertTrue(true); |
|
315 | - } |
|
316 | - catch (Exception $e) { |
|
317 | - $this->fail(); |
|
318 | - } |
|
319 | - |
|
320 | - } |
|
307 | + public function testsave_relationship_changes() |
|
308 | + { |
|
309 | + $call = new Call(); |
|
310 | + |
|
311 | + //execute the method and test if it works and does not throws an exception. |
|
312 | + try { |
|
313 | + $call->save_relationship_changes(true); |
|
314 | + $this->assertTrue(true); |
|
315 | + } |
|
316 | + catch (Exception $e) { |
|
317 | + $this->fail(); |
|
318 | + } |
|
319 | + |
|
320 | + } |
|
321 | 321 | |
322 | 322 | public function testgetDefaultStatus() |
323 | 323 | { |
324 | - $call = new Call(); |
|
325 | - $result = $call->getDefaultStatus(); |
|
326 | - $this->assertEquals("Planned",$result); |
|
324 | + $call = new Call(); |
|
325 | + $result = $call->getDefaultStatus(); |
|
326 | + $this->assertEquals("Planned",$result); |
|
327 | 327 | |
328 | 328 | } |
329 | 329 |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | { |
9 | 9 | //execute the contructor and check for the Object type and attributes |
10 | 10 | $call = new Call(); |
11 | - $this->assertInstanceOf('Call',$call); |
|
12 | - $this->assertInstanceOf('SugarBean',$call); |
|
11 | + $this->assertInstanceOf('Call', $call); |
|
12 | + $this->assertInstanceOf('SugarBean', $call); |
|
13 | 13 | |
14 | 14 | $this->assertAttributeEquals('Calls', 'module_dir', $call); |
15 | 15 | $this->assertAttributeEquals('Call', 'object_name', $call); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $this->assertAttributeEquals(true, 'importable', $call); |
22 | 22 | $this->assertAttributeEquals(false, 'syncing', $call); |
23 | 23 | $this->assertAttributeEquals(true, 'update_vcal', $call); |
24 | - $this->assertAttributeEquals(array (0 => '00', 15 => '15', 30 => '30', 45 => '45'), 'minutes_values', $call); |
|
24 | + $this->assertAttributeEquals(array(0 => '00', 15 => '15', 30 => '30', 45 => '45'), 'minutes_values', $call); |
|
25 | 25 | |
26 | 26 | } |
27 | 27 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | //mark the record as deleted and verify that this record cannot be retrieved anymore. |
59 | 59 | $call->mark_deleted($call->id); |
60 | 60 | $result = $call->retrieve($call->id); |
61 | - $this->assertEquals(null,$result); |
|
61 | + $this->assertEquals(null, $result); |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | $call = new Call(); |
81 | 81 | |
82 | 82 | //test without setting name |
83 | - $this->assertEquals(Null,$call->get_summary_text()); |
|
83 | + $this->assertEquals(Null, $call->get_summary_text()); |
|
84 | 84 | |
85 | 85 | //test with name set |
86 | 86 | $call->name = "test"; |
87 | - $this->assertEquals('test',$call->get_summary_text()); |
|
87 | + $this->assertEquals('test', $call->get_summary_text()); |
|
88 | 88 | |
89 | 89 | } |
90 | 90 | |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | |
96 | 96 | //test with empty string params |
97 | 97 | $expected = "SELECT \n calls.*,\n users.user_name as assigned_user_name FROM calls \n LEFT JOIN users\n ON calls.assigned_user_id=users.id where calls.deleted=0 ORDER BY calls.name"; |
98 | - $actual = $call->create_list_query('',''); |
|
99 | - $this->assertSame($expected,$actual); |
|
98 | + $actual = $call->create_list_query('', ''); |
|
99 | + $this->assertSame($expected, $actual); |
|
100 | 100 | |
101 | 101 | |
102 | 102 | //test with valid string params |
103 | 103 | $expected = "SELECT \n calls.*,\n users.user_name as assigned_user_name FROM calls \n LEFT JOIN users\n ON calls.assigned_user_id=users.id where users.user_name=\"\" AND calls.deleted=0 ORDER BY calls.name"; |
104 | - $actual = $call->create_list_query('name','users.user_name=""'); |
|
105 | - $this->assertSame($expected,$actual); |
|
104 | + $actual = $call->create_list_query('name', 'users.user_name=""'); |
|
105 | + $this->assertSame($expected, $actual); |
|
106 | 106 | |
107 | 107 | } |
108 | 108 | |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | |
114 | 114 | //test with empty string params |
115 | 115 | $expected = "SELECT calls.*, users.user_name as assigned_user_name FROM calls LEFT JOIN users ON calls.assigned_user_id=users.id where calls.deleted=0 ORDER BY calls.name"; |
116 | - $actual = $call->create_export_query('',''); |
|
117 | - $this->assertSame($expected,$actual); |
|
116 | + $actual = $call->create_export_query('', ''); |
|
117 | + $this->assertSame($expected, $actual); |
|
118 | 118 | //var_dump($actual); |
119 | 119 | |
120 | 120 | //test with empty string params |
121 | 121 | $expected = "SELECT calls.*, users.user_name as assigned_user_name FROM calls LEFT JOIN users ON calls.assigned_user_id=users.id where users.user_name=\"\" AND calls.deleted=0 ORDER BY calls.name"; |
122 | - $actual = $call->create_export_query('name','users.user_name=""'); |
|
123 | - $this->assertSame($expected,$actual); |
|
122 | + $actual = $call->create_export_query('name', 'users.user_name=""'); |
|
123 | + $this->assertSame($expected, $actual); |
|
124 | 124 | //var_dump($actual); |
125 | 125 | |
126 | 126 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | |
148 | - public function testget_list_view_data(){ |
|
148 | + public function testget_list_view_data() { |
|
149 | 149 | |
150 | 150 | $call = new Call(); |
151 | 151 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $call->modified_user_id = 1; |
155 | 155 | |
156 | 156 | //execute the method and verify that it retunrs expected results |
157 | - $expected = array ( |
|
157 | + $expected = array( |
|
158 | 158 | 'MODIFIED_USER_ID' => 1, |
159 | 159 | 'CREATED_BY' => 1, |
160 | 160 | 'DELETED' => 0, |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | ); |
178 | 178 | |
179 | 179 | $actual = $call->get_list_view_data(); |
180 | - foreach($expected as $expectedKey => $expectedVal){ |
|
181 | - if($expectedKey == 'SET_COMPLETE'){ |
|
182 | - $this->assertRegExp($expected[$expectedKey],$actual[$expectedKey]); |
|
183 | - }else { |
|
180 | + foreach ($expected as $expectedKey => $expectedVal) { |
|
181 | + if ($expectedKey == 'SET_COMPLETE') { |
|
182 | + $this->assertRegExp($expected[$expectedKey], $actual[$expectedKey]); |
|
183 | + } else { |
|
184 | 184 | $this->assertSame($expected[$expectedKey], $actual[$expectedKey]); |
185 | 185 | } |
186 | 186 | } |
@@ -210,13 +210,13 @@ discard block |
||
210 | 210 | |
211 | 211 | $result = $call->set_notification_body(new Sugar_Smarty(), $call); |
212 | 212 | |
213 | - $this->assertEquals($call->name ,$result->_tpl_vars['CALL_SUBJECT']); |
|
214 | - $this->assertEquals($call->current_notify_user->new_assigned_user_name ,$result->_tpl_vars['CALL_TO']); |
|
215 | - $this->assertEquals($call->duration_hours ,$result->_tpl_vars['CALL_HOURS']); |
|
216 | - $this->assertEquals($call->duration_minutes ,$result->_tpl_vars['CALL_MINUTES']); |
|
217 | - $this->assertEquals($call->status ,$result->_tpl_vars['CALL_STATUS']); |
|
218 | - $this->assertEquals('09/01/2015 00:02 UTC(+00:00)' ,$result->_tpl_vars['CALL_STARTDATE']); |
|
219 | - $this->assertEquals($call->description ,$result->_tpl_vars['CALL_DESCRIPTION']); |
|
213 | + $this->assertEquals($call->name, $result->_tpl_vars['CALL_SUBJECT']); |
|
214 | + $this->assertEquals($call->current_notify_user->new_assigned_user_name, $result->_tpl_vars['CALL_TO']); |
|
215 | + $this->assertEquals($call->duration_hours, $result->_tpl_vars['CALL_HOURS']); |
|
216 | + $this->assertEquals($call->duration_minutes, $result->_tpl_vars['CALL_MINUTES']); |
|
217 | + $this->assertEquals($call->status, $result->_tpl_vars['CALL_STATUS']); |
|
218 | + $this->assertEquals('09/01/2015 00:02 UTC(+00:00)', $result->_tpl_vars['CALL_STARTDATE']); |
|
219 | + $this->assertEquals($call->description, $result->_tpl_vars['CALL_DESCRIPTION']); |
|
220 | 220 | |
221 | 221 | } |
222 | 222 | |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | $user = new User(); |
258 | 258 | $user->id = '1'; |
259 | 259 | |
260 | - $call->set_accept_status($user,"test"); |
|
260 | + $call->set_accept_status($user, "test"); |
|
261 | 261 | |
262 | 262 | $call_users = $call->get_linked_beans('users', $call->object_name); |
263 | - $this->assertEquals(1, count($call_users) ); |
|
263 | + $this->assertEquals(1, count($call_users)); |
|
264 | 264 | |
265 | 265 | |
266 | 266 | $call->delete_linked($call->id); |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $call->users_arr = array(1); |
282 | 282 | $result = $call->get_notification_recipients(); |
283 | 283 | $this->assertTrue(is_array($result)); |
284 | - $this->assertEquals(1,count($result)); |
|
284 | + $this->assertEquals(1, count($result)); |
|
285 | 285 | |
286 | 286 | } |
287 | 287 | |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | { |
299 | 299 | |
300 | 300 | $call = new Call(); |
301 | - $expected = array( "MAIN"=>"a", "PARENT"=>"a", "CONTACT"=>"a"); |
|
301 | + $expected = array("MAIN"=>"a", "PARENT"=>"a", "CONTACT"=>"a"); |
|
302 | 302 | $actual = $call->listviewACLHelper(); |
303 | - $this->assertSame($expected,$actual); |
|
303 | + $this->assertSame($expected, $actual); |
|
304 | 304 | |
305 | 305 | } |
306 | 306 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | { |
324 | 324 | $call = new Call(); |
325 | 325 | $result = $call->getDefaultStatus(); |
326 | - $this->assertEquals("Planned",$result); |
|
326 | + $this->assertEquals("Planned", $result); |
|
327 | 327 | |
328 | 328 | } |
329 | 329 |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | foreach($expected as $expectedKey => $expectedVal){ |
181 | 181 | if($expectedKey == 'SET_COMPLETE'){ |
182 | 182 | $this->assertRegExp($expected[$expectedKey],$actual[$expectedKey]); |
183 | - }else { |
|
183 | + } else { |
|
184 | 184 | $this->assertSame($expected[$expectedKey], $actual[$expectedKey]); |
185 | 185 | } |
186 | 186 | } |
@@ -312,8 +312,7 @@ discard block |
||
312 | 312 | try { |
313 | 313 | $call->save_relationship_changes(true); |
314 | 314 | $this->assertTrue(true); |
315 | - } |
|
316 | - catch (Exception $e) { |
|
315 | + } catch (Exception $e) { |
|
317 | 316 | $this->fail(); |
318 | 317 | } |
319 | 318 |
@@ -2,49 +2,49 @@ |
||
2 | 2 | |
3 | 3 | class AOS_QuotesTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - function testAOS_Quotes(){ |
|
5 | + function testAOS_Quotes(){ |
|
6 | 6 | |
7 | - //execute the contructor and check for the Object type and attributes |
|
8 | - $aosQuotes = new AOS_Quotes(); |
|
9 | - $this->assertInstanceOf('AOS_Quotes',$aosQuotes); |
|
10 | - $this->assertInstanceOf('Basic',$aosQuotes); |
|
11 | - $this->assertInstanceOf('SugarBean',$aosQuotes); |
|
7 | + //execute the contructor and check for the Object type and attributes |
|
8 | + $aosQuotes = new AOS_Quotes(); |
|
9 | + $this->assertInstanceOf('AOS_Quotes',$aosQuotes); |
|
10 | + $this->assertInstanceOf('Basic',$aosQuotes); |
|
11 | + $this->assertInstanceOf('SugarBean',$aosQuotes); |
|
12 | 12 | |
13 | - $this->assertAttributeEquals('AOS_Quotes', 'module_dir', $aosQuotes); |
|
14 | - $this->assertAttributeEquals('AOS_Quotes', 'object_name', $aosQuotes); |
|
15 | - $this->assertAttributeEquals('aos_quotes', 'table_name', $aosQuotes); |
|
16 | - $this->assertAttributeEquals(true, 'new_schema', $aosQuotes); |
|
17 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aosQuotes); |
|
18 | - $this->assertAttributeEquals(true, 'importable', $aosQuotes); |
|
19 | - $this->assertAttributeEquals(true, 'lineItems', $aosQuotes); |
|
13 | + $this->assertAttributeEquals('AOS_Quotes', 'module_dir', $aosQuotes); |
|
14 | + $this->assertAttributeEquals('AOS_Quotes', 'object_name', $aosQuotes); |
|
15 | + $this->assertAttributeEquals('aos_quotes', 'table_name', $aosQuotes); |
|
16 | + $this->assertAttributeEquals(true, 'new_schema', $aosQuotes); |
|
17 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aosQuotes); |
|
18 | + $this->assertAttributeEquals(true, 'importable', $aosQuotes); |
|
19 | + $this->assertAttributeEquals(true, 'lineItems', $aosQuotes); |
|
20 | 20 | |
21 | - } |
|
21 | + } |
|
22 | 22 | |
23 | - function testSaveAndMark_deleted(){ |
|
23 | + function testSaveAndMark_deleted(){ |
|
24 | 24 | |
25 | - error_reporting(E_ERROR | E_PARSE); |
|
25 | + error_reporting(E_ERROR | E_PARSE); |
|
26 | 26 | |
27 | - $aosQuotes = new AOS_Quotes(); |
|
27 | + $aosQuotes = new AOS_Quotes(); |
|
28 | 28 | |
29 | - $aosQuotes->name = "test"; |
|
30 | - $aosQuotes->total_amt = 100; |
|
31 | - $aosQuotes->total_amt_usdollar= 100; |
|
29 | + $aosQuotes->name = "test"; |
|
30 | + $aosQuotes->total_amt = 100; |
|
31 | + $aosQuotes->total_amt_usdollar= 100; |
|
32 | 32 | |
33 | - $aosQuotes->save(); |
|
33 | + $aosQuotes->save(); |
|
34 | 34 | |
35 | 35 | |
36 | - //test for record ID to verify that record is saved |
|
37 | - $this->assertTrue(isset($aosQuotes->id)); |
|
38 | - $this->assertEquals(36, strlen($aosQuotes->id)); |
|
36 | + //test for record ID to verify that record is saved |
|
37 | + $this->assertTrue(isset($aosQuotes->id)); |
|
38 | + $this->assertEquals(36, strlen($aosQuotes->id)); |
|
39 | 39 | |
40 | 40 | |
41 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
42 | - $aosQuotes->mark_deleted($aosQuotes->id); |
|
43 | - $result = $aosQuotes->retrieve($aosQuotes->id); |
|
44 | - $this->assertEquals(null,$result); |
|
41 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
42 | + $aosQuotes->mark_deleted($aosQuotes->id); |
|
43 | + $result = $aosQuotes->retrieve($aosQuotes->id); |
|
44 | + $this->assertEquals(null,$result); |
|
45 | 45 | |
46 | 46 | |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | 50 | } |
@@ -2,13 +2,13 @@ discard block |
||
2 | 2 | |
3 | 3 | class AOS_QuotesTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - function testAOS_Quotes(){ |
|
5 | + function testAOS_Quotes() { |
|
6 | 6 | |
7 | 7 | //execute the contructor and check for the Object type and attributes |
8 | 8 | $aosQuotes = new AOS_Quotes(); |
9 | - $this->assertInstanceOf('AOS_Quotes',$aosQuotes); |
|
10 | - $this->assertInstanceOf('Basic',$aosQuotes); |
|
11 | - $this->assertInstanceOf('SugarBean',$aosQuotes); |
|
9 | + $this->assertInstanceOf('AOS_Quotes', $aosQuotes); |
|
10 | + $this->assertInstanceOf('Basic', $aosQuotes); |
|
11 | + $this->assertInstanceOf('SugarBean', $aosQuotes); |
|
12 | 12 | |
13 | 13 | $this->assertAttributeEquals('AOS_Quotes', 'module_dir', $aosQuotes); |
14 | 14 | $this->assertAttributeEquals('AOS_Quotes', 'object_name', $aosQuotes); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | } |
22 | 22 | |
23 | - function testSaveAndMark_deleted(){ |
|
23 | + function testSaveAndMark_deleted() { |
|
24 | 24 | |
25 | 25 | error_reporting(E_ERROR | E_PARSE); |
26 | 26 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | $aosQuotes->name = "test"; |
30 | 30 | $aosQuotes->total_amt = 100; |
31 | - $aosQuotes->total_amt_usdollar= 100; |
|
31 | + $aosQuotes->total_amt_usdollar = 100; |
|
32 | 32 | |
33 | 33 | $aosQuotes->save(); |
34 | 34 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | //mark the record as deleted and verify that this record cannot be retrieved anymore. |
42 | 42 | $aosQuotes->mark_deleted($aosQuotes->id); |
43 | 43 | $result = $aosQuotes->retrieve($aosQuotes->id); |
44 | - $this->assertEquals(null,$result); |
|
44 | + $this->assertEquals(null, $result); |
|
45 | 45 | |
46 | 46 | |
47 | 47 | } |
@@ -3,53 +3,53 @@ |
||
3 | 3 | |
4 | 4 | class AOR_FieldTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | - public function testAOR_Field(){ |
|
6 | + public function testAOR_Field(){ |
|
7 | 7 | |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $aor_Field = new AOR_Field(); |
|
10 | - $this->assertInstanceOf('AOR_Field',$aor_Field); |
|
11 | - $this->assertInstanceOf('Basic',$aor_Field); |
|
12 | - $this->assertInstanceOf('SugarBean',$aor_Field); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $aor_Field = new AOR_Field(); |
|
10 | + $this->assertInstanceOf('AOR_Field',$aor_Field); |
|
11 | + $this->assertInstanceOf('Basic',$aor_Field); |
|
12 | + $this->assertInstanceOf('SugarBean',$aor_Field); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('AOR_Fields', 'module_dir', $aor_Field); |
|
15 | - $this->assertAttributeEquals('AOR_Field', 'object_name', $aor_Field); |
|
16 | - $this->assertAttributeEquals('aor_fields', 'table_name', $aor_Field); |
|
17 | - $this->assertAttributeEquals(true, 'new_schema', $aor_Field); |
|
18 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aor_Field); |
|
19 | - $this->assertAttributeEquals(true, 'importable', $aor_Field); |
|
20 | - $this->assertAttributeEquals(false, 'tracker_visibility', $aor_Field); |
|
14 | + $this->assertAttributeEquals('AOR_Fields', 'module_dir', $aor_Field); |
|
15 | + $this->assertAttributeEquals('AOR_Field', 'object_name', $aor_Field); |
|
16 | + $this->assertAttributeEquals('aor_fields', 'table_name', $aor_Field); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $aor_Field); |
|
18 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aor_Field); |
|
19 | + $this->assertAttributeEquals(true, 'importable', $aor_Field); |
|
20 | + $this->assertAttributeEquals(false, 'tracker_visibility', $aor_Field); |
|
21 | 21 | |
22 | - } |
|
22 | + } |
|
23 | 23 | |
24 | 24 | public function testsave_lines(){ |
25 | 25 | |
26 | - error_reporting(E_ERROR | E_PARSE); |
|
26 | + error_reporting(E_ERROR | E_PARSE); |
|
27 | 27 | |
28 | - $aor_Field = new AOR_Field(); |
|
28 | + $aor_Field = new AOR_Field(); |
|
29 | 29 | |
30 | - //preset the required data |
|
31 | - $post_data = Array(); |
|
32 | - $post_data['field'][] = 'test field'; |
|
33 | - $post_data['name'][] = 'test'; |
|
34 | - $post_data['module_path'][] = 'test path'; |
|
35 | - $post_data['display'][] = '1'; |
|
36 | - $post_data['link'][] = '1'; |
|
37 | - $post_data['label'][] = 'test label'; |
|
38 | - $post_data['field_function'][] = 'test function'; |
|
39 | - $post_data['total'][] = 'total'; |
|
40 | - $post_data['group_by'][] = '1'; |
|
41 | - $post_data['group_order'][] = 'desc'; |
|
42 | - $post_data['group_display'][] = '1'; |
|
30 | + //preset the required data |
|
31 | + $post_data = Array(); |
|
32 | + $post_data['field'][] = 'test field'; |
|
33 | + $post_data['name'][] = 'test'; |
|
34 | + $post_data['module_path'][] = 'test path'; |
|
35 | + $post_data['display'][] = '1'; |
|
36 | + $post_data['link'][] = '1'; |
|
37 | + $post_data['label'][] = 'test label'; |
|
38 | + $post_data['field_function'][] = 'test function'; |
|
39 | + $post_data['total'][] = 'total'; |
|
40 | + $post_data['group_by'][] = '1'; |
|
41 | + $post_data['group_order'][] = 'desc'; |
|
42 | + $post_data['group_display'][] = '1'; |
|
43 | 43 | |
44 | 44 | |
45 | - //execute the method and test if it works and does not throws an exception. |
|
46 | - try { |
|
47 | - $aor_Field->save_lines($post_data, new AOR_Report()); |
|
48 | - $this->assertTrue(true); |
|
49 | - } |
|
50 | - catch (Exception $e) { |
|
51 | - $this->fail(); |
|
52 | - } |
|
45 | + //execute the method and test if it works and does not throws an exception. |
|
46 | + try { |
|
47 | + $aor_Field->save_lines($post_data, new AOR_Report()); |
|
48 | + $this->assertTrue(true); |
|
49 | + } |
|
50 | + catch (Exception $e) { |
|
51 | + $this->fail(); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | 55 | } |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | |
4 | 4 | class AOR_FieldTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | - public function testAOR_Field(){ |
|
6 | + public function testAOR_Field() { |
|
7 | 7 | |
8 | 8 | //execute the contructor and check for the Object type and attributes |
9 | 9 | $aor_Field = new AOR_Field(); |
10 | - $this->assertInstanceOf('AOR_Field',$aor_Field); |
|
11 | - $this->assertInstanceOf('Basic',$aor_Field); |
|
12 | - $this->assertInstanceOf('SugarBean',$aor_Field); |
|
10 | + $this->assertInstanceOf('AOR_Field', $aor_Field); |
|
11 | + $this->assertInstanceOf('Basic', $aor_Field); |
|
12 | + $this->assertInstanceOf('SugarBean', $aor_Field); |
|
13 | 13 | |
14 | 14 | $this->assertAttributeEquals('AOR_Fields', 'module_dir', $aor_Field); |
15 | 15 | $this->assertAttributeEquals('AOR_Field', 'object_name', $aor_Field); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | } |
23 | 23 | |
24 | - public function testsave_lines(){ |
|
24 | + public function testsave_lines() { |
|
25 | 25 | |
26 | 26 | error_reporting(E_ERROR | E_PARSE); |
27 | 27 |
@@ -46,8 +46,7 @@ |
||
46 | 46 | try { |
47 | 47 | $aor_Field->save_lines($post_data, new AOR_Report()); |
48 | 48 | $this->assertTrue(true); |
49 | - } |
|
50 | - catch (Exception $e) { |
|
49 | + } catch (Exception $e) { |
|
51 | 50 | $this->fail(); |
52 | 51 | } |
53 | 52 |
@@ -5,98 +5,98 @@ |
||
5 | 5 | { |
6 | 6 | |
7 | 7 | |
8 | - public function testEmailMarketing() |
|
9 | - { |
|
8 | + public function testEmailMarketing() |
|
9 | + { |
|
10 | 10 | |
11 | - //execute the contructor and check for the Object type and attributes |
|
12 | - $emailMarketing = new EmailMarketing(); |
|
11 | + //execute the contructor and check for the Object type and attributes |
|
12 | + $emailMarketing = new EmailMarketing(); |
|
13 | 13 | |
14 | - $this->assertInstanceOf('EmailMarketing',$emailMarketing); |
|
15 | - $this->assertInstanceOf('SugarBean',$emailMarketing); |
|
14 | + $this->assertInstanceOf('EmailMarketing',$emailMarketing); |
|
15 | + $this->assertInstanceOf('SugarBean',$emailMarketing); |
|
16 | 16 | |
17 | - $this->assertAttributeEquals('EmailMarketing', 'module_dir', $emailMarketing); |
|
18 | - $this->assertAttributeEquals('EmailMarketing', 'object_name', $emailMarketing); |
|
19 | - $this->assertAttributeEquals('email_marketing', 'table_name', $emailMarketing); |
|
17 | + $this->assertAttributeEquals('EmailMarketing', 'module_dir', $emailMarketing); |
|
18 | + $this->assertAttributeEquals('EmailMarketing', 'object_name', $emailMarketing); |
|
19 | + $this->assertAttributeEquals('email_marketing', 'table_name', $emailMarketing); |
|
20 | 20 | |
21 | - $this->assertAttributeEquals(true, 'new_schema', $emailMarketing); |
|
21 | + $this->assertAttributeEquals(true, 'new_schema', $emailMarketing); |
|
22 | 22 | |
23 | - } |
|
23 | + } |
|
24 | 24 | |
25 | - public function testretrieve() |
|
26 | - { |
|
27 | - error_reporting(E_ERROR | E_PARSE); |
|
25 | + public function testretrieve() |
|
26 | + { |
|
27 | + error_reporting(E_ERROR | E_PARSE); |
|
28 | 28 | |
29 | - $emailMarketing = new EmailMarketing(); |
|
29 | + $emailMarketing = new EmailMarketing(); |
|
30 | 30 | |
31 | - $result = $emailMarketing->retrieve(); |
|
32 | - $this->assertInstanceOf('EmailMarketing',$result); |
|
31 | + $result = $emailMarketing->retrieve(); |
|
32 | + $this->assertInstanceOf('EmailMarketing',$result); |
|
33 | 33 | |
34 | - } |
|
34 | + } |
|
35 | 35 | |
36 | - public function testget_summary_text() |
|
37 | - { |
|
38 | - $emailMarketing = new EmailMarketing(); |
|
36 | + public function testget_summary_text() |
|
37 | + { |
|
38 | + $emailMarketing = new EmailMarketing(); |
|
39 | 39 | |
40 | - //test without setting name |
|
41 | - $this->assertEquals(Null,$emailMarketing->get_summary_text()); |
|
40 | + //test without setting name |
|
41 | + $this->assertEquals(Null,$emailMarketing->get_summary_text()); |
|
42 | 42 | |
43 | - //test with name set |
|
44 | - $emailMarketing->name = "test"; |
|
45 | - $this->assertEquals('test',$emailMarketing->get_summary_text()); |
|
43 | + //test with name set |
|
44 | + $emailMarketing->name = "test"; |
|
45 | + $this->assertEquals('test',$emailMarketing->get_summary_text()); |
|
46 | 46 | |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | - public function testcreate_export_query() |
|
50 | - { |
|
51 | - $emailMarketing = new EmailMarketing(); |
|
49 | + public function testcreate_export_query() |
|
50 | + { |
|
51 | + $emailMarketing = new EmailMarketing(); |
|
52 | 52 | |
53 | - //test with empty string params |
|
54 | - $expected = " SELECT email_marketing.* , jt0.name template_name , jt0.assigned_user_id template_name_owner , 'EmailTemplates' template_name_mod FROM email_marketing LEFT JOIN email_templates jt0 ON email_marketing.template_id=jt0.id AND jt0.deleted=0\n\n AND jt0.deleted=0 where email_marketing.deleted=0"; |
|
55 | - $actual = $emailMarketing->create_export_query('',''); |
|
56 | - $this->assertSame($expected,$actual); |
|
53 | + //test with empty string params |
|
54 | + $expected = " SELECT email_marketing.* , jt0.name template_name , jt0.assigned_user_id template_name_owner , 'EmailTemplates' template_name_mod FROM email_marketing LEFT JOIN email_templates jt0 ON email_marketing.template_id=jt0.id AND jt0.deleted=0\n\n AND jt0.deleted=0 where email_marketing.deleted=0"; |
|
55 | + $actual = $emailMarketing->create_export_query('',''); |
|
56 | + $this->assertSame($expected,$actual); |
|
57 | 57 | |
58 | 58 | |
59 | - //test with valid string params |
|
60 | - $expected = " SELECT email_marketing.* , jt0.name template_name , jt0.assigned_user_id template_name_owner , 'EmailTemplates' template_name_mod FROM email_marketing LEFT JOIN email_templates jt0 ON email_marketing.template_id=jt0.id AND jt0.deleted=0\n\n AND jt0.deleted=0 where (email_marketing.name=\"\") AND email_marketing.deleted=0"; |
|
61 | - $actual = $emailMarketing->create_export_query('email_marketing.id','email_marketing.name=""'); |
|
62 | - $this->assertSame($expected,$actual); |
|
59 | + //test with valid string params |
|
60 | + $expected = " SELECT email_marketing.* , jt0.name template_name , jt0.assigned_user_id template_name_owner , 'EmailTemplates' template_name_mod FROM email_marketing LEFT JOIN email_templates jt0 ON email_marketing.template_id=jt0.id AND jt0.deleted=0\n\n AND jt0.deleted=0 where (email_marketing.name=\"\") AND email_marketing.deleted=0"; |
|
61 | + $actual = $emailMarketing->create_export_query('email_marketing.id','email_marketing.name=""'); |
|
62 | + $this->assertSame($expected,$actual); |
|
63 | 63 | |
64 | - } |
|
64 | + } |
|
65 | 65 | |
66 | - public function testget_list_view_data() |
|
67 | - { |
|
66 | + public function testget_list_view_data() |
|
67 | + { |
|
68 | 68 | |
69 | - $emailMarketing = new EmailMarketing(); |
|
69 | + $emailMarketing = new EmailMarketing(); |
|
70 | 70 | |
71 | - //execute the method and verify that it retunrs expected results |
|
72 | - $expected = array ( |
|
73 | - 'ALL_PROSPECT_LISTS' => '0', |
|
74 | - ); |
|
71 | + //execute the method and verify that it retunrs expected results |
|
72 | + $expected = array ( |
|
73 | + 'ALL_PROSPECT_LISTS' => '0', |
|
74 | + ); |
|
75 | 75 | |
76 | - $actual = $emailMarketing->get_list_view_data(); |
|
77 | - $this->assertSame($expected, $actual); |
|
76 | + $actual = $emailMarketing->get_list_view_data(); |
|
77 | + $this->assertSame($expected, $actual); |
|
78 | 78 | |
79 | - } |
|
79 | + } |
|
80 | 80 | |
81 | - public function testbean_implements() |
|
82 | - { |
|
83 | - $emailMarketing = new EmailMarketing(); |
|
84 | - $this->assertEquals(false, $emailMarketing->bean_implements('')); //test with blank value |
|
85 | - $this->assertEquals(false, $emailMarketing->bean_implements('test')); //test with invalid value |
|
86 | - $this->assertEquals(true, $emailMarketing->bean_implements('ACL')); //test with valid value |
|
81 | + public function testbean_implements() |
|
82 | + { |
|
83 | + $emailMarketing = new EmailMarketing(); |
|
84 | + $this->assertEquals(false, $emailMarketing->bean_implements('')); //test with blank value |
|
85 | + $this->assertEquals(false, $emailMarketing->bean_implements('test')); //test with invalid value |
|
86 | + $this->assertEquals(true, $emailMarketing->bean_implements('ACL')); //test with valid value |
|
87 | 87 | |
88 | - } |
|
88 | + } |
|
89 | 89 | |
90 | - public function testget_all_prospect_lists() |
|
91 | - { |
|
92 | - $emailMarketing = new EmailMarketing(); |
|
90 | + public function testget_all_prospect_lists() |
|
91 | + { |
|
92 | + $emailMarketing = new EmailMarketing(); |
|
93 | 93 | |
94 | - //execute the method and verify that it retunrs expected results |
|
95 | - $expected = "select prospect_lists.* from prospect_lists left join prospect_list_campaigns on prospect_list_campaigns.prospect_list_id=prospect_lists.id where prospect_list_campaigns.deleted=0 and prospect_list_campaigns.campaign_id='' and prospect_lists.deleted=0 and prospect_lists.list_type not like 'exempt%'"; |
|
96 | - $actual = $emailMarketing->get_all_prospect_lists(); |
|
97 | - $this->assertSame($expected,$actual); |
|
94 | + //execute the method and verify that it retunrs expected results |
|
95 | + $expected = "select prospect_lists.* from prospect_lists left join prospect_list_campaigns on prospect_list_campaigns.prospect_list_id=prospect_lists.id where prospect_list_campaigns.deleted=0 and prospect_list_campaigns.campaign_id='' and prospect_lists.deleted=0 and prospect_lists.list_type not like 'exempt%'"; |
|
96 | + $actual = $emailMarketing->get_all_prospect_lists(); |
|
97 | + $this->assertSame($expected,$actual); |
|
98 | 98 | |
99 | - } |
|
99 | + } |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | ?> |
103 | 103 | \ No newline at end of file |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | //execute the contructor and check for the Object type and attributes |
12 | 12 | $emailMarketing = new EmailMarketing(); |
13 | 13 | |
14 | - $this->assertInstanceOf('EmailMarketing',$emailMarketing); |
|
15 | - $this->assertInstanceOf('SugarBean',$emailMarketing); |
|
14 | + $this->assertInstanceOf('EmailMarketing', $emailMarketing); |
|
15 | + $this->assertInstanceOf('SugarBean', $emailMarketing); |
|
16 | 16 | |
17 | 17 | $this->assertAttributeEquals('EmailMarketing', 'module_dir', $emailMarketing); |
18 | 18 | $this->assertAttributeEquals('EmailMarketing', 'object_name', $emailMarketing); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $emailMarketing = new EmailMarketing(); |
30 | 30 | |
31 | 31 | $result = $emailMarketing->retrieve(); |
32 | - $this->assertInstanceOf('EmailMarketing',$result); |
|
32 | + $this->assertInstanceOf('EmailMarketing', $result); |
|
33 | 33 | |
34 | 34 | } |
35 | 35 | |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | $emailMarketing = new EmailMarketing(); |
39 | 39 | |
40 | 40 | //test without setting name |
41 | - $this->assertEquals(Null,$emailMarketing->get_summary_text()); |
|
41 | + $this->assertEquals(Null, $emailMarketing->get_summary_text()); |
|
42 | 42 | |
43 | 43 | //test with name set |
44 | 44 | $emailMarketing->name = "test"; |
45 | - $this->assertEquals('test',$emailMarketing->get_summary_text()); |
|
45 | + $this->assertEquals('test', $emailMarketing->get_summary_text()); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | |
53 | 53 | //test with empty string params |
54 | 54 | $expected = " SELECT email_marketing.* , jt0.name template_name , jt0.assigned_user_id template_name_owner , 'EmailTemplates' template_name_mod FROM email_marketing LEFT JOIN email_templates jt0 ON email_marketing.template_id=jt0.id AND jt0.deleted=0\n\n AND jt0.deleted=0 where email_marketing.deleted=0"; |
55 | - $actual = $emailMarketing->create_export_query('',''); |
|
56 | - $this->assertSame($expected,$actual); |
|
55 | + $actual = $emailMarketing->create_export_query('', ''); |
|
56 | + $this->assertSame($expected, $actual); |
|
57 | 57 | |
58 | 58 | |
59 | 59 | //test with valid string params |
60 | 60 | $expected = " SELECT email_marketing.* , jt0.name template_name , jt0.assigned_user_id template_name_owner , 'EmailTemplates' template_name_mod FROM email_marketing LEFT JOIN email_templates jt0 ON email_marketing.template_id=jt0.id AND jt0.deleted=0\n\n AND jt0.deleted=0 where (email_marketing.name=\"\") AND email_marketing.deleted=0"; |
61 | - $actual = $emailMarketing->create_export_query('email_marketing.id','email_marketing.name=""'); |
|
62 | - $this->assertSame($expected,$actual); |
|
61 | + $actual = $emailMarketing->create_export_query('email_marketing.id', 'email_marketing.name=""'); |
|
62 | + $this->assertSame($expected, $actual); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $emailMarketing = new EmailMarketing(); |
70 | 70 | |
71 | 71 | //execute the method and verify that it retunrs expected results |
72 | - $expected = array ( |
|
72 | + $expected = array( |
|
73 | 73 | 'ALL_PROSPECT_LISTS' => '0', |
74 | 74 | ); |
75 | 75 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | //execute the method and verify that it retunrs expected results |
95 | 95 | $expected = "select prospect_lists.* from prospect_lists left join prospect_list_campaigns on prospect_list_campaigns.prospect_list_id=prospect_lists.id where prospect_list_campaigns.deleted=0 and prospect_list_campaigns.campaign_id='' and prospect_lists.deleted=0 and prospect_lists.list_type not like 'exempt%'"; |
96 | 96 | $actual = $emailMarketing->get_all_prospect_lists(); |
97 | - $this->assertSame($expected,$actual); |
|
97 | + $this->assertSame($expected, $actual); |
|
98 | 98 | |
99 | 99 | } |
100 | 100 |
@@ -4,344 +4,344 @@ |
||
4 | 4 | { |
5 | 5 | |
6 | 6 | |
7 | - public function testSchedulersJob() |
|
8 | - { |
|
9 | - //execute the contructor and check for the Object type and attributes |
|
10 | - $schedulersJob = new SchedulersJob(); |
|
11 | - |
|
12 | - $this->assertInstanceOf('SchedulersJob',$schedulersJob); |
|
13 | - $this->assertInstanceOf('Basic',$schedulersJob); |
|
14 | - $this->assertInstanceOf('SugarBean',$schedulersJob); |
|
7 | + public function testSchedulersJob() |
|
8 | + { |
|
9 | + //execute the contructor and check for the Object type and attributes |
|
10 | + $schedulersJob = new SchedulersJob(); |
|
11 | + |
|
12 | + $this->assertInstanceOf('SchedulersJob',$schedulersJob); |
|
13 | + $this->assertInstanceOf('Basic',$schedulersJob); |
|
14 | + $this->assertInstanceOf('SugarBean',$schedulersJob); |
|
15 | 15 | |
16 | - $this->assertAttributeEquals('job_queue', 'table_name', $schedulersJob); |
|
17 | - $this->assertAttributeEquals('SchedulersJobs', 'module_dir', $schedulersJob); |
|
18 | - $this->assertAttributeEquals('SchedulersJob', 'object_name', $schedulersJob); |
|
16 | + $this->assertAttributeEquals('job_queue', 'table_name', $schedulersJob); |
|
17 | + $this->assertAttributeEquals('SchedulersJobs', 'module_dir', $schedulersJob); |
|
18 | + $this->assertAttributeEquals('SchedulersJob', 'object_name', $schedulersJob); |
|
19 | 19 | |
20 | 20 | |
21 | - $this->assertAttributeEquals(true, 'new_schema', $schedulersJob); |
|
22 | - $this->assertAttributeEquals(true, 'process_save_dates', $schedulersJob); |
|
23 | - $this->assertAttributeEquals(30, 'min_interval', $schedulersJob); |
|
24 | - $this->assertAttributeEquals(true, 'job_done', $schedulersJob); |
|
21 | + $this->assertAttributeEquals(true, 'new_schema', $schedulersJob); |
|
22 | + $this->assertAttributeEquals(true, 'process_save_dates', $schedulersJob); |
|
23 | + $this->assertAttributeEquals(30, 'min_interval', $schedulersJob); |
|
24 | + $this->assertAttributeEquals(true, 'job_done', $schedulersJob); |
|
25 | 25 | |
26 | - } |
|
26 | + } |
|
27 | 27 | |
28 | - public function testcheck_date_relationships_load() |
|
29 | - { |
|
30 | - error_reporting(E_ERROR | E_PARSE); |
|
28 | + public function testcheck_date_relationships_load() |
|
29 | + { |
|
30 | + error_reporting(E_ERROR | E_PARSE); |
|
31 | 31 | |
32 | - $schedulersJob = new SchedulersJob(); |
|
33 | - $schedulersJob->execute_time = "2015-01-01 00:00:00"; |
|
32 | + $schedulersJob = new SchedulersJob(); |
|
33 | + $schedulersJob->execute_time = "2015-01-01 00:00:00"; |
|
34 | 34 | |
35 | - $schedulersJob->check_date_relationships_load(); |
|
35 | + $schedulersJob->check_date_relationships_load(); |
|
36 | 36 | |
37 | - $this->assertEquals("2015-01-01 00:00:00",$schedulersJob->execute_time_db); |
|
37 | + $this->assertEquals("2015-01-01 00:00:00",$schedulersJob->execute_time_db); |
|
38 | 38 | |
39 | - } |
|
39 | + } |
|
40 | 40 | |
41 | - public function testhandleDateFormat() { |
|
41 | + public function testhandleDateFormat() { |
|
42 | 42 | |
43 | - $schedulersJob = new SchedulersJob(); |
|
43 | + $schedulersJob = new SchedulersJob(); |
|
44 | 44 | |
45 | - //test with default params |
|
46 | - $result = $schedulersJob->handleDateFormat(); |
|
47 | - $this->assertGreaterThan(0,strlen($result)); |
|
45 | + //test with default params |
|
46 | + $result = $schedulersJob->handleDateFormat(); |
|
47 | + $this->assertGreaterThan(0,strlen($result)); |
|
48 | 48 | |
49 | - //test with a valid date param |
|
50 | - $result = $schedulersJob->handleDateFormat('2015-01-01'); |
|
51 | - $this->assertEquals("2015-01-01 00:00:00",$result); |
|
49 | + //test with a valid date param |
|
50 | + $result = $schedulersJob->handleDateFormat('2015-01-01'); |
|
51 | + $this->assertEquals("2015-01-01 00:00:00",$result); |
|
52 | 52 | |
53 | - } |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - public function testfireUrl() |
|
57 | - { |
|
58 | - $schedulersJob = new SchedulersJob(); |
|
56 | + public function testfireUrl() |
|
57 | + { |
|
58 | + $schedulersJob = new SchedulersJob(); |
|
59 | 59 | |
60 | - //test with invalid param |
|
61 | - $result = $schedulersJob->fireUrl(""); |
|
62 | - $this->assertEquals(false,$result); |
|
60 | + //test with invalid param |
|
61 | + $result = $schedulersJob->fireUrl(""); |
|
62 | + $this->assertEquals(false,$result); |
|
63 | 63 | |
64 | - //test with valid param |
|
65 | - $result = $schedulersJob->fireUrl("https://suitecrm.com/"); |
|
66 | - $this->assertEquals(true,$result); |
|
64 | + //test with valid param |
|
65 | + $result = $schedulersJob->fireUrl("https://suitecrm.com/"); |
|
66 | + $this->assertEquals(true,$result); |
|
67 | 67 | |
68 | - } |
|
68 | + } |
|
69 | 69 | |
70 | - public function testget_list_view_data() |
|
71 | - { |
|
70 | + public function testget_list_view_data() |
|
71 | + { |
|
72 | 72 | |
73 | - $schedulersJob = new SchedulersJob(); |
|
73 | + $schedulersJob = new SchedulersJob(); |
|
74 | 74 | |
75 | - $schedulersJob->job_name = "test"; |
|
76 | - $schedulersJob->job = "function::test"; |
|
75 | + $schedulersJob->job_name = "test"; |
|
76 | + $schedulersJob->job = "function::test"; |
|
77 | 77 | |
78 | - $expected = array( |
|
79 | - 'DELETED' => '0', |
|
80 | - 'REQUEUE' => '0', |
|
81 | - 'JOB_DELAY' => 0, |
|
82 | - 'JOB_NAME' => 'test', |
|
83 | - 'JOB' => 'function::test' |
|
84 | - ); |
|
85 | - $actual = $schedulersJob->get_list_view_data(); |
|
78 | + $expected = array( |
|
79 | + 'DELETED' => '0', |
|
80 | + 'REQUEUE' => '0', |
|
81 | + 'JOB_DELAY' => 0, |
|
82 | + 'JOB_NAME' => 'test', |
|
83 | + 'JOB' => 'function::test' |
|
84 | + ); |
|
85 | + $actual = $schedulersJob->get_list_view_data(); |
|
86 | 86 | |
87 | - $this->assertSame($expected,$actual); |
|
87 | + $this->assertSame($expected,$actual); |
|
88 | 88 | |
89 | - } |
|
89 | + } |
|
90 | 90 | |
91 | 91 | |
92 | - public function testfill_in_additional_list_fields() |
|
93 | - { |
|
94 | - $schedulersJob = new SchedulersJob(); |
|
92 | + public function testfill_in_additional_list_fields() |
|
93 | + { |
|
94 | + $schedulersJob = new SchedulersJob(); |
|
95 | 95 | |
96 | - //execute the method and test if it works and does not throws an exception. |
|
97 | - try { |
|
98 | - $schedulersJob->fill_in_additional_list_fields(); |
|
99 | - $this->assertTrue(true); |
|
100 | - } |
|
101 | - catch (Exception $e) { |
|
102 | - $this->fail(); |
|
103 | - } |
|
96 | + //execute the method and test if it works and does not throws an exception. |
|
97 | + try { |
|
98 | + $schedulersJob->fill_in_additional_list_fields(); |
|
99 | + $this->assertTrue(true); |
|
100 | + } |
|
101 | + catch (Exception $e) { |
|
102 | + $this->fail(); |
|
103 | + } |
|
104 | 104 | |
105 | - } |
|
105 | + } |
|
106 | 106 | |
107 | - public function testfailJob() |
|
108 | - { |
|
107 | + public function testfailJob() |
|
108 | + { |
|
109 | 109 | |
110 | - $schedulersJob = new SchedulersJob(); |
|
110 | + $schedulersJob = new SchedulersJob(); |
|
111 | 111 | |
112 | - $result = $schedulersJob->failJob(); |
|
113 | - $this->assertEquals(true, $result); |
|
112 | + $result = $schedulersJob->failJob(); |
|
113 | + $this->assertEquals(true, $result); |
|
114 | 114 | |
115 | - //test for record ID to verify that record is saved |
|
116 | - $this->assertTrue(isset($schedulersJob->id)); |
|
117 | - $this->assertEquals(36, strlen($schedulersJob->id)); |
|
115 | + //test for record ID to verify that record is saved |
|
116 | + $this->assertTrue(isset($schedulersJob->id)); |
|
117 | + $this->assertEquals(36, strlen($schedulersJob->id)); |
|
118 | 118 | |
119 | - $this->assertEquals(SchedulersJob::JOB_STATUS_DONE,$schedulersJob->status); |
|
120 | - $this->assertEquals(SchedulersJob::JOB_FAILURE,$schedulersJob->resolution); |
|
119 | + $this->assertEquals(SchedulersJob::JOB_STATUS_DONE,$schedulersJob->status); |
|
120 | + $this->assertEquals(SchedulersJob::JOB_FAILURE,$schedulersJob->resolution); |
|
121 | 121 | |
122 | - $schedulersJob->mark_deleted($schedulersJob->id); |
|
122 | + $schedulersJob->mark_deleted($schedulersJob->id); |
|
123 | 123 | |
124 | - } |
|
124 | + } |
|
125 | 125 | |
126 | 126 | |
127 | - public function testsucceedJob() |
|
128 | - { |
|
129 | - $schedulersJob = new SchedulersJob(); |
|
127 | + public function testsucceedJob() |
|
128 | + { |
|
129 | + $schedulersJob = new SchedulersJob(); |
|
130 | 130 | |
131 | - $result = $schedulersJob->succeedJob(); |
|
132 | - $this->assertEquals(true, $result); |
|
131 | + $result = $schedulersJob->succeedJob(); |
|
132 | + $this->assertEquals(true, $result); |
|
133 | 133 | |
134 | - //test for record ID to verify that record is saved |
|
135 | - $this->assertTrue(isset($schedulersJob->id)); |
|
136 | - $this->assertEquals(36, strlen($schedulersJob->id)); |
|
134 | + //test for record ID to verify that record is saved |
|
135 | + $this->assertTrue(isset($schedulersJob->id)); |
|
136 | + $this->assertEquals(36, strlen($schedulersJob->id)); |
|
137 | 137 | |
138 | - $this->assertEquals(SchedulersJob::JOB_STATUS_DONE,$schedulersJob->status); |
|
139 | - $this->assertEquals(SchedulersJob::JOB_SUCCESS,$schedulersJob->resolution); |
|
138 | + $this->assertEquals(SchedulersJob::JOB_STATUS_DONE,$schedulersJob->status); |
|
139 | + $this->assertEquals(SchedulersJob::JOB_SUCCESS,$schedulersJob->resolution); |
|
140 | 140 | |
141 | - $schedulersJob->mark_deleted($schedulersJob->id); |
|
141 | + $schedulersJob->mark_deleted($schedulersJob->id); |
|
142 | 142 | |
143 | - } |
|
143 | + } |
|
144 | 144 | |
145 | 145 | |
146 | - public function testonFailureRetry() |
|
147 | - { |
|
148 | - $schedulersJob = new SchedulersJob(); |
|
146 | + public function testonFailureRetry() |
|
147 | + { |
|
148 | + $schedulersJob = new SchedulersJob(); |
|
149 | 149 | |
150 | - //execute the method and test if it works and does not throws an exception. |
|
151 | - try { |
|
152 | - $schedulersJob->onFailureRetry(); |
|
153 | - $this->assertTrue(true); |
|
154 | - } |
|
155 | - catch (Exception $e) { |
|
156 | - $this->fail(); |
|
157 | - } |
|
150 | + //execute the method and test if it works and does not throws an exception. |
|
151 | + try { |
|
152 | + $schedulersJob->onFailureRetry(); |
|
153 | + $this->assertTrue(true); |
|
154 | + } |
|
155 | + catch (Exception $e) { |
|
156 | + $this->fail(); |
|
157 | + } |
|
158 | 158 | |
159 | - $this->markTestIncomplete('method has no implementation: logic hooks not defined'); |
|
160 | - } |
|
159 | + $this->markTestIncomplete('method has no implementation: logic hooks not defined'); |
|
160 | + } |
|
161 | 161 | |
162 | 162 | |
163 | - public function testonFinalFailure() |
|
164 | - { |
|
165 | - $schedulersJob = new SchedulersJob(); |
|
163 | + public function testonFinalFailure() |
|
164 | + { |
|
165 | + $schedulersJob = new SchedulersJob(); |
|
166 | 166 | |
167 | - //execute the method and test if it works and does not throws an exception. |
|
168 | - try { |
|
169 | - $schedulersJob->onFinalFailure(); |
|
170 | - $this->assertTrue(true); |
|
171 | - } |
|
172 | - catch (Exception $e) { |
|
173 | - $this->fail(); |
|
174 | - } |
|
167 | + //execute the method and test if it works and does not throws an exception. |
|
168 | + try { |
|
169 | + $schedulersJob->onFinalFailure(); |
|
170 | + $this->assertTrue(true); |
|
171 | + } |
|
172 | + catch (Exception $e) { |
|
173 | + $this->fail(); |
|
174 | + } |
|
175 | 175 | |
176 | - $this->markTestIncomplete('method has no implementation: logic hooks not defined'); |
|
177 | - } |
|
176 | + $this->markTestIncomplete('method has no implementation: logic hooks not defined'); |
|
177 | + } |
|
178 | 178 | |
179 | 179 | |
180 | - public function testresolveJob() |
|
181 | - { |
|
180 | + public function testresolveJob() |
|
181 | + { |
|
182 | 182 | |
183 | - $schedulersJob = new SchedulersJob(); |
|
183 | + $schedulersJob = new SchedulersJob(); |
|
184 | 184 | |
185 | - //test for JOB_FAILURE |
|
186 | - $result = $schedulersJob->resolveJob(SchedulersJob::JOB_FAILURE, "test"); |
|
187 | - $this->assertEquals(true, $result); |
|
185 | + //test for JOB_FAILURE |
|
186 | + $result = $schedulersJob->resolveJob(SchedulersJob::JOB_FAILURE, "test"); |
|
187 | + $this->assertEquals(true, $result); |
|
188 | 188 | |
189 | - //test for record ID to verify that record is saved |
|
190 | - $this->assertTrue(isset($schedulersJob->id)); |
|
191 | - $this->assertEquals(36, strlen($schedulersJob->id)); |
|
189 | + //test for record ID to verify that record is saved |
|
190 | + $this->assertTrue(isset($schedulersJob->id)); |
|
191 | + $this->assertEquals(36, strlen($schedulersJob->id)); |
|
192 | 192 | |
193 | - $this->assertEquals(SchedulersJob::JOB_STATUS_DONE, $schedulersJob->status); |
|
194 | - $this->assertEquals(SchedulersJob::JOB_FAILURE, $schedulersJob->resolution); |
|
193 | + $this->assertEquals(SchedulersJob::JOB_STATUS_DONE, $schedulersJob->status); |
|
194 | + $this->assertEquals(SchedulersJob::JOB_FAILURE, $schedulersJob->resolution); |
|
195 | 195 | |
196 | 196 | |
197 | - //tst for JOB_SUCCESS |
|
198 | - $result = $schedulersJob->resolveJob(SchedulersJob::JOB_SUCCESS, "test"); |
|
199 | - $this->assertEquals(true, $result); |
|
197 | + //tst for JOB_SUCCESS |
|
198 | + $result = $schedulersJob->resolveJob(SchedulersJob::JOB_SUCCESS, "test"); |
|
199 | + $this->assertEquals(true, $result); |
|
200 | 200 | |
201 | - $this->assertEquals(SchedulersJob::JOB_STATUS_DONE, $schedulersJob->status); |
|
202 | - $this->assertEquals(SchedulersJob::JOB_SUCCESS, $schedulersJob->resolution); |
|
201 | + $this->assertEquals(SchedulersJob::JOB_STATUS_DONE, $schedulersJob->status); |
|
202 | + $this->assertEquals(SchedulersJob::JOB_SUCCESS, $schedulersJob->resolution); |
|
203 | 203 | |
204 | 204 | |
205 | - $schedulersJob->mark_deleted($schedulersJob->id); |
|
205 | + $schedulersJob->mark_deleted($schedulersJob->id); |
|
206 | 206 | |
207 | - } |
|
207 | + } |
|
208 | 208 | |
209 | 209 | |
210 | - public function testpostponeJobAndMark_deleted() |
|
211 | - { |
|
212 | - $schedulersJob = new SchedulersJob(); |
|
210 | + public function testpostponeJobAndMark_deleted() |
|
211 | + { |
|
212 | + $schedulersJob = new SchedulersJob(); |
|
213 | 213 | |
214 | - $result = $schedulersJob->postponeJob("test message", 1); |
|
215 | - $this->assertEquals(true, $result); |
|
214 | + $result = $schedulersJob->postponeJob("test message", 1); |
|
215 | + $this->assertEquals(true, $result); |
|
216 | 216 | |
217 | - //test for record ID to verify that record is saved |
|
218 | - $this->assertTrue(isset($schedulersJob->id)); |
|
219 | - $this->assertEquals(36, strlen($schedulersJob->id)); |
|
217 | + //test for record ID to verify that record is saved |
|
218 | + $this->assertTrue(isset($schedulersJob->id)); |
|
219 | + $this->assertEquals(36, strlen($schedulersJob->id)); |
|
220 | 220 | |
221 | - //verify the related attributes |
|
222 | - $this->assertEquals(SchedulersJob::JOB_STATUS_QUEUED,$schedulersJob->status); |
|
223 | - $this->assertEquals(SchedulersJob::JOB_PARTIAL,$schedulersJob->resolution); |
|
221 | + //verify the related attributes |
|
222 | + $this->assertEquals(SchedulersJob::JOB_STATUS_QUEUED,$schedulersJob->status); |
|
223 | + $this->assertEquals(SchedulersJob::JOB_PARTIAL,$schedulersJob->resolution); |
|
224 | 224 | |
225 | 225 | |
226 | 226 | |
227 | - //test mark deleted method and verify record doesn't exist after deletion |
|
228 | - $schedulersJob->mark_deleted($schedulersJob->id); |
|
229 | - $result = $schedulersJob->retrieve($schedulersJob->id); |
|
230 | - $this->assertEquals(null,$result); |
|
227 | + //test mark deleted method and verify record doesn't exist after deletion |
|
228 | + $schedulersJob->mark_deleted($schedulersJob->id); |
|
229 | + $result = $schedulersJob->retrieve($schedulersJob->id); |
|
230 | + $this->assertEquals(null,$result); |
|
231 | 231 | |
232 | - } |
|
232 | + } |
|
233 | 233 | |
234 | - public function testunexpectedExit() |
|
235 | - { |
|
236 | - $schedulersJob = new SchedulersJob(); |
|
234 | + public function testunexpectedExit() |
|
235 | + { |
|
236 | + $schedulersJob = new SchedulersJob(); |
|
237 | 237 | |
238 | - //create conditions to mark job_done as false |
|
239 | - $schedulersJob->client = "test"; |
|
240 | - $schedulersJob->status = SchedulersJob::JOB_STATUS_RUNNING; |
|
241 | - $schedulersJob->save(); |
|
242 | - $result = SchedulersJob::runJobId($schedulersJob->id,"test"); |
|
238 | + //create conditions to mark job_done as false |
|
239 | + $schedulersJob->client = "test"; |
|
240 | + $schedulersJob->status = SchedulersJob::JOB_STATUS_RUNNING; |
|
241 | + $schedulersJob->save(); |
|
242 | + $result = SchedulersJob::runJobId($schedulersJob->id,"test"); |
|
243 | 243 | |
244 | 244 | |
245 | - //execute the method |
|
246 | - $schedulersJob->unexpectedExit(); |
|
247 | - $schedulersJob->retrieve($schedulersJob->id); |
|
248 | - $this->assertEquals(SchedulersJob::JOB_STATUS_DONE, $schedulersJob->status); |
|
249 | - $this->assertEquals(SchedulersJob::JOB_FAILURE, $schedulersJob->resolution); |
|
245 | + //execute the method |
|
246 | + $schedulersJob->unexpectedExit(); |
|
247 | + $schedulersJob->retrieve($schedulersJob->id); |
|
248 | + $this->assertEquals(SchedulersJob::JOB_STATUS_DONE, $schedulersJob->status); |
|
249 | + $this->assertEquals(SchedulersJob::JOB_FAILURE, $schedulersJob->resolution); |
|
250 | 250 | |
251 | - $schedulersJob->mark_deleted($schedulersJob->id); |
|
251 | + $schedulersJob->mark_deleted($schedulersJob->id); |
|
252 | 252 | |
253 | - } |
|
253 | + } |
|
254 | 254 | |
255 | 255 | |
256 | - public function testrunJobId() |
|
257 | - { |
|
256 | + public function testrunJobId() |
|
257 | + { |
|
258 | 258 | |
259 | - //test with invalid job id |
|
260 | - $result = SchedulersJob::runJobId("1"); |
|
261 | - $this->assertEquals("Job 1 not found.", $result); |
|
259 | + //test with invalid job id |
|
260 | + $result = SchedulersJob::runJobId("1"); |
|
261 | + $this->assertEquals("Job 1 not found.", $result); |
|
262 | 262 | |
263 | 263 | |
264 | - //test with valid job id |
|
265 | - $schedulersJob = new SchedulersJob(); |
|
266 | - $schedulersJob->status = SchedulersJob::JOB_STATUS_DONE; |
|
267 | - $schedulersJob->save(); |
|
264 | + //test with valid job id |
|
265 | + $schedulersJob = new SchedulersJob(); |
|
266 | + $schedulersJob->status = SchedulersJob::JOB_STATUS_DONE; |
|
267 | + $schedulersJob->save(); |
|
268 | 268 | |
269 | - $result = SchedulersJob::runJobId($schedulersJob->id); |
|
270 | - $this->assertEquals("Job " . $schedulersJob->id . " is not marked as running.", $result); |
|
269 | + $result = SchedulersJob::runJobId($schedulersJob->id); |
|
270 | + $this->assertEquals("Job " . $schedulersJob->id . " is not marked as running.", $result); |
|
271 | 271 | |
272 | 272 | |
273 | - //test with valid job id and status but mismatch client |
|
274 | - $schedulersJob->client = "client"; |
|
275 | - $schedulersJob->status = SchedulersJob::JOB_STATUS_RUNNING; |
|
276 | - $schedulersJob->save(); |
|
273 | + //test with valid job id and status but mismatch client |
|
274 | + $schedulersJob->client = "client"; |
|
275 | + $schedulersJob->status = SchedulersJob::JOB_STATUS_RUNNING; |
|
276 | + $schedulersJob->save(); |
|
277 | 277 | |
278 | - $result = SchedulersJob::runJobId($schedulersJob->id,"test_client"); |
|
278 | + $result = SchedulersJob::runJobId($schedulersJob->id,"test_client"); |
|
279 | 279 | |
280 | - $this->assertEquals("Job " . $schedulersJob->id . " belongs to another client, can not run as test_client.", $result); |
|
280 | + $this->assertEquals("Job " . $schedulersJob->id . " belongs to another client, can not run as test_client.", $result); |
|
281 | 281 | |
282 | - $schedulersJob->mark_deleted($schedulersJob->id); |
|
282 | + $schedulersJob->mark_deleted($schedulersJob->id); |
|
283 | 283 | |
284 | - } |
|
284 | + } |
|
285 | 285 | |
286 | 286 | |
287 | - public function testerrorHandler() |
|
288 | - { |
|
289 | - $schedulersJob = new SchedulersJob(); |
|
287 | + public function testerrorHandler() |
|
288 | + { |
|
289 | + $schedulersJob = new SchedulersJob(); |
|
290 | 290 | |
291 | - //execute the method with different Error Types |
|
291 | + //execute the method with different Error Types |
|
292 | 292 | |
293 | - $schedulersJob->errors = ""; |
|
294 | - $schedulersJob->errorHandler(E_USER_WARNING, "test err", 'testfile', '1'); |
|
295 | - $this->assertEquals("Warning [512]: test err in testfile on line 1\n", $schedulersJob->errors ); |
|
293 | + $schedulersJob->errors = ""; |
|
294 | + $schedulersJob->errorHandler(E_USER_WARNING, "test err", 'testfile', '1'); |
|
295 | + $this->assertEquals("Warning [512]: test err in testfile on line 1\n", $schedulersJob->errors ); |
|
296 | 296 | |
297 | - $schedulersJob->errors = ""; |
|
298 | - $schedulersJob->errorHandler(E_ERROR, "test err", 'testfile', '1'); |
|
299 | - $this->assertEquals("Fatal Error [1]: test err in testfile on line 1\n", $schedulersJob->errors ); |
|
297 | + $schedulersJob->errors = ""; |
|
298 | + $schedulersJob->errorHandler(E_ERROR, "test err", 'testfile', '1'); |
|
299 | + $this->assertEquals("Fatal Error [1]: test err in testfile on line 1\n", $schedulersJob->errors ); |
|
300 | 300 | |
301 | 301 | |
302 | - $schedulersJob->errors = ""; |
|
303 | - $schedulersJob->errorHandler(E_PARSE, "test err", 'testfile', '1'); |
|
304 | - $this->assertEquals("Parse Error [4]: test err in testfile on line 1\n", $schedulersJob->errors ); |
|
302 | + $schedulersJob->errors = ""; |
|
303 | + $schedulersJob->errorHandler(E_PARSE, "test err", 'testfile', '1'); |
|
304 | + $this->assertEquals("Parse Error [4]: test err in testfile on line 1\n", $schedulersJob->errors ); |
|
305 | 305 | |
306 | 306 | |
307 | - $schedulersJob->errors = ""; |
|
308 | - $schedulersJob->errorHandler(E_RECOVERABLE_ERROR, "test err", 'testfile', '1'); |
|
309 | - $this->assertEquals("Recoverable Error [4096]: test err in testfile on line 1\n", $schedulersJob->errors ); |
|
307 | + $schedulersJob->errors = ""; |
|
308 | + $schedulersJob->errorHandler(E_RECOVERABLE_ERROR, "test err", 'testfile', '1'); |
|
309 | + $this->assertEquals("Recoverable Error [4096]: test err in testfile on line 1\n", $schedulersJob->errors ); |
|
310 | 310 | |
311 | - } |
|
311 | + } |
|
312 | 312 | |
313 | 313 | |
314 | - public function testrunJob() |
|
315 | - { |
|
314 | + public function testrunJob() |
|
315 | + { |
|
316 | 316 | |
317 | - //test without a valid user |
|
318 | - $schedulersJob = new SchedulersJob(); |
|
319 | - $schedulersJob->target = "function::processAOW_Workflow"; |
|
320 | - $result = $schedulersJob->runJob(); |
|
321 | - $this->assertEquals(false, $result); |
|
322 | - $schedulersJob->mark_deleted($schedulersJob->id); |
|
317 | + //test without a valid user |
|
318 | + $schedulersJob = new SchedulersJob(); |
|
319 | + $schedulersJob->target = "function::processAOW_Workflow"; |
|
320 | + $result = $schedulersJob->runJob(); |
|
321 | + $this->assertEquals(false, $result); |
|
322 | + $schedulersJob->mark_deleted($schedulersJob->id); |
|
323 | 323 | |
324 | 324 | |
325 | - //test with valid user |
|
326 | - $schedulersJob = new SchedulersJob(); |
|
327 | - $schedulersJob->assigned_user_id = 1; |
|
325 | + //test with valid user |
|
326 | + $schedulersJob = new SchedulersJob(); |
|
327 | + $schedulersJob->assigned_user_id = 1; |
|
328 | 328 | |
329 | - $schedulersJob->target = "function::processAOW_Workflow"; |
|
330 | - $result = $schedulersJob->runJob(); |
|
331 | - $this->assertEquals(true, $result); |
|
332 | - $schedulersJob->mark_deleted($schedulersJob->id); |
|
329 | + $schedulersJob->target = "function::processAOW_Workflow"; |
|
330 | + $result = $schedulersJob->runJob(); |
|
331 | + $this->assertEquals(true, $result); |
|
332 | + $schedulersJob->mark_deleted($schedulersJob->id); |
|
333 | 333 | |
334 | 334 | |
335 | - //test with valid user |
|
336 | - $schedulersJob = new SchedulersJob(); |
|
337 | - $schedulersJob->assigned_user_id = 1; |
|
335 | + //test with valid user |
|
336 | + $schedulersJob = new SchedulersJob(); |
|
337 | + $schedulersJob->assigned_user_id = 1; |
|
338 | 338 | |
339 | - $schedulersJob->target = "url::https://suitecrm.com/"; |
|
340 | - $result = $schedulersJob->runJob(); |
|
341 | - $this->assertEquals(true, $result); |
|
342 | - $schedulersJob->mark_deleted($schedulersJob->id); |
|
339 | + $schedulersJob->target = "url::https://suitecrm.com/"; |
|
340 | + $result = $schedulersJob->runJob(); |
|
341 | + $this->assertEquals(true, $result); |
|
342 | + $schedulersJob->mark_deleted($schedulersJob->id); |
|
343 | 343 | |
344 | - } |
|
344 | + } |
|
345 | 345 | |
346 | 346 | } |
347 | 347 |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | //execute the contructor and check for the Object type and attributes |
10 | 10 | $schedulersJob = new SchedulersJob(); |
11 | 11 | |
12 | - $this->assertInstanceOf('SchedulersJob',$schedulersJob); |
|
13 | - $this->assertInstanceOf('Basic',$schedulersJob); |
|
14 | - $this->assertInstanceOf('SugarBean',$schedulersJob); |
|
12 | + $this->assertInstanceOf('SchedulersJob', $schedulersJob); |
|
13 | + $this->assertInstanceOf('Basic', $schedulersJob); |
|
14 | + $this->assertInstanceOf('SugarBean', $schedulersJob); |
|
15 | 15 | |
16 | 16 | $this->assertAttributeEquals('job_queue', 'table_name', $schedulersJob); |
17 | 17 | $this->assertAttributeEquals('SchedulersJobs', 'module_dir', $schedulersJob); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $schedulersJob->check_date_relationships_load(); |
36 | 36 | |
37 | - $this->assertEquals("2015-01-01 00:00:00",$schedulersJob->execute_time_db); |
|
37 | + $this->assertEquals("2015-01-01 00:00:00", $schedulersJob->execute_time_db); |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | |
45 | 45 | //test with default params |
46 | 46 | $result = $schedulersJob->handleDateFormat(); |
47 | - $this->assertGreaterThan(0,strlen($result)); |
|
47 | + $this->assertGreaterThan(0, strlen($result)); |
|
48 | 48 | |
49 | 49 | //test with a valid date param |
50 | 50 | $result = $schedulersJob->handleDateFormat('2015-01-01'); |
51 | - $this->assertEquals("2015-01-01 00:00:00",$result); |
|
51 | + $this->assertEquals("2015-01-01 00:00:00", $result); |
|
52 | 52 | |
53 | 53 | } |
54 | 54 | |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | |
60 | 60 | //test with invalid param |
61 | 61 | $result = $schedulersJob->fireUrl(""); |
62 | - $this->assertEquals(false,$result); |
|
62 | + $this->assertEquals(false, $result); |
|
63 | 63 | |
64 | 64 | //test with valid param |
65 | 65 | $result = $schedulersJob->fireUrl("https://suitecrm.com/"); |
66 | - $this->assertEquals(true,$result); |
|
66 | + $this->assertEquals(true, $result); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ); |
85 | 85 | $actual = $schedulersJob->get_list_view_data(); |
86 | 86 | |
87 | - $this->assertSame($expected,$actual); |
|
87 | + $this->assertSame($expected, $actual); |
|
88 | 88 | |
89 | 89 | } |
90 | 90 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | $this->assertTrue(isset($schedulersJob->id)); |
117 | 117 | $this->assertEquals(36, strlen($schedulersJob->id)); |
118 | 118 | |
119 | - $this->assertEquals(SchedulersJob::JOB_STATUS_DONE,$schedulersJob->status); |
|
120 | - $this->assertEquals(SchedulersJob::JOB_FAILURE,$schedulersJob->resolution); |
|
119 | + $this->assertEquals(SchedulersJob::JOB_STATUS_DONE, $schedulersJob->status); |
|
120 | + $this->assertEquals(SchedulersJob::JOB_FAILURE, $schedulersJob->resolution); |
|
121 | 121 | |
122 | 122 | $schedulersJob->mark_deleted($schedulersJob->id); |
123 | 123 | |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | $this->assertTrue(isset($schedulersJob->id)); |
136 | 136 | $this->assertEquals(36, strlen($schedulersJob->id)); |
137 | 137 | |
138 | - $this->assertEquals(SchedulersJob::JOB_STATUS_DONE,$schedulersJob->status); |
|
139 | - $this->assertEquals(SchedulersJob::JOB_SUCCESS,$schedulersJob->resolution); |
|
138 | + $this->assertEquals(SchedulersJob::JOB_STATUS_DONE, $schedulersJob->status); |
|
139 | + $this->assertEquals(SchedulersJob::JOB_SUCCESS, $schedulersJob->resolution); |
|
140 | 140 | |
141 | 141 | $schedulersJob->mark_deleted($schedulersJob->id); |
142 | 142 | |
@@ -219,15 +219,15 @@ discard block |
||
219 | 219 | $this->assertEquals(36, strlen($schedulersJob->id)); |
220 | 220 | |
221 | 221 | //verify the related attributes |
222 | - $this->assertEquals(SchedulersJob::JOB_STATUS_QUEUED,$schedulersJob->status); |
|
223 | - $this->assertEquals(SchedulersJob::JOB_PARTIAL,$schedulersJob->resolution); |
|
222 | + $this->assertEquals(SchedulersJob::JOB_STATUS_QUEUED, $schedulersJob->status); |
|
223 | + $this->assertEquals(SchedulersJob::JOB_PARTIAL, $schedulersJob->resolution); |
|
224 | 224 | |
225 | 225 | |
226 | 226 | |
227 | 227 | //test mark deleted method and verify record doesn't exist after deletion |
228 | 228 | $schedulersJob->mark_deleted($schedulersJob->id); |
229 | 229 | $result = $schedulersJob->retrieve($schedulersJob->id); |
230 | - $this->assertEquals(null,$result); |
|
230 | + $this->assertEquals(null, $result); |
|
231 | 231 | |
232 | 232 | } |
233 | 233 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $schedulersJob->client = "test"; |
240 | 240 | $schedulersJob->status = SchedulersJob::JOB_STATUS_RUNNING; |
241 | 241 | $schedulersJob->save(); |
242 | - $result = SchedulersJob::runJobId($schedulersJob->id,"test"); |
|
242 | + $result = SchedulersJob::runJobId($schedulersJob->id, "test"); |
|
243 | 243 | |
244 | 244 | |
245 | 245 | //execute the method |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $schedulersJob->save(); |
268 | 268 | |
269 | 269 | $result = SchedulersJob::runJobId($schedulersJob->id); |
270 | - $this->assertEquals("Job " . $schedulersJob->id . " is not marked as running.", $result); |
|
270 | + $this->assertEquals("Job ".$schedulersJob->id." is not marked as running.", $result); |
|
271 | 271 | |
272 | 272 | |
273 | 273 | //test with valid job id and status but mismatch client |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | $schedulersJob->status = SchedulersJob::JOB_STATUS_RUNNING; |
276 | 276 | $schedulersJob->save(); |
277 | 277 | |
278 | - $result = SchedulersJob::runJobId($schedulersJob->id,"test_client"); |
|
278 | + $result = SchedulersJob::runJobId($schedulersJob->id, "test_client"); |
|
279 | 279 | |
280 | - $this->assertEquals("Job " . $schedulersJob->id . " belongs to another client, can not run as test_client.", $result); |
|
280 | + $this->assertEquals("Job ".$schedulersJob->id." belongs to another client, can not run as test_client.", $result); |
|
281 | 281 | |
282 | 282 | $schedulersJob->mark_deleted($schedulersJob->id); |
283 | 283 | |
@@ -292,21 +292,21 @@ discard block |
||
292 | 292 | |
293 | 293 | $schedulersJob->errors = ""; |
294 | 294 | $schedulersJob->errorHandler(E_USER_WARNING, "test err", 'testfile', '1'); |
295 | - $this->assertEquals("Warning [512]: test err in testfile on line 1\n", $schedulersJob->errors ); |
|
295 | + $this->assertEquals("Warning [512]: test err in testfile on line 1\n", $schedulersJob->errors); |
|
296 | 296 | |
297 | 297 | $schedulersJob->errors = ""; |
298 | 298 | $schedulersJob->errorHandler(E_ERROR, "test err", 'testfile', '1'); |
299 | - $this->assertEquals("Fatal Error [1]: test err in testfile on line 1\n", $schedulersJob->errors ); |
|
299 | + $this->assertEquals("Fatal Error [1]: test err in testfile on line 1\n", $schedulersJob->errors); |
|
300 | 300 | |
301 | 301 | |
302 | 302 | $schedulersJob->errors = ""; |
303 | 303 | $schedulersJob->errorHandler(E_PARSE, "test err", 'testfile', '1'); |
304 | - $this->assertEquals("Parse Error [4]: test err in testfile on line 1\n", $schedulersJob->errors ); |
|
304 | + $this->assertEquals("Parse Error [4]: test err in testfile on line 1\n", $schedulersJob->errors); |
|
305 | 305 | |
306 | 306 | |
307 | 307 | $schedulersJob->errors = ""; |
308 | 308 | $schedulersJob->errorHandler(E_RECOVERABLE_ERROR, "test err", 'testfile', '1'); |
309 | - $this->assertEquals("Recoverable Error [4096]: test err in testfile on line 1\n", $schedulersJob->errors ); |
|
309 | + $this->assertEquals("Recoverable Error [4096]: test err in testfile on line 1\n", $schedulersJob->errors); |
|
310 | 310 | |
311 | 311 | } |
312 | 312 |
@@ -97,8 +97,7 @@ discard block |
||
97 | 97 | try { |
98 | 98 | $schedulersJob->fill_in_additional_list_fields(); |
99 | 99 | $this->assertTrue(true); |
100 | - } |
|
101 | - catch (Exception $e) { |
|
100 | + } catch (Exception $e) { |
|
102 | 101 | $this->fail(); |
103 | 102 | } |
104 | 103 | |
@@ -151,8 +150,7 @@ discard block |
||
151 | 150 | try { |
152 | 151 | $schedulersJob->onFailureRetry(); |
153 | 152 | $this->assertTrue(true); |
154 | - } |
|
155 | - catch (Exception $e) { |
|
153 | + } catch (Exception $e) { |
|
156 | 154 | $this->fail(); |
157 | 155 | } |
158 | 156 | |
@@ -168,8 +166,7 @@ discard block |
||
168 | 166 | try { |
169 | 167 | $schedulersJob->onFinalFailure(); |
170 | 168 | $this->assertTrue(true); |
171 | - } |
|
172 | - catch (Exception $e) { |
|
169 | + } catch (Exception $e) { |
|
173 | 170 | $this->fail(); |
174 | 171 | } |
175 | 172 |
@@ -5,97 +5,97 @@ |
||
5 | 5 | |
6 | 6 | public function testAOP_Case_Updates(){ |
7 | 7 | |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $aopCaseUpdates = new AOP_Case_Updates(); |
|
10 | - $this->assertInstanceOf('AOP_Case_Updates',$aopCaseUpdates); |
|
11 | - $this->assertInstanceOf('Basic',$aopCaseUpdates); |
|
12 | - $this->assertInstanceOf('SugarBean',$aopCaseUpdates); |
|
13 | - |
|
14 | - $this->assertAttributeEquals('AOP_Case_Updates', 'module_dir', $aopCaseUpdates); |
|
15 | - $this->assertAttributeEquals('AOP_Case_Updates', 'object_name', $aopCaseUpdates); |
|
16 | - $this->assertAttributeEquals('aop_case_updates', 'table_name', $aopCaseUpdates); |
|
17 | - $this->assertAttributeEquals(true, 'new_schema', $aopCaseUpdates); |
|
18 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aopCaseUpdates); |
|
19 | - $this->assertAttributeEquals(false, 'importable', $aopCaseUpdates); |
|
20 | - $this->assertAttributeEquals(false, 'tracker_visibility', $aopCaseUpdates); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $aopCaseUpdates = new AOP_Case_Updates(); |
|
10 | + $this->assertInstanceOf('AOP_Case_Updates',$aopCaseUpdates); |
|
11 | + $this->assertInstanceOf('Basic',$aopCaseUpdates); |
|
12 | + $this->assertInstanceOf('SugarBean',$aopCaseUpdates); |
|
13 | + |
|
14 | + $this->assertAttributeEquals('AOP_Case_Updates', 'module_dir', $aopCaseUpdates); |
|
15 | + $this->assertAttributeEquals('AOP_Case_Updates', 'object_name', $aopCaseUpdates); |
|
16 | + $this->assertAttributeEquals('aop_case_updates', 'table_name', $aopCaseUpdates); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $aopCaseUpdates); |
|
18 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aopCaseUpdates); |
|
19 | + $this->assertAttributeEquals(false, 'importable', $aopCaseUpdates); |
|
20 | + $this->assertAttributeEquals(false, 'tracker_visibility', $aopCaseUpdates); |
|
21 | 21 | |
22 | 22 | } |
23 | 23 | |
24 | 24 | public function testsave(){ |
25 | 25 | |
26 | - error_reporting(E_ERROR | E_PARSE); |
|
27 | - |
|
28 | - $aopCaseUpdates = new AOP_Case_Updates(); |
|
29 | - $aopCaseUpdates->name = "test name"; |
|
30 | - $aopCaseUpdates->description = "test description"; |
|
31 | - $aopCaseUpdates->case_id = "test case id"; |
|
32 | - $aopCaseUpdates->contact_id = "test id"; |
|
33 | - $aopCaseUpdates->internal = 1; |
|
34 | - $aopCaseUpdates->save(); |
|
26 | + error_reporting(E_ERROR | E_PARSE); |
|
27 | + |
|
28 | + $aopCaseUpdates = new AOP_Case_Updates(); |
|
29 | + $aopCaseUpdates->name = "test name"; |
|
30 | + $aopCaseUpdates->description = "test description"; |
|
31 | + $aopCaseUpdates->case_id = "test case id"; |
|
32 | + $aopCaseUpdates->contact_id = "test id"; |
|
33 | + $aopCaseUpdates->internal = 1; |
|
34 | + $aopCaseUpdates->save(); |
|
35 | 35 | |
36 | - //test for record ID to verify that record is saved |
|
37 | - $this->assertEquals(36, strlen($aopCaseUpdates->id)); |
|
36 | + //test for record ID to verify that record is saved |
|
37 | + $this->assertEquals(36, strlen($aopCaseUpdates->id)); |
|
38 | 38 | |
39 | - //mark the record as deleted for cleanup |
|
40 | - $aopCaseUpdates->mark_deleted($aopCaseUpdates->id); |
|
39 | + //mark the record as deleted for cleanup |
|
40 | + $aopCaseUpdates->mark_deleted($aopCaseUpdates->id); |
|
41 | 41 | |
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | public function testgetCase(){ |
46 | 46 | |
47 | - $aopCaseUpdates = new AOP_Case_Updates(); |
|
47 | + $aopCaseUpdates = new AOP_Case_Updates(); |
|
48 | 48 | |
49 | - //execute the method and verify that it returns a Case object |
|
50 | - $result = $aopCaseUpdates->getCase(); |
|
49 | + //execute the method and verify that it returns a Case object |
|
50 | + $result = $aopCaseUpdates->getCase(); |
|
51 | 51 | |
52 | - $this->assertInstanceOf('aCase',$result); |
|
52 | + $this->assertInstanceOf('aCase',$result); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
56 | 56 | public function testgetContacts(){ |
57 | 57 | |
58 | - $aopCaseUpdates = new AOP_Case_Updates(); |
|
58 | + $aopCaseUpdates = new AOP_Case_Updates(); |
|
59 | 59 | |
60 | - //execute the method and verify that it returns an array |
|
61 | - $result = $aopCaseUpdates->getContacts(); |
|
62 | - $this->assertTrue(is_array($result)); |
|
60 | + //execute the method and verify that it returns an array |
|
61 | + $result = $aopCaseUpdates->getContacts(); |
|
62 | + $this->assertTrue(is_array($result)); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
66 | 66 | public function testgetUpdateContact(){ |
67 | 67 | |
68 | - $aopCaseUpdates = new AOP_Case_Updates(); |
|
68 | + $aopCaseUpdates = new AOP_Case_Updates(); |
|
69 | 69 | |
70 | - //execute the method without contact_id and verify that it returns null |
|
71 | - $result = $aopCaseUpdates->getUpdateContact(); |
|
72 | - $this->assertEquals(Null,$result); |
|
70 | + //execute the method without contact_id and verify that it returns null |
|
71 | + $result = $aopCaseUpdates->getUpdateContact(); |
|
72 | + $this->assertEquals(Null,$result); |
|
73 | 73 | |
74 | 74 | |
75 | - //execute the method without contact_id and verify that it returns false |
|
76 | - $aopCaseUpdates->contact_id = 1; |
|
77 | - $result = $aopCaseUpdates->getUpdateContact(); |
|
78 | - $this->assertEquals(False,$result); |
|
75 | + //execute the method without contact_id and verify that it returns false |
|
76 | + $aopCaseUpdates->contact_id = 1; |
|
77 | + $result = $aopCaseUpdates->getUpdateContact(); |
|
78 | + $this->assertEquals(False,$result); |
|
79 | 79 | |
80 | 80 | } |
81 | 81 | |
82 | 82 | public function testgetUser(){ |
83 | 83 | |
84 | - $aopCaseUpdates = new AOP_Case_Updates(); |
|
84 | + $aopCaseUpdates = new AOP_Case_Updates(); |
|
85 | 85 | |
86 | - //execute the method and verify that it returns an instance of User |
|
87 | - $result = $aopCaseUpdates->getUser(); |
|
88 | - $this->assertInstanceOf('User',$result); |
|
86 | + //execute the method and verify that it returns an instance of User |
|
87 | + $result = $aopCaseUpdates->getUser(); |
|
88 | + $this->assertInstanceOf('User',$result); |
|
89 | 89 | |
90 | 90 | } |
91 | 91 | |
92 | 92 | public function testgetUpdateUser(){ |
93 | 93 | |
94 | - $aopCaseUpdates = new AOP_Case_Updates(); |
|
94 | + $aopCaseUpdates = new AOP_Case_Updates(); |
|
95 | 95 | |
96 | - //execute the method and verify that it returns an instance of User |
|
97 | - $result = $aopCaseUpdates->getUpdateUser(); |
|
98 | - $this->assertInstanceOf('User',$result); |
|
96 | + //execute the method and verify that it returns an instance of User |
|
97 | + $result = $aopCaseUpdates->getUpdateUser(); |
|
98 | + $this->assertInstanceOf('User',$result); |
|
99 | 99 | |
100 | 100 | } |
101 | 101 |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | class AOP_Case_UpdatesTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | 5 | |
6 | - public function testAOP_Case_Updates(){ |
|
6 | + public function testAOP_Case_Updates() { |
|
7 | 7 | |
8 | 8 | //execute the contructor and check for the Object type and attributes |
9 | 9 | $aopCaseUpdates = new AOP_Case_Updates(); |
10 | - $this->assertInstanceOf('AOP_Case_Updates',$aopCaseUpdates); |
|
11 | - $this->assertInstanceOf('Basic',$aopCaseUpdates); |
|
12 | - $this->assertInstanceOf('SugarBean',$aopCaseUpdates); |
|
10 | + $this->assertInstanceOf('AOP_Case_Updates', $aopCaseUpdates); |
|
11 | + $this->assertInstanceOf('Basic', $aopCaseUpdates); |
|
12 | + $this->assertInstanceOf('SugarBean', $aopCaseUpdates); |
|
13 | 13 | |
14 | 14 | $this->assertAttributeEquals('AOP_Case_Updates', 'module_dir', $aopCaseUpdates); |
15 | 15 | $this->assertAttributeEquals('AOP_Case_Updates', 'object_name', $aopCaseUpdates); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | } |
23 | 23 | |
24 | - public function testsave(){ |
|
24 | + public function testsave() { |
|
25 | 25 | |
26 | 26 | error_reporting(E_ERROR | E_PARSE); |
27 | 27 | |
@@ -42,18 +42,18 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | - public function testgetCase(){ |
|
45 | + public function testgetCase() { |
|
46 | 46 | |
47 | 47 | $aopCaseUpdates = new AOP_Case_Updates(); |
48 | 48 | |
49 | 49 | //execute the method and verify that it returns a Case object |
50 | 50 | $result = $aopCaseUpdates->getCase(); |
51 | 51 | |
52 | - $this->assertInstanceOf('aCase',$result); |
|
52 | + $this->assertInstanceOf('aCase', $result); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
56 | - public function testgetContacts(){ |
|
56 | + public function testgetContacts() { |
|
57 | 57 | |
58 | 58 | $aopCaseUpdates = new AOP_Case_Updates(); |
59 | 59 | |
@@ -63,39 +63,39 @@ discard block |
||
63 | 63 | |
64 | 64 | } |
65 | 65 | |
66 | - public function testgetUpdateContact(){ |
|
66 | + public function testgetUpdateContact() { |
|
67 | 67 | |
68 | 68 | $aopCaseUpdates = new AOP_Case_Updates(); |
69 | 69 | |
70 | 70 | //execute the method without contact_id and verify that it returns null |
71 | 71 | $result = $aopCaseUpdates->getUpdateContact(); |
72 | - $this->assertEquals(Null,$result); |
|
72 | + $this->assertEquals(Null, $result); |
|
73 | 73 | |
74 | 74 | |
75 | 75 | //execute the method without contact_id and verify that it returns false |
76 | 76 | $aopCaseUpdates->contact_id = 1; |
77 | 77 | $result = $aopCaseUpdates->getUpdateContact(); |
78 | - $this->assertEquals(False,$result); |
|
78 | + $this->assertEquals(False, $result); |
|
79 | 79 | |
80 | 80 | } |
81 | 81 | |
82 | - public function testgetUser(){ |
|
82 | + public function testgetUser() { |
|
83 | 83 | |
84 | 84 | $aopCaseUpdates = new AOP_Case_Updates(); |
85 | 85 | |
86 | 86 | //execute the method and verify that it returns an instance of User |
87 | 87 | $result = $aopCaseUpdates->getUser(); |
88 | - $this->assertInstanceOf('User',$result); |
|
88 | + $this->assertInstanceOf('User', $result); |
|
89 | 89 | |
90 | 90 | } |
91 | 91 | |
92 | - public function testgetUpdateUser(){ |
|
92 | + public function testgetUpdateUser() { |
|
93 | 93 | |
94 | 94 | $aopCaseUpdates = new AOP_Case_Updates(); |
95 | 95 | |
96 | 96 | //execute the method and verify that it returns an instance of User |
97 | 97 | $result = $aopCaseUpdates->getUpdateUser(); |
98 | - $this->assertInstanceOf('User',$result); |
|
98 | + $this->assertInstanceOf('User', $result); |
|
99 | 99 | |
100 | 100 | } |
101 | 101 |
@@ -6,88 +6,88 @@ |
||
6 | 6 | |
7 | 7 | public function testjjwg_Markers() { |
8 | 8 | |
9 | - //execute the contructor and check for the Object type and attributes |
|
10 | - $jjwgMarkers = new jjwg_Markers(); |
|
9 | + //execute the contructor and check for the Object type and attributes |
|
10 | + $jjwgMarkers = new jjwg_Markers(); |
|
11 | 11 | |
12 | - $this->assertInstanceOf('jjwg_Markers',$jjwgMarkers); |
|
13 | - $this->assertInstanceOf('Basic',$jjwgMarkers); |
|
14 | - $this->assertInstanceOf('SugarBean',$jjwgMarkers); |
|
12 | + $this->assertInstanceOf('jjwg_Markers',$jjwgMarkers); |
|
13 | + $this->assertInstanceOf('Basic',$jjwgMarkers); |
|
14 | + $this->assertInstanceOf('SugarBean',$jjwgMarkers); |
|
15 | 15 | |
16 | - $this->assertAttributeEquals('jjwg_Markers', 'module_dir', $jjwgMarkers); |
|
17 | - $this->assertAttributeEquals('jjwg_Markers', 'object_name', $jjwgMarkers); |
|
18 | - $this->assertAttributeEquals('jjwg_markers', 'table_name', $jjwgMarkers); |
|
16 | + $this->assertAttributeEquals('jjwg_Markers', 'module_dir', $jjwgMarkers); |
|
17 | + $this->assertAttributeEquals('jjwg_Markers', 'object_name', $jjwgMarkers); |
|
18 | + $this->assertAttributeEquals('jjwg_markers', 'table_name', $jjwgMarkers); |
|
19 | 19 | |
20 | - $this->assertAttributeEquals(true, 'new_schema', $jjwgMarkers); |
|
21 | - $this->assertAttributeEquals(true, 'importable', $jjwgMarkers); |
|
22 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $jjwgMarkers); |
|
20 | + $this->assertAttributeEquals(true, 'new_schema', $jjwgMarkers); |
|
21 | + $this->assertAttributeEquals(true, 'importable', $jjwgMarkers); |
|
22 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $jjwgMarkers); |
|
23 | 23 | |
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | public function testconfiguration() { |
28 | 28 | |
29 | - error_reporting(E_ERROR | E_PARSE); |
|
29 | + error_reporting(E_ERROR | E_PARSE); |
|
30 | 30 | |
31 | - $jjwgMarkers = new jjwg_Markers(); |
|
31 | + $jjwgMarkers = new jjwg_Markers(); |
|
32 | 32 | |
33 | - $jjwgMarkers->configuration(); |
|
33 | + $jjwgMarkers->configuration(); |
|
34 | 34 | |
35 | - $this->assertInstanceOf('jjwg_Maps',$jjwgMarkers->jjwg_Maps); |
|
36 | - $this->assertTrue(is_array($jjwgMarkers->settings)); |
|
37 | - $this->assertGreaterThan(0,count($jjwgMarkers->settings)); |
|
35 | + $this->assertInstanceOf('jjwg_Maps',$jjwgMarkers->jjwg_Maps); |
|
36 | + $this->assertTrue(is_array($jjwgMarkers->settings)); |
|
37 | + $this->assertGreaterThan(0,count($jjwgMarkers->settings)); |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | |
41 | 41 | |
42 | 42 | public function testdefine_loc() { |
43 | 43 | |
44 | - $jjwgMarkers = new jjwg_Markers(); |
|
44 | + $jjwgMarkers = new jjwg_Markers(); |
|
45 | 45 | |
46 | - //test without pre settting attributes |
|
47 | - $result = $jjwgMarkers->define_loc(array()); |
|
48 | - $this->assertEquals("N/A", $result['name']); |
|
49 | - $this->assertTrue(is_numeric($result['lat'])); |
|
50 | - $this->assertTrue(is_numeric($result['lng'])); |
|
51 | - $this->assertEquals("company", $result['image']); |
|
46 | + //test without pre settting attributes |
|
47 | + $result = $jjwgMarkers->define_loc(array()); |
|
48 | + $this->assertEquals("N/A", $result['name']); |
|
49 | + $this->assertTrue(is_numeric($result['lat'])); |
|
50 | + $this->assertTrue(is_numeric($result['lng'])); |
|
51 | + $this->assertEquals("company", $result['image']); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | - //test with required attributes preset |
|
56 | - $marker = array("name"=>"test", "lat"=>50, "lng"=>100, "image"=>null); |
|
57 | - $result = $jjwgMarkers->define_loc($marker); |
|
58 | - $this->assertSame($marker, $result); |
|
55 | + //test with required attributes preset |
|
56 | + $marker = array("name"=>"test", "lat"=>50, "lng"=>100, "image"=>null); |
|
57 | + $result = $jjwgMarkers->define_loc($marker); |
|
58 | + $this->assertSame($marker, $result); |
|
59 | 59 | |
60 | 60 | } |
61 | 61 | |
62 | 62 | public function testis_valid_lng() { |
63 | 63 | |
64 | - $jjwgMarkers = new jjwg_Markers(); |
|
64 | + $jjwgMarkers = new jjwg_Markers(); |
|
65 | 65 | |
66 | - //test with invalid values |
|
67 | - $this->assertEquals(false, $jjwgMarkers->is_valid_lng('') ); |
|
68 | - $this->assertEquals(false, $jjwgMarkers->is_valid_lng(181) ); |
|
69 | - $this->assertEquals(false, $jjwgMarkers->is_valid_lng(-181) ); |
|
66 | + //test with invalid values |
|
67 | + $this->assertEquals(false, $jjwgMarkers->is_valid_lng('') ); |
|
68 | + $this->assertEquals(false, $jjwgMarkers->is_valid_lng(181) ); |
|
69 | + $this->assertEquals(false, $jjwgMarkers->is_valid_lng(-181) ); |
|
70 | 70 | |
71 | - //test with valid values |
|
72 | - $this->assertEquals(true, $jjwgMarkers->is_valid_lng(180) ); |
|
73 | - $this->assertEquals(true, $jjwgMarkers->is_valid_lng(-180) ); |
|
71 | + //test with valid values |
|
72 | + $this->assertEquals(true, $jjwgMarkers->is_valid_lng(180) ); |
|
73 | + $this->assertEquals(true, $jjwgMarkers->is_valid_lng(-180) ); |
|
74 | 74 | |
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | 78 | public function testis_valid_lat() { |
79 | 79 | |
80 | - $jjwgMarkers = new jjwg_Markers(); |
|
80 | + $jjwgMarkers = new jjwg_Markers(); |
|
81 | 81 | |
82 | - //test with invalid values |
|
83 | - $this->assertEquals(false, $jjwgMarkers->is_valid_lat('') ); |
|
84 | - $this->assertEquals(false, $jjwgMarkers->is_valid_lat(91) ); |
|
85 | - $this->assertEquals(false, $jjwgMarkers->is_valid_lat(-91) ); |
|
82 | + //test with invalid values |
|
83 | + $this->assertEquals(false, $jjwgMarkers->is_valid_lat('') ); |
|
84 | + $this->assertEquals(false, $jjwgMarkers->is_valid_lat(91) ); |
|
85 | + $this->assertEquals(false, $jjwgMarkers->is_valid_lat(-91) ); |
|
86 | 86 | |
87 | 87 | |
88 | - //test with valid values |
|
89 | - $this->assertEquals(true, $jjwgMarkers->is_valid_lat(90) ); |
|
90 | - $this->assertEquals(true, $jjwgMarkers->is_valid_lat(-90) ); |
|
88 | + //test with valid values |
|
89 | + $this->assertEquals(true, $jjwgMarkers->is_valid_lat(90) ); |
|
90 | + $this->assertEquals(true, $jjwgMarkers->is_valid_lat(-90) ); |
|
91 | 91 | |
92 | 92 | } |
93 | 93 |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | //execute the contructor and check for the Object type and attributes |
10 | 10 | $jjwgMarkers = new jjwg_Markers(); |
11 | 11 | |
12 | - $this->assertInstanceOf('jjwg_Markers',$jjwgMarkers); |
|
13 | - $this->assertInstanceOf('Basic',$jjwgMarkers); |
|
14 | - $this->assertInstanceOf('SugarBean',$jjwgMarkers); |
|
12 | + $this->assertInstanceOf('jjwg_Markers', $jjwgMarkers); |
|
13 | + $this->assertInstanceOf('Basic', $jjwgMarkers); |
|
14 | + $this->assertInstanceOf('SugarBean', $jjwgMarkers); |
|
15 | 15 | |
16 | 16 | $this->assertAttributeEquals('jjwg_Markers', 'module_dir', $jjwgMarkers); |
17 | 17 | $this->assertAttributeEquals('jjwg_Markers', 'object_name', $jjwgMarkers); |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | $jjwgMarkers->configuration(); |
34 | 34 | |
35 | - $this->assertInstanceOf('jjwg_Maps',$jjwgMarkers->jjwg_Maps); |
|
35 | + $this->assertInstanceOf('jjwg_Maps', $jjwgMarkers->jjwg_Maps); |
|
36 | 36 | $this->assertTrue(is_array($jjwgMarkers->settings)); |
37 | - $this->assertGreaterThan(0,count($jjwgMarkers->settings)); |
|
37 | + $this->assertGreaterThan(0, count($jjwgMarkers->settings)); |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | $jjwgMarkers = new jjwg_Markers(); |
65 | 65 | |
66 | 66 | //test with invalid values |
67 | - $this->assertEquals(false, $jjwgMarkers->is_valid_lng('') ); |
|
68 | - $this->assertEquals(false, $jjwgMarkers->is_valid_lng(181) ); |
|
69 | - $this->assertEquals(false, $jjwgMarkers->is_valid_lng(-181) ); |
|
67 | + $this->assertEquals(false, $jjwgMarkers->is_valid_lng('')); |
|
68 | + $this->assertEquals(false, $jjwgMarkers->is_valid_lng(181)); |
|
69 | + $this->assertEquals(false, $jjwgMarkers->is_valid_lng(-181)); |
|
70 | 70 | |
71 | 71 | //test with valid values |
72 | - $this->assertEquals(true, $jjwgMarkers->is_valid_lng(180) ); |
|
73 | - $this->assertEquals(true, $jjwgMarkers->is_valid_lng(-180) ); |
|
72 | + $this->assertEquals(true, $jjwgMarkers->is_valid_lng(180)); |
|
73 | + $this->assertEquals(true, $jjwgMarkers->is_valid_lng(-180)); |
|
74 | 74 | |
75 | 75 | } |
76 | 76 | |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | $jjwgMarkers = new jjwg_Markers(); |
81 | 81 | |
82 | 82 | //test with invalid values |
83 | - $this->assertEquals(false, $jjwgMarkers->is_valid_lat('') ); |
|
84 | - $this->assertEquals(false, $jjwgMarkers->is_valid_lat(91) ); |
|
85 | - $this->assertEquals(false, $jjwgMarkers->is_valid_lat(-91) ); |
|
83 | + $this->assertEquals(false, $jjwgMarkers->is_valid_lat('')); |
|
84 | + $this->assertEquals(false, $jjwgMarkers->is_valid_lat(91)); |
|
85 | + $this->assertEquals(false, $jjwgMarkers->is_valid_lat(-91)); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | //test with valid values |
89 | - $this->assertEquals(true, $jjwgMarkers->is_valid_lat(90) ); |
|
90 | - $this->assertEquals(true, $jjwgMarkers->is_valid_lat(-90) ); |
|
89 | + $this->assertEquals(true, $jjwgMarkers->is_valid_lat(90)); |
|
90 | + $this->assertEquals(true, $jjwgMarkers->is_valid_lat(-90)); |
|
91 | 91 | |
92 | 92 | } |
93 | 93 |