@@ -7,335 +7,335 @@ |
||
7 | 7 | class SchedulerTest extends PHPUnit_Framework_TestCase { |
8 | 8 | |
9 | 9 | |
10 | - public function test__construct() |
|
11 | - { |
|
10 | + public function test__construct() |
|
11 | + { |
|
12 | 12 | |
13 | - //execute the contructor and check for the Object type and attributes |
|
14 | - $scheduler = new Scheduler(); |
|
13 | + //execute the contructor and check for the Object type and attributes |
|
14 | + $scheduler = new Scheduler(); |
|
15 | 15 | |
16 | - $this->assertInstanceOf('Scheduler',$scheduler); |
|
17 | - $this->assertInstanceOf('SugarBean',$scheduler); |
|
16 | + $this->assertInstanceOf('Scheduler',$scheduler); |
|
17 | + $this->assertInstanceOf('SugarBean',$scheduler); |
|
18 | 18 | |
19 | - $this->assertAttributeEquals('schedulers', 'table_name', $scheduler); |
|
20 | - $this->assertAttributeEquals('Schedulers', 'module_dir', $scheduler); |
|
21 | - $this->assertAttributeEquals('Scheduler', 'object_name', $scheduler); |
|
19 | + $this->assertAttributeEquals('schedulers', 'table_name', $scheduler); |
|
20 | + $this->assertAttributeEquals('Schedulers', 'module_dir', $scheduler); |
|
21 | + $this->assertAttributeEquals('Scheduler', 'object_name', $scheduler); |
|
22 | 22 | |
23 | 23 | |
24 | - $this->assertAttributeEquals(true, 'new_schema', $scheduler); |
|
25 | - $this->assertAttributeEquals(true, 'process_save_dates', $scheduler); |
|
24 | + $this->assertAttributeEquals(true, 'new_schema', $scheduler); |
|
25 | + $this->assertAttributeEquals(true, 'process_save_dates', $scheduler); |
|
26 | 26 | |
27 | - } |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | - public function testinitUser() |
|
32 | - { |
|
33 | - $user = Scheduler::initUser(); |
|
34 | - $this->assertInstanceOf('User',$user); |
|
35 | - } |
|
31 | + public function testinitUser() |
|
32 | + { |
|
33 | + $user = Scheduler::initUser(); |
|
34 | + $this->assertInstanceOf('User',$user); |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - public function testfireQualified() |
|
39 | - { |
|
40 | - error_reporting(E_ERROR | E_PARSE); |
|
38 | + public function testfireQualified() |
|
39 | + { |
|
40 | + error_reporting(E_ERROR | E_PARSE); |
|
41 | 41 | |
42 | - $scheduler = new Scheduler(); |
|
42 | + $scheduler = new Scheduler(); |
|
43 | 43 | |
44 | 44 | |
45 | - //test without setting any attributes |
|
46 | - $result = $scheduler->fireQualified(); |
|
47 | - $this->assertEquals(false, $result); |
|
45 | + //test without setting any attributes |
|
46 | + $result = $scheduler->fireQualified(); |
|
47 | + $this->assertEquals(false, $result); |
|
48 | 48 | |
49 | 49 | |
50 | - //test with required attributes set |
|
51 | - $scheduler->id = 1; |
|
52 | - $scheduler->job_interval = "0::3::*::*::*"; |
|
53 | - $scheduler->date_time_start = "2015-01-01 10:30:01"; |
|
50 | + //test with required attributes set |
|
51 | + $scheduler->id = 1; |
|
52 | + $scheduler->job_interval = "0::3::*::*::*"; |
|
53 | + $scheduler->date_time_start = "2015-01-01 10:30:01"; |
|
54 | 54 | |
55 | - $result = $scheduler->fireQualified(); |
|
56 | - $this->assertEquals(true, $result); |
|
55 | + $result = $scheduler->fireQualified(); |
|
56 | + $this->assertEquals(true, $result); |
|
57 | 57 | |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | |
61 | - public function testcreateJob() |
|
62 | - { |
|
63 | - $scheduler = new Scheduler(); |
|
64 | - $result = $scheduler->createJob(); |
|
61 | + public function testcreateJob() |
|
62 | + { |
|
63 | + $scheduler = new Scheduler(); |
|
64 | + $result = $scheduler->createJob(); |
|
65 | 65 | |
66 | - $this->assertInstanceOf('SchedulersJob',$result); |
|
66 | + $this->assertInstanceOf('SchedulersJob',$result); |
|
67 | 67 | |
68 | - } |
|
68 | + } |
|
69 | 69 | |
70 | 70 | |
71 | - public function testcheckPendingJobs() |
|
72 | - { |
|
73 | - $scheduler = new Scheduler(); |
|
71 | + public function testcheckPendingJobs() |
|
72 | + { |
|
73 | + $scheduler = new Scheduler(); |
|
74 | 74 | |
75 | - //execute the method and test if it works and does not throws an exception. |
|
76 | - try { |
|
77 | - $scheduler->checkPendingJobs(new SugarJobQueue()); |
|
78 | - $this->assertTrue(true); |
|
79 | - } |
|
80 | - catch (Exception $e) { |
|
81 | - $this->fail(); |
|
82 | - } |
|
75 | + //execute the method and test if it works and does not throws an exception. |
|
76 | + try { |
|
77 | + $scheduler->checkPendingJobs(new SugarJobQueue()); |
|
78 | + $this->assertTrue(true); |
|
79 | + } |
|
80 | + catch (Exception $e) { |
|
81 | + $this->fail(); |
|
82 | + } |
|
83 | 83 | |
84 | 84 | |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | - public function testderiveDBDateTimes() |
|
89 | - { |
|
90 | - $scheduler = new Scheduler(); |
|
88 | + public function testderiveDBDateTimes() |
|
89 | + { |
|
90 | + $scheduler = new Scheduler(); |
|
91 | 91 | |
92 | - $scheduler->id = 1; |
|
93 | - $scheduler->date_time_start = "2016-01-01 10:30:01"; |
|
92 | + $scheduler->id = 1; |
|
93 | + $scheduler->date_time_start = "2016-01-01 10:30:01"; |
|
94 | 94 | |
95 | - //execute the method with different job intervals |
|
95 | + //execute the method with different job intervals |
|
96 | 96 | |
97 | - $scheduler->job_interval = "0::3::3::*::*"; |
|
98 | - $result = $scheduler->deriveDBDateTimes(); |
|
99 | - $this->assertEquals(false,$result); |
|
97 | + $scheduler->job_interval = "0::3::3::*::*"; |
|
98 | + $result = $scheduler->deriveDBDateTimes(); |
|
99 | + $this->assertEquals(false,$result); |
|
100 | 100 | |
101 | 101 | |
102 | - $scheduler->job_interval = "*::*::*::*::*"; |
|
103 | - $result = $scheduler->deriveDBDateTimes(); |
|
104 | - $this->assertEquals(false,$result); |
|
102 | + $scheduler->job_interval = "*::*::*::*::*"; |
|
103 | + $result = $scheduler->deriveDBDateTimes(); |
|
104 | + $this->assertEquals(false,$result); |
|
105 | 105 | |
106 | 106 | |
107 | - $scheduler->job_interval = "0::*::3::*::*"; |
|
108 | - $result = $scheduler->deriveDBDateTimes(); |
|
109 | - $this->assertEquals(false,$result); |
|
107 | + $scheduler->job_interval = "0::*::3::*::*"; |
|
108 | + $result = $scheduler->deriveDBDateTimes(); |
|
109 | + $this->assertEquals(false,$result); |
|
110 | 110 | |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | 113 | |
114 | - public function testhandleIntervalType() { |
|
114 | + public function testhandleIntervalType() { |
|
115 | 115 | |
116 | - $scheduler = new Scheduler(); |
|
116 | + $scheduler = new Scheduler(); |
|
117 | 117 | |
118 | - //execute the method with different job intervals |
|
118 | + //execute the method with different job intervals |
|
119 | 119 | |
120 | - $this->assertEquals("", $scheduler->handleIntervalType('0','0','2','2')); |
|
121 | - $this->assertEquals('00:02', $scheduler->handleIntervalType('1','0','2','2')); |
|
122 | - $this->assertEquals('30th', $scheduler->handleIntervalType('2','0','2','2')); |
|
123 | - $this->assertEquals('December', $scheduler->handleIntervalType('3','0','2','2')); |
|
124 | - $this->assertEquals("", $scheduler->handleIntervalType('4','0','2','2')); |
|
120 | + $this->assertEquals("", $scheduler->handleIntervalType('0','0','2','2')); |
|
121 | + $this->assertEquals('00:02', $scheduler->handleIntervalType('1','0','2','2')); |
|
122 | + $this->assertEquals('30th', $scheduler->handleIntervalType('2','0','2','2')); |
|
123 | + $this->assertEquals('December', $scheduler->handleIntervalType('3','0','2','2')); |
|
124 | + $this->assertEquals("", $scheduler->handleIntervalType('4','0','2','2')); |
|
125 | 125 | |
126 | - } |
|
126 | + } |
|
127 | 127 | |
128 | - public function testsetIntervalHumanReadable() { |
|
128 | + public function testsetIntervalHumanReadable() { |
|
129 | 129 | |
130 | - $scheduler = new Scheduler(); |
|
130 | + $scheduler = new Scheduler(); |
|
131 | 131 | |
132 | - //execute the method with different job intervals |
|
132 | + //execute the method with different job intervals |
|
133 | 133 | |
134 | - $scheduler->job_interval = "0::3::3::*::*"; |
|
135 | - $scheduler->parseInterval(); |
|
136 | - $scheduler->setIntervalHumanReadable(); |
|
137 | - $this->assertEquals('03:00; 3rd', $scheduler->intervalHumanReadable ); |
|
134 | + $scheduler->job_interval = "0::3::3::*::*"; |
|
135 | + $scheduler->parseInterval(); |
|
136 | + $scheduler->setIntervalHumanReadable(); |
|
137 | + $this->assertEquals('03:00; 3rd', $scheduler->intervalHumanReadable ); |
|
138 | 138 | |
139 | 139 | |
140 | - $scheduler->job_interval = "0::3::3::3::3"; |
|
141 | - $scheduler->parseInterval(); |
|
142 | - $scheduler->setIntervalHumanReadable(); |
|
143 | - $this->assertEquals('03:00; 3rd; March', $scheduler->intervalHumanReadable ); |
|
140 | + $scheduler->job_interval = "0::3::3::3::3"; |
|
141 | + $scheduler->parseInterval(); |
|
142 | + $scheduler->setIntervalHumanReadable(); |
|
143 | + $this->assertEquals('03:00; 3rd; March', $scheduler->intervalHumanReadable ); |
|
144 | 144 | |
145 | - } |
|
145 | + } |
|
146 | 146 | |
147 | 147 | |
148 | 148 | |
149 | 149 | |
150 | - public function testsetStandardArraysAttributes() { |
|
150 | + public function testsetStandardArraysAttributes() { |
|
151 | 151 | |
152 | - $scheduler = new Scheduler(); |
|
152 | + $scheduler = new Scheduler(); |
|
153 | 153 | |
154 | - //execute the method and verify related attributes |
|
154 | + //execute the method and verify related attributes |
|
155 | 155 | |
156 | - $scheduler->setStandardArraysAttributes(); |
|
156 | + $scheduler->setStandardArraysAttributes(); |
|
157 | 157 | |
158 | - $this->assertEquals(array('*', 1, 2, 3, 4, 5, 6, 0), $scheduler->dayInt ); |
|
159 | - $this->assertEquals(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), $scheduler->monthsInt ); |
|
160 | - $this->assertEquals(array('', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'), $scheduler->monthsLabel ); |
|
161 | - $this->assertEquals(array('*', '/', '-', ','), $scheduler->metricsVar ); |
|
162 | - $this->assertEquals(array(' every ', '', ' thru ', ' and '), $scheduler->metricsVal ); |
|
158 | + $this->assertEquals(array('*', 1, 2, 3, 4, 5, 6, 0), $scheduler->dayInt ); |
|
159 | + $this->assertEquals(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), $scheduler->monthsInt ); |
|
160 | + $this->assertEquals(array('', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'), $scheduler->monthsLabel ); |
|
161 | + $this->assertEquals(array('*', '/', '-', ','), $scheduler->metricsVar ); |
|
162 | + $this->assertEquals(array(' every ', '', ' thru ', ' and '), $scheduler->metricsVal ); |
|
163 | 163 | |
164 | - } |
|
164 | + } |
|
165 | 165 | |
166 | 166 | |
167 | - public function testparseInterval() { |
|
167 | + public function testparseInterval() { |
|
168 | 168 | |
169 | - $scheduler = new Scheduler(); |
|
169 | + $scheduler = new Scheduler(); |
|
170 | 170 | |
171 | - $scheduler->job_interval = "0::3::3::*::*"; |
|
171 | + $scheduler->job_interval = "0::3::3::*::*"; |
|
172 | 172 | |
173 | - $expected = array ( |
|
174 | - 'raw' => array ('0', '3', '3', '*', '*' ), |
|
175 | - 'hours' => '3:::0', |
|
176 | - 'months' => '*:::3', |
|
177 | - ); |
|
173 | + $expected = array ( |
|
174 | + 'raw' => array ('0', '3', '3', '*', '*' ), |
|
175 | + 'hours' => '3:::0', |
|
176 | + 'months' => '*:::3', |
|
177 | + ); |
|
178 | 178 | |
179 | - //execute the method and verify related attributes |
|
180 | - $scheduler->parseInterval(); |
|
179 | + //execute the method and verify related attributes |
|
180 | + $scheduler->parseInterval(); |
|
181 | 181 | |
182 | - $this->assertTrue(is_array($scheduler->intervalParsed)); |
|
183 | - $this->assertSame($expected, $scheduler->intervalParsed); |
|
182 | + $this->assertTrue(is_array($scheduler->intervalParsed)); |
|
183 | + $this->assertSame($expected, $scheduler->intervalParsed); |
|
184 | 184 | |
185 | - } |
|
185 | + } |
|
186 | 186 | |
187 | 187 | |
188 | - public function testcheckCurl() { |
|
188 | + public function testcheckCurl() { |
|
189 | 189 | |
190 | - $scheduler = new Scheduler(); |
|
190 | + $scheduler = new Scheduler(); |
|
191 | 191 | |
192 | - //execute the method and test if it works and does not throws an exception. |
|
193 | - try { |
|
194 | - $scheduler->checkCurl(); |
|
195 | - $this->assertTrue(true); |
|
196 | - } |
|
197 | - catch (Exception $e) { |
|
198 | - $this->fail(); |
|
199 | - } |
|
192 | + //execute the method and test if it works and does not throws an exception. |
|
193 | + try { |
|
194 | + $scheduler->checkCurl(); |
|
195 | + $this->assertTrue(true); |
|
196 | + } |
|
197 | + catch (Exception $e) { |
|
198 | + $this->fail(); |
|
199 | + } |
|
200 | 200 | |
201 | - } |
|
201 | + } |
|
202 | 202 | |
203 | - public function testdisplayCronInstructions() { |
|
203 | + public function testdisplayCronInstructions() { |
|
204 | 204 | |
205 | - $scheduler = new Scheduler(); |
|
205 | + $scheduler = new Scheduler(); |
|
206 | 206 | |
207 | - //execute the method and capture the echo output |
|
208 | - ob_start(); |
|
207 | + //execute the method and capture the echo output |
|
208 | + ob_start(); |
|
209 | 209 | |
210 | - $scheduler->displayCronInstructions(); |
|
210 | + $scheduler->displayCronInstructions(); |
|
211 | 211 | |
212 | - $renderedContent = ob_get_contents(); |
|
213 | - ob_end_clean(); |
|
212 | + $renderedContent = ob_get_contents(); |
|
213 | + ob_end_clean(); |
|
214 | 214 | |
215 | - $this->assertGreaterThanOrEqual(0, strlen($renderedContent)); |
|
215 | + $this->assertGreaterThanOrEqual(0, strlen($renderedContent)); |
|
216 | 216 | |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | |
220 | 220 | |
221 | - public function testrebuildDefaultSchedulers() { |
|
221 | + public function testrebuildDefaultSchedulers() { |
|
222 | 222 | |
223 | - $scheduler = new Scheduler(); |
|
223 | + $scheduler = new Scheduler(); |
|
224 | 224 | |
225 | - //execute the method and test if it works and does not throws an exception. |
|
226 | - try { |
|
227 | - $scheduler->rebuildDefaultSchedulers(); |
|
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 | + $scheduler->rebuildDefaultSchedulers(); |
|
228 | + $this->assertTrue(true); |
|
229 | + } |
|
230 | + catch (Exception $e) { |
|
231 | + $this->fail(); |
|
232 | + } |
|
233 | 233 | |
234 | 234 | |
235 | - } |
|
235 | + } |
|
236 | 236 | |
237 | 237 | |
238 | - public function testcreate_export_query() { |
|
238 | + public function testcreate_export_query() { |
|
239 | 239 | |
240 | - $scheduler = new Scheduler(); |
|
240 | + $scheduler = new Scheduler(); |
|
241 | 241 | |
242 | 242 | |
243 | - //test with empty string params |
|
244 | - $expected = " SELECT schedulers.* , jt0.user_name created_by_name , jt0.created_by created_by_name_owner , 'Users' created_by_name_mod , jt1.user_name modified_by_name , jt1.created_by modified_by_name_owner , 'Users' modified_by_name_mod FROM schedulers LEFT JOIN users jt0 ON jt0.id=schedulers.created_by AND jt0.deleted=0\n AND jt0.deleted=0 LEFT JOIN users jt1 ON schedulers.modified_user_id=jt1.id AND jt1.deleted=0\n\n AND jt1.deleted=0 where schedulers.deleted=0"; |
|
245 | - $actual = $scheduler->create_export_query('',''); |
|
246 | - $this->assertSame($expected,$actual); |
|
243 | + //test with empty string params |
|
244 | + $expected = " SELECT schedulers.* , jt0.user_name created_by_name , jt0.created_by created_by_name_owner , 'Users' created_by_name_mod , jt1.user_name modified_by_name , jt1.created_by modified_by_name_owner , 'Users' modified_by_name_mod FROM schedulers LEFT JOIN users jt0 ON jt0.id=schedulers.created_by AND jt0.deleted=0\n AND jt0.deleted=0 LEFT JOIN users jt1 ON schedulers.modified_user_id=jt1.id AND jt1.deleted=0\n\n AND jt1.deleted=0 where schedulers.deleted=0"; |
|
245 | + $actual = $scheduler->create_export_query('',''); |
|
246 | + $this->assertSame($expected,$actual); |
|
247 | 247 | |
248 | 248 | |
249 | - //test with valid string params |
|
250 | - $expected = " SELECT schedulers.* , jt0.user_name created_by_name , jt0.created_by created_by_name_owner , 'Users' created_by_name_mod , jt1.user_name modified_by_name , jt1.created_by modified_by_name_owner , 'Users' modified_by_name_mod FROM schedulers LEFT JOIN users jt0 ON jt0.id=schedulers.created_by AND jt0.deleted=0\n AND jt0.deleted=0 LEFT JOIN users jt1 ON schedulers.modified_user_id=jt1.id AND jt1.deleted=0\n\n AND jt1.deleted=0 where (schedulers.name = \"\") AND schedulers.deleted=0"; |
|
251 | - $actual = $scheduler->create_export_query('schedulers.id','schedulers.name = ""'); |
|
252 | - $this->assertSame($expected,$actual); |
|
249 | + //test with valid string params |
|
250 | + $expected = " SELECT schedulers.* , jt0.user_name created_by_name , jt0.created_by created_by_name_owner , 'Users' created_by_name_mod , jt1.user_name modified_by_name , jt1.created_by modified_by_name_owner , 'Users' modified_by_name_mod FROM schedulers LEFT JOIN users jt0 ON jt0.id=schedulers.created_by AND jt0.deleted=0\n AND jt0.deleted=0 LEFT JOIN users jt1 ON schedulers.modified_user_id=jt1.id AND jt1.deleted=0\n\n AND jt1.deleted=0 where (schedulers.name = \"\") AND schedulers.deleted=0"; |
|
251 | + $actual = $scheduler->create_export_query('schedulers.id','schedulers.name = ""'); |
|
252 | + $this->assertSame($expected,$actual); |
|
253 | 253 | |
254 | - } |
|
254 | + } |
|
255 | 255 | |
256 | 256 | |
257 | - public function testfill_in_additional_list_fields() { |
|
257 | + public function testfill_in_additional_list_fields() { |
|
258 | 258 | |
259 | - $scheduler = new Scheduler(); |
|
259 | + $scheduler = new Scheduler(); |
|
260 | 260 | |
261 | - //execute the method and test if it works and does not throws an exception. |
|
262 | - try { |
|
263 | - $scheduler->fill_in_additional_list_fields(); |
|
264 | - $this->assertTrue(true); |
|
265 | - } |
|
266 | - catch (Exception $e) { |
|
267 | - $this->fail(); |
|
268 | - } |
|
261 | + //execute the method and test if it works and does not throws an exception. |
|
262 | + try { |
|
263 | + $scheduler->fill_in_additional_list_fields(); |
|
264 | + $this->assertTrue(true); |
|
265 | + } |
|
266 | + catch (Exception $e) { |
|
267 | + $this->fail(); |
|
268 | + } |
|
269 | 269 | |
270 | - } |
|
270 | + } |
|
271 | 271 | |
272 | - public function testfill_in_additional_detail_fields() { |
|
272 | + public function testfill_in_additional_detail_fields() { |
|
273 | 273 | |
274 | - $scheduler = new Scheduler(); |
|
274 | + $scheduler = new Scheduler(); |
|
275 | 275 | |
276 | - //execute the method and test if it works and does not throws an exception. |
|
277 | - try { |
|
278 | - $scheduler->fill_in_additional_detail_fields(); |
|
279 | - $this->assertTrue(true); |
|
280 | - } |
|
281 | - catch (Exception $e) { |
|
282 | - $this->fail(); |
|
283 | - } |
|
276 | + //execute the method and test if it works and does not throws an exception. |
|
277 | + try { |
|
278 | + $scheduler->fill_in_additional_detail_fields(); |
|
279 | + $this->assertTrue(true); |
|
280 | + } |
|
281 | + catch (Exception $e) { |
|
282 | + $this->fail(); |
|
283 | + } |
|
284 | 284 | |
285 | - $this->markTestIncomplete('method has no implementation'); |
|
286 | - |
|
287 | - } |
|
288 | - |
|
289 | - |
|
290 | - public function testget_list_view_data() |
|
291 | - { |
|
292 | - $scheduler = new Scheduler(); |
|
293 | - |
|
294 | - //preset required attributes |
|
295 | - $scheduler->job_interval = "0::3::*::*::*"; |
|
296 | - $scheduler->date_time_start = "2015-01-01 10:30:01"; |
|
297 | - $scheduler->name = "test"; |
|
298 | - $scheduler->created_by = 1; |
|
299 | - $scheduler->modified_user_id = 1; |
|
300 | - |
|
301 | - $expected = array ( |
|
302 | - 'DELETED' => '0', |
|
303 | - 'CREATED_BY' => 1, |
|
304 | - 'MODIFIED_USER_ID' => 1, |
|
305 | - 'NAME' => 'test', |
|
306 | - 'DATE_TIME_START' => '2015-01-01 10:30:01', |
|
307 | - 'JOB_INTERVAL' => '03:00', |
|
308 | - 'CATCH_UP' => '1', |
|
309 | - 'ENCODED_NAME' => 'test', |
|
310 | - 'DATE_TIME_END' => NULL, |
|
311 | - ); |
|
312 | - |
|
313 | - $actual = $scheduler->get_list_view_data(); |
|
314 | - $this->assertSame($expected ,$actual); |
|
315 | - |
|
316 | - } |
|
285 | + $this->markTestIncomplete('method has no implementation'); |
|
286 | + |
|
287 | + } |
|
288 | + |
|
289 | + |
|
290 | + public function testget_list_view_data() |
|
291 | + { |
|
292 | + $scheduler = new Scheduler(); |
|
293 | + |
|
294 | + //preset required attributes |
|
295 | + $scheduler->job_interval = "0::3::*::*::*"; |
|
296 | + $scheduler->date_time_start = "2015-01-01 10:30:01"; |
|
297 | + $scheduler->name = "test"; |
|
298 | + $scheduler->created_by = 1; |
|
299 | + $scheduler->modified_user_id = 1; |
|
300 | + |
|
301 | + $expected = array ( |
|
302 | + 'DELETED' => '0', |
|
303 | + 'CREATED_BY' => 1, |
|
304 | + 'MODIFIED_USER_ID' => 1, |
|
305 | + 'NAME' => 'test', |
|
306 | + 'DATE_TIME_START' => '2015-01-01 10:30:01', |
|
307 | + 'JOB_INTERVAL' => '03:00', |
|
308 | + 'CATCH_UP' => '1', |
|
309 | + 'ENCODED_NAME' => 'test', |
|
310 | + 'DATE_TIME_END' => NULL, |
|
311 | + ); |
|
312 | + |
|
313 | + $actual = $scheduler->get_list_view_data(); |
|
314 | + $this->assertSame($expected ,$actual); |
|
315 | + |
|
316 | + } |
|
317 | 317 | |
318 | 318 | |
319 | 319 | |
320 | - public function testget_summary_text() |
|
321 | - { |
|
320 | + public function testget_summary_text() |
|
321 | + { |
|
322 | 322 | |
323 | - $scheduler = new Scheduler(); |
|
323 | + $scheduler = new Scheduler(); |
|
324 | 324 | |
325 | - //test without setting name |
|
326 | - $this->assertEquals(Null,$scheduler->get_summary_text()); |
|
325 | + //test without setting name |
|
326 | + $this->assertEquals(Null,$scheduler->get_summary_text()); |
|
327 | 327 | |
328 | - //test with name set |
|
329 | - $scheduler->name = "test"; |
|
330 | - $this->assertEquals('test',$scheduler->get_summary_text()); |
|
328 | + //test with name set |
|
329 | + $scheduler->name = "test"; |
|
330 | + $this->assertEquals('test',$scheduler->get_summary_text()); |
|
331 | 331 | |
332 | - } |
|
332 | + } |
|
333 | 333 | |
334 | - public function testgetJobsList() |
|
335 | - { |
|
336 | - $result = Scheduler::getJobsList(); |
|
337 | - $this->assertTrue(is_array($result)); |
|
334 | + public function testgetJobsList() |
|
335 | + { |
|
336 | + $result = Scheduler::getJobsList(); |
|
337 | + $this->assertTrue(is_array($result)); |
|
338 | 338 | |
339 | - } |
|
339 | + } |
|
340 | 340 | |
341 | 341 | } |
342 | 342 | \ No newline at end of file |
@@ -4,176 +4,176 @@ discard block |
||
4 | 4 | class CampaignTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | 6 | |
7 | - public function testCampaign() { |
|
7 | + public function testCampaign() { |
|
8 | 8 | |
9 | - //execute the contructor and check for the Object type and attributes |
|
10 | - $campaign = new Campaign(); |
|
11 | - $this->assertInstanceOf('Campaign',$campaign); |
|
12 | - $this->assertInstanceOf('SugarBean',$campaign); |
|
9 | + //execute the contructor and check for the Object type and attributes |
|
10 | + $campaign = new Campaign(); |
|
11 | + $this->assertInstanceOf('Campaign',$campaign); |
|
12 | + $this->assertInstanceOf('SugarBean',$campaign); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('Campaigns', 'module_dir', $campaign); |
|
15 | - $this->assertAttributeEquals('Campaign', 'object_name', $campaign); |
|
16 | - $this->assertAttributeEquals('campaigns', 'table_name', $campaign); |
|
17 | - $this->assertAttributeEquals(true, 'new_schema', $campaign); |
|
18 | - $this->assertAttributeEquals(true, 'importable', $campaign); |
|
14 | + $this->assertAttributeEquals('Campaigns', 'module_dir', $campaign); |
|
15 | + $this->assertAttributeEquals('Campaign', 'object_name', $campaign); |
|
16 | + $this->assertAttributeEquals('campaigns', 'table_name', $campaign); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $campaign); |
|
18 | + $this->assertAttributeEquals(true, 'importable', $campaign); |
|
19 | 19 | |
20 | - } |
|
20 | + } |
|
21 | 21 | |
22 | - public function testlist_view_parse_additional_sections() { |
|
22 | + public function testlist_view_parse_additional_sections() { |
|
23 | 23 | |
24 | - error_reporting(E_ERROR | E_PARSE); |
|
24 | + error_reporting(E_ERROR | E_PARSE); |
|
25 | 25 | |
26 | - $campaign = new Campaign(); |
|
26 | + $campaign = new Campaign(); |
|
27 | 27 | |
28 | - //test with attributes preset and verify template variables are set accordingly |
|
29 | - $tpl = new Sugar_Smarty(); |
|
30 | - $campaign->list_view_parse_additional_sections($tpl); |
|
31 | - $this->assertEquals("" ,$tpl->_tpl_vars['ASSIGNED_USER_NAME']); |
|
28 | + //test with attributes preset and verify template variables are set accordingly |
|
29 | + $tpl = new Sugar_Smarty(); |
|
30 | + $campaign->list_view_parse_additional_sections($tpl); |
|
31 | + $this->assertEquals("" ,$tpl->_tpl_vars['ASSIGNED_USER_NAME']); |
|
32 | 32 | |
33 | - } |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - public function testget_summary_text() |
|
37 | - { |
|
38 | - $campaign = new Campaign(); |
|
36 | + public function testget_summary_text() |
|
37 | + { |
|
38 | + $campaign = new Campaign(); |
|
39 | 39 | |
40 | - //test without setting name |
|
41 | - $this->assertEquals(Null,$campaign->get_summary_text()); |
|
40 | + //test without setting name |
|
41 | + $this->assertEquals(Null,$campaign->get_summary_text()); |
|
42 | 42 | |
43 | - //test with name set |
|
44 | - $campaign->name = "test"; |
|
45 | - $this->assertEquals('test',$campaign->get_summary_text()); |
|
43 | + //test with name set |
|
44 | + $campaign->name = "test"; |
|
45 | + $this->assertEquals('test',$campaign->get_summary_text()); |
|
46 | 46 | |
47 | 47 | |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | - public function testcreate_export_query() |
|
51 | - { |
|
50 | + public function testcreate_export_query() |
|
51 | + { |
|
52 | 52 | |
53 | - $campaign = new Campaign(); |
|
53 | + $campaign = new Campaign(); |
|
54 | 54 | |
55 | - //test with empty string params |
|
56 | - $expected = "SELECT\n campaigns.*,\n users.user_name as assigned_user_name FROM campaigns LEFT JOIN users\n ON campaigns.assigned_user_id=users.id where campaigns.deleted=0 ORDER BY campaigns.name"; |
|
57 | - $actual = $campaign->create_export_query('',''); |
|
58 | - $this->assertSame($expected,$actual); |
|
55 | + //test with empty string params |
|
56 | + $expected = "SELECT\n campaigns.*,\n users.user_name as assigned_user_name FROM campaigns LEFT JOIN users\n ON campaigns.assigned_user_id=users.id where campaigns.deleted=0 ORDER BY campaigns.name"; |
|
57 | + $actual = $campaign->create_export_query('',''); |
|
58 | + $this->assertSame($expected,$actual); |
|
59 | 59 | |
60 | 60 | |
61 | - //test with valid string params |
|
62 | - $expected = "SELECT\n campaigns.*,\n users.user_name as assigned_user_name FROM campaigns LEFT JOIN users\n ON campaigns.assigned_user_id=users.id where campaigns.name=\"\" AND campaigns.deleted=0 ORDER BY campaigns.id"; |
|
63 | - $actual = $campaign->create_export_query('campaigns.id','campaigns.name=""'); |
|
64 | - $this->assertSame($expected,$actual); |
|
61 | + //test with valid string params |
|
62 | + $expected = "SELECT\n campaigns.*,\n users.user_name as assigned_user_name FROM campaigns LEFT JOIN users\n ON campaigns.assigned_user_id=users.id where campaigns.name=\"\" AND campaigns.deleted=0 ORDER BY campaigns.id"; |
|
63 | + $actual = $campaign->create_export_query('campaigns.id','campaigns.name=""'); |
|
64 | + $this->assertSame($expected,$actual); |
|
65 | 65 | |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | 68 | |
69 | - public function testclear_campaign_prospect_list_relationship() |
|
70 | - { |
|
71 | - $campaign = new Campaign(); |
|
69 | + public function testclear_campaign_prospect_list_relationship() |
|
70 | + { |
|
71 | + $campaign = new Campaign(); |
|
72 | 72 | |
73 | - //execute the method and test if it works and does not throws an exception. |
|
74 | - try { |
|
75 | - $campaign->clear_campaign_prospect_list_relationship(''); |
|
76 | - $campaign->clear_campaign_prospect_list_relationship('1'); |
|
77 | - $this->assertTrue(true); |
|
78 | - } |
|
79 | - catch (Exception $e) { |
|
80 | - $this->fail(); |
|
81 | - } |
|
73 | + //execute the method and test if it works and does not throws an exception. |
|
74 | + try { |
|
75 | + $campaign->clear_campaign_prospect_list_relationship(''); |
|
76 | + $campaign->clear_campaign_prospect_list_relationship('1'); |
|
77 | + $this->assertTrue(true); |
|
78 | + } |
|
79 | + catch (Exception $e) { |
|
80 | + $this->fail(); |
|
81 | + } |
|
82 | 82 | |
83 | 83 | |
84 | - } |
|
84 | + } |
|
85 | 85 | |
86 | - public function testmark_relationships_deleted() |
|
87 | - { |
|
86 | + public function testmark_relationships_deleted() |
|
87 | + { |
|
88 | 88 | |
89 | - $campaign = new Campaign(); |
|
89 | + $campaign = new Campaign(); |
|
90 | 90 | |
91 | - //execute the method and test if it works and does not throws an exception. |
|
92 | - try { |
|
93 | - $campaign->mark_relationships_deleted(''); |
|
94 | - $campaign->mark_relationships_deleted('1'); |
|
95 | - $this->assertTrue(true); |
|
96 | - } |
|
97 | - catch (Exception $e) { |
|
98 | - $this->fail(); |
|
99 | - } |
|
91 | + //execute the method and test if it works and does not throws an exception. |
|
92 | + try { |
|
93 | + $campaign->mark_relationships_deleted(''); |
|
94 | + $campaign->mark_relationships_deleted('1'); |
|
95 | + $this->assertTrue(true); |
|
96 | + } |
|
97 | + catch (Exception $e) { |
|
98 | + $this->fail(); |
|
99 | + } |
|
100 | 100 | |
101 | 101 | |
102 | - } |
|
102 | + } |
|
103 | 103 | |
104 | - public function testfill_in_additional_list_fields() |
|
105 | - { |
|
104 | + public function testfill_in_additional_list_fields() |
|
105 | + { |
|
106 | 106 | |
107 | - $campaign = new Campaign(); |
|
107 | + $campaign = new Campaign(); |
|
108 | 108 | |
109 | - //execute the method and test if it works and does not throws an exception. |
|
110 | - try { |
|
111 | - $campaign->fill_in_additional_list_fields(); |
|
112 | - $this->assertTrue(true); |
|
113 | - } |
|
114 | - catch (Exception $e) { |
|
115 | - $this->fail(); |
|
116 | - } |
|
109 | + //execute the method and test if it works and does not throws an exception. |
|
110 | + try { |
|
111 | + $campaign->fill_in_additional_list_fields(); |
|
112 | + $this->assertTrue(true); |
|
113 | + } |
|
114 | + catch (Exception $e) { |
|
115 | + $this->fail(); |
|
116 | + } |
|
117 | 117 | |
118 | 118 | |
119 | - } |
|
119 | + } |
|
120 | 120 | |
121 | - public function testfill_in_additional_detail_fields() |
|
122 | - { |
|
121 | + public function testfill_in_additional_detail_fields() |
|
122 | + { |
|
123 | 123 | |
124 | - $campaign = new Campaign(); |
|
124 | + $campaign = new Campaign(); |
|
125 | 125 | |
126 | - //execute the method and test if it works and does not throws an exception. |
|
127 | - try { |
|
128 | - $campaign->fill_in_additional_detail_fields(); |
|
129 | - $this->assertTrue(true); |
|
130 | - } |
|
131 | - catch (Exception $e) { |
|
132 | - $this->fail(); |
|
133 | - } |
|
126 | + //execute the method and test if it works and does not throws an exception. |
|
127 | + try { |
|
128 | + $campaign->fill_in_additional_detail_fields(); |
|
129 | + $this->assertTrue(true); |
|
130 | + } |
|
131 | + catch (Exception $e) { |
|
132 | + $this->fail(); |
|
133 | + } |
|
134 | 134 | |
135 | 135 | |
136 | - } |
|
136 | + } |
|
137 | 137 | |
138 | 138 | |
139 | - public function testupdate_currency_id() |
|
140 | - { |
|
141 | - $campaign = new Campaign(); |
|
139 | + public function testupdate_currency_id() |
|
140 | + { |
|
141 | + $campaign = new Campaign(); |
|
142 | 142 | |
143 | - //execute the method and test if it works and does not throws an exception. |
|
144 | - try { |
|
145 | - $campaign->update_currency_id('',''); |
|
146 | - $this->assertTrue(true); |
|
147 | - } |
|
148 | - catch (Exception $e) { |
|
149 | - $this->fail(); |
|
150 | - } |
|
143 | + //execute the method and test if it works and does not throws an exception. |
|
144 | + try { |
|
145 | + $campaign->update_currency_id('',''); |
|
146 | + $this->assertTrue(true); |
|
147 | + } |
|
148 | + catch (Exception $e) { |
|
149 | + $this->fail(); |
|
150 | + } |
|
151 | 151 | |
152 | 152 | |
153 | - } |
|
153 | + } |
|
154 | 154 | |
155 | 155 | |
156 | - public function testget_list_view_data() |
|
157 | - { |
|
158 | - $campaign = new Campaign(); |
|
159 | - |
|
160 | - //execute the method and verify that it retunrs expected results |
|
161 | - |
|
162 | - $expected = array ( |
|
163 | - 'DELETED' => 0, |
|
164 | - 'TRACKER_COUNT' => '0', |
|
165 | - 'REFER_URL' => 'http://', |
|
166 | - 'IMPRESSIONS' => '0', |
|
167 | - 'OPTIONAL_LINK' => 'display:none', |
|
168 | - 'TRACK_CAMPAIGN_TITLE' => 'View Status', |
|
169 | - 'TRACK_CAMPAIGN_IMAGE' => '~'.preg_quote('themes/SuiteR/images/view_status.gif?v=').'[\w-]+~', |
|
170 | - 'LAUNCH_WIZARD_TITLE' => 'Launch Wizard', |
|
171 | - 'LAUNCH_WIZARD_IMAGE' => '~'.preg_quote('themes/SuiteR/images/edit_wizard.gif?v=').'[\w-]+~', |
|
172 | - 'TRACK_VIEW_ALT_TEXT' => 'View Status', |
|
173 | - 'LAUNCH_WIZ_ALT_TEXT' => 'Launch Wizard', |
|
174 | - ); |
|
175 | - |
|
176 | - $actual = $campaign->get_list_view_data(); |
|
156 | + public function testget_list_view_data() |
|
157 | + { |
|
158 | + $campaign = new Campaign(); |
|
159 | + |
|
160 | + //execute the method and verify that it retunrs expected results |
|
161 | + |
|
162 | + $expected = array ( |
|
163 | + 'DELETED' => 0, |
|
164 | + 'TRACKER_COUNT' => '0', |
|
165 | + 'REFER_URL' => 'http://', |
|
166 | + 'IMPRESSIONS' => '0', |
|
167 | + 'OPTIONAL_LINK' => 'display:none', |
|
168 | + 'TRACK_CAMPAIGN_TITLE' => 'View Status', |
|
169 | + 'TRACK_CAMPAIGN_IMAGE' => '~'.preg_quote('themes/SuiteR/images/view_status.gif?v=').'[\w-]+~', |
|
170 | + 'LAUNCH_WIZARD_TITLE' => 'Launch Wizard', |
|
171 | + 'LAUNCH_WIZARD_IMAGE' => '~'.preg_quote('themes/SuiteR/images/edit_wizard.gif?v=').'[\w-]+~', |
|
172 | + 'TRACK_VIEW_ALT_TEXT' => 'View Status', |
|
173 | + 'LAUNCH_WIZ_ALT_TEXT' => 'Launch Wizard', |
|
174 | + ); |
|
175 | + |
|
176 | + $actual = $campaign->get_list_view_data(); |
|
177 | 177 | foreach($expected as $expectedKey => $expectedVal){ |
178 | 178 | if($expectedKey == 'LAUNCH_WIZARD_IMAGE' || $expectedKey == 'TRACK_CAMPAIGN_IMAGE'){ |
179 | 179 | $this->assertRegExp($expected[$expectedKey],$actual[$expectedKey]); |
@@ -181,153 +181,153 @@ discard block |
||
181 | 181 | $this->assertSame($expected[$expectedKey], $actual[$expectedKey]); |
182 | 182 | } |
183 | 183 | } |
184 | - } |
|
184 | + } |
|
185 | 185 | |
186 | 186 | |
187 | - public function testbuild_generic_where_clause() |
|
188 | - { |
|
187 | + public function testbuild_generic_where_clause() |
|
188 | + { |
|
189 | 189 | |
190 | - $campaign = new Campaign(); |
|
190 | + $campaign = new Campaign(); |
|
191 | 191 | |
192 | - //test with blank parameter |
|
193 | - $expected = "campaigns.name like '%'"; |
|
194 | - $actual = $campaign->build_generic_where_clause (""); |
|
195 | - $this->assertSame($expected,$actual); |
|
192 | + //test with blank parameter |
|
193 | + $expected = "campaigns.name like '%'"; |
|
194 | + $actual = $campaign->build_generic_where_clause (""); |
|
195 | + $this->assertSame($expected,$actual); |
|
196 | 196 | |
197 | - //test with valid parameter |
|
198 | - $expected = "campaigns.name like '1%'"; |
|
199 | - $actual = $campaign->build_generic_where_clause (1); |
|
200 | - $this->assertSame($expected,$actual); |
|
197 | + //test with valid parameter |
|
198 | + $expected = "campaigns.name like '1%'"; |
|
199 | + $actual = $campaign->build_generic_where_clause (1); |
|
200 | + $this->assertSame($expected,$actual); |
|
201 | 201 | |
202 | - } |
|
202 | + } |
|
203 | 203 | |
204 | - public function testSaveAndMarkDeleted() |
|
205 | - { |
|
204 | + public function testSaveAndMarkDeleted() |
|
205 | + { |
|
206 | 206 | |
207 | - $campaign = new Campaign(); |
|
208 | - $campaign->name = "test"; |
|
209 | - $campaign->amount = 100; |
|
207 | + $campaign = new Campaign(); |
|
208 | + $campaign->name = "test"; |
|
209 | + $campaign->amount = 100; |
|
210 | 210 | |
211 | 211 | |
212 | - $campaign->save(); |
|
212 | + $campaign->save(); |
|
213 | 213 | |
214 | - //test for record ID to verify that record is saved |
|
215 | - $this->assertTrue(isset($campaign->id)); |
|
216 | - $this->assertEquals(36, strlen($campaign->id)); |
|
214 | + //test for record ID to verify that record is saved |
|
215 | + $this->assertTrue(isset($campaign->id)); |
|
216 | + $this->assertEquals(36, strlen($campaign->id)); |
|
217 | 217 | |
218 | 218 | |
219 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
220 | - $campaign->mark_deleted($campaign->id); |
|
221 | - $result = $campaign->retrieve($campaign->id); |
|
222 | - $this->assertEquals(null,$result); |
|
219 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
220 | + $campaign->mark_deleted($campaign->id); |
|
221 | + $result = $campaign->retrieve($campaign->id); |
|
222 | + $this->assertEquals(null,$result); |
|
223 | 223 | |
224 | - } |
|
224 | + } |
|
225 | 225 | |
226 | 226 | |
227 | - public function testset_notification_body() |
|
228 | - { |
|
229 | - $campaign = new Campaign(); |
|
230 | - |
|
231 | - //test with attributes preset and verify template variables are set accordingly |
|
232 | - $campaign->name = "test"; |
|
233 | - $campaign->budget = "1000"; |
|
234 | - $campaign->end_date = "10/01/2015"; |
|
235 | - $campaign->status = "Planned"; |
|
236 | - $campaign->content = "some text"; |
|
227 | + public function testset_notification_body() |
|
228 | + { |
|
229 | + $campaign = new Campaign(); |
|
230 | + |
|
231 | + //test with attributes preset and verify template variables are set accordingly |
|
232 | + $campaign->name = "test"; |
|
233 | + $campaign->budget = "1000"; |
|
234 | + $campaign->end_date = "10/01/2015"; |
|
235 | + $campaign->status = "Planned"; |
|
236 | + $campaign->content = "some text"; |
|
237 | 237 | |
238 | - $result = $campaign->set_notification_body(new Sugar_Smarty(), $campaign); |
|
238 | + $result = $campaign->set_notification_body(new Sugar_Smarty(), $campaign); |
|
239 | 239 | |
240 | - $this->assertEquals($campaign->name ,$result->_tpl_vars['CAMPAIGN_NAME']); |
|
241 | - $this->assertEquals($campaign->budget ,$result->_tpl_vars['CAMPAIGN_AMOUNT']); |
|
242 | - $this->assertEquals($campaign->end_date ,$result->_tpl_vars['CAMPAIGN_CLOSEDATE']); |
|
243 | - $this->assertEquals($campaign->status ,$result->_tpl_vars['CAMPAIGN_STATUS']); |
|
244 | - $this->assertEquals($campaign->content ,$result->_tpl_vars['CAMPAIGN_DESCRIPTION']); |
|
240 | + $this->assertEquals($campaign->name ,$result->_tpl_vars['CAMPAIGN_NAME']); |
|
241 | + $this->assertEquals($campaign->budget ,$result->_tpl_vars['CAMPAIGN_AMOUNT']); |
|
242 | + $this->assertEquals($campaign->end_date ,$result->_tpl_vars['CAMPAIGN_CLOSEDATE']); |
|
243 | + $this->assertEquals($campaign->status ,$result->_tpl_vars['CAMPAIGN_STATUS']); |
|
244 | + $this->assertEquals($campaign->content ,$result->_tpl_vars['CAMPAIGN_DESCRIPTION']); |
|
245 | 245 | |
246 | - } |
|
246 | + } |
|
247 | 247 | |
248 | 248 | public function testtrack_log_leads() |
249 | 249 | { |
250 | - $campaign = new Campaign(); |
|
250 | + $campaign = new Campaign(); |
|
251 | 251 | |
252 | - $expected = "SELECT campaign_log.* FROM campaign_log WHERE campaign_log.campaign_id = '' AND campaign_log.deleted=0 AND activity_type = 'lead' AND archived = 0 AND target_id IS NOT NULL "; |
|
253 | - $actual = $campaign->track_log_leads(); |
|
254 | - $this->assertSame($expected,$actual); |
|
252 | + $expected = "SELECT campaign_log.* FROM campaign_log WHERE campaign_log.campaign_id = '' AND campaign_log.deleted=0 AND activity_type = 'lead' AND archived = 0 AND target_id IS NOT NULL "; |
|
253 | + $actual = $campaign->track_log_leads(); |
|
254 | + $this->assertSame($expected,$actual); |
|
255 | 255 | |
256 | 256 | } |
257 | 257 | |
258 | - public function testtrack_log_entries() |
|
259 | - { |
|
260 | - $campaign = new Campaign(); |
|
258 | + public function testtrack_log_entries() |
|
259 | + { |
|
260 | + $campaign = new Campaign(); |
|
261 | 261 | |
262 | - //test without parameters |
|
263 | - $expected = "SELECT campaign_log.* FROM campaign_log WHERE campaign_log.campaign_id = '' AND campaign_log.deleted=0 AND activity_type='targeted' AND archived=0 "; |
|
264 | - $actual = $campaign->track_log_entries(); |
|
265 | - $this->assertSame($expected,$actual); |
|
262 | + //test without parameters |
|
263 | + $expected = "SELECT campaign_log.* FROM campaign_log WHERE campaign_log.campaign_id = '' AND campaign_log.deleted=0 AND activity_type='targeted' AND archived=0 "; |
|
264 | + $actual = $campaign->track_log_entries(); |
|
265 | + $this->assertSame($expected,$actual); |
|
266 | 266 | |
267 | - //test with parameters |
|
268 | - $expected = "SELECT campaign_log.* FROM campaign_log WHERE campaign_log.campaign_id = '' AND campaign_log.deleted=0 AND activity_type='test1' AND archived=0 "; |
|
269 | - $actual = $campaign->track_log_entries(array('test1','test2')); |
|
270 | - $this->assertSame($expected,$actual); |
|
267 | + //test with parameters |
|
268 | + $expected = "SELECT campaign_log.* FROM campaign_log WHERE campaign_log.campaign_id = '' AND campaign_log.deleted=0 AND activity_type='test1' AND archived=0 "; |
|
269 | + $actual = $campaign->track_log_entries(array('test1','test2')); |
|
270 | + $this->assertSame($expected,$actual); |
|
271 | 271 | |
272 | - } |
|
272 | + } |
|
273 | 273 | |
274 | 274 | |
275 | - public function testget_queue_items() |
|
276 | - { |
|
277 | - $campaign = new Campaign(); |
|
275 | + public function testget_queue_items() |
|
276 | + { |
|
277 | + $campaign = new Campaign(); |
|
278 | 278 | |
279 | - //without parameters |
|
280 | - $expected = "SELECT emailman.* ,\n campaigns.name as campaign_name,\n email_marketing.name as message_name,\n (CASE related_type\n WHEN 'Contacts' THEN LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),' ',IFNULL(contacts.last_name,''))))\n WHEN 'Leads' THEN LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,''))))\n WHEN 'Accounts' THEN accounts.name\n WHEN 'Users' THEN LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,''))))\n WHEN 'Prospects' THEN LTRIM(RTRIM(CONCAT(IFNULL(prospects.first_name,''),' ',IFNULL(prospects.last_name,''))))\n END) recipient_name FROM emailman\n LEFT JOIN users ON users.id = emailman.related_id and emailman.related_type ='Users'\n LEFT JOIN contacts ON contacts.id = emailman.related_id and emailman.related_type ='Contacts'\n LEFT JOIN leads ON leads.id = emailman.related_id and emailman.related_type ='Leads'\n LEFT JOIN accounts ON accounts.id = emailman.related_id and emailman.related_type ='Accounts'\n LEFT JOIN prospects ON prospects.id = emailman.related_id and emailman.related_type ='Prospects'\n LEFT JOIN prospect_lists ON prospect_lists.id = emailman.list_id\n LEFT JOIN email_addr_bean_rel ON email_addr_bean_rel.bean_id = emailman.related_id and emailman.related_type = email_addr_bean_rel.bean_module and email_addr_bean_rel.primary_address = 1 and email_addr_bean_rel.deleted=0\n LEFT JOIN campaigns ON campaigns.id = emailman.campaign_id\n LEFT JOIN email_marketing ON email_marketing.id = emailman.marketing_id WHERE emailman.campaign_id = '' AND emailman.deleted=0 AND emailman.deleted=0"; |
|
281 | - $actual = $campaign->get_queue_items(); |
|
282 | - $this->assertSame($expected,$actual); |
|
279 | + //without parameters |
|
280 | + $expected = "SELECT emailman.* ,\n campaigns.name as campaign_name,\n email_marketing.name as message_name,\n (CASE related_type\n WHEN 'Contacts' THEN LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),' ',IFNULL(contacts.last_name,''))))\n WHEN 'Leads' THEN LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,''))))\n WHEN 'Accounts' THEN accounts.name\n WHEN 'Users' THEN LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,''))))\n WHEN 'Prospects' THEN LTRIM(RTRIM(CONCAT(IFNULL(prospects.first_name,''),' ',IFNULL(prospects.last_name,''))))\n END) recipient_name FROM emailman\n LEFT JOIN users ON users.id = emailman.related_id and emailman.related_type ='Users'\n LEFT JOIN contacts ON contacts.id = emailman.related_id and emailman.related_type ='Contacts'\n LEFT JOIN leads ON leads.id = emailman.related_id and emailman.related_type ='Leads'\n LEFT JOIN accounts ON accounts.id = emailman.related_id and emailman.related_type ='Accounts'\n LEFT JOIN prospects ON prospects.id = emailman.related_id and emailman.related_type ='Prospects'\n LEFT JOIN prospect_lists ON prospect_lists.id = emailman.list_id\n LEFT JOIN email_addr_bean_rel ON email_addr_bean_rel.bean_id = emailman.related_id and emailman.related_type = email_addr_bean_rel.bean_module and email_addr_bean_rel.primary_address = 1 and email_addr_bean_rel.deleted=0\n LEFT JOIN campaigns ON campaigns.id = emailman.campaign_id\n LEFT JOIN email_marketing ON email_marketing.id = emailman.marketing_id WHERE emailman.campaign_id = '' AND emailman.deleted=0 AND emailman.deleted=0"; |
|
281 | + $actual = $campaign->get_queue_items(); |
|
282 | + $this->assertSame($expected,$actual); |
|
283 | 283 | |
284 | - //with parameters |
|
285 | - $expected = "SELECT emailman.* ,\n campaigns.name as campaign_name,\n email_marketing.name as message_name,\n (CASE related_type\n WHEN 'Contacts' THEN LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),' ',IFNULL(contacts.last_name,''))))\n WHEN 'Leads' THEN LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,''))))\n WHEN 'Accounts' THEN accounts.name\n WHEN 'Users' THEN LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,''))))\n WHEN 'Prospects' THEN LTRIM(RTRIM(CONCAT(IFNULL(prospects.first_name,''),' ',IFNULL(prospects.last_name,''))))\n END) recipient_name FROM emailman\n LEFT JOIN users ON users.id = emailman.related_id and emailman.related_type ='Users'\n LEFT JOIN contacts ON contacts.id = emailman.related_id and emailman.related_type ='Contacts'\n LEFT JOIN leads ON leads.id = emailman.related_id and emailman.related_type ='Leads'\n LEFT JOIN accounts ON accounts.id = emailman.related_id and emailman.related_type ='Accounts'\n LEFT JOIN prospects ON prospects.id = emailman.related_id and emailman.related_type ='Prospects'\n LEFT JOIN prospect_lists ON prospect_lists.id = emailman.list_id\n LEFT JOIN email_addr_bean_rel ON email_addr_bean_rel.bean_id = emailman.related_id and emailman.related_type = email_addr_bean_rel.bean_module and email_addr_bean_rel.primary_address = 1 and email_addr_bean_rel.deleted=0\n LEFT JOIN campaigns ON campaigns.id = emailman.campaign_id\n LEFT JOIN email_marketing ON email_marketing.id = emailman.marketing_id INNER JOIN (select min(id) as id from emailman em GROUP BY users.id ) secondary\n on emailman.id = secondary.id WHERE emailman.campaign_id = '' AND emailman.deleted=0 AND marketing_id ='1' AND emailman.deleted=0"; |
|
286 | - $actual = $campaign->get_queue_items(array("EMAIL_MARKETING_ID_VALUE"=>1,"group_by"=>"users.id")); |
|
287 | - $this->assertSame($expected,$actual); |
|
284 | + //with parameters |
|
285 | + $expected = "SELECT emailman.* ,\n campaigns.name as campaign_name,\n email_marketing.name as message_name,\n (CASE related_type\n WHEN 'Contacts' THEN LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),' ',IFNULL(contacts.last_name,''))))\n WHEN 'Leads' THEN LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,''))))\n WHEN 'Accounts' THEN accounts.name\n WHEN 'Users' THEN LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,''))))\n WHEN 'Prospects' THEN LTRIM(RTRIM(CONCAT(IFNULL(prospects.first_name,''),' ',IFNULL(prospects.last_name,''))))\n END) recipient_name FROM emailman\n LEFT JOIN users ON users.id = emailman.related_id and emailman.related_type ='Users'\n LEFT JOIN contacts ON contacts.id = emailman.related_id and emailman.related_type ='Contacts'\n LEFT JOIN leads ON leads.id = emailman.related_id and emailman.related_type ='Leads'\n LEFT JOIN accounts ON accounts.id = emailman.related_id and emailman.related_type ='Accounts'\n LEFT JOIN prospects ON prospects.id = emailman.related_id and emailman.related_type ='Prospects'\n LEFT JOIN prospect_lists ON prospect_lists.id = emailman.list_id\n LEFT JOIN email_addr_bean_rel ON email_addr_bean_rel.bean_id = emailman.related_id and emailman.related_type = email_addr_bean_rel.bean_module and email_addr_bean_rel.primary_address = 1 and email_addr_bean_rel.deleted=0\n LEFT JOIN campaigns ON campaigns.id = emailman.campaign_id\n LEFT JOIN email_marketing ON email_marketing.id = emailman.marketing_id INNER JOIN (select min(id) as id from emailman em GROUP BY users.id ) secondary\n on emailman.id = secondary.id WHERE emailman.campaign_id = '' AND emailman.deleted=0 AND marketing_id ='1' AND emailman.deleted=0"; |
|
286 | + $actual = $campaign->get_queue_items(array("EMAIL_MARKETING_ID_VALUE"=>1,"group_by"=>"users.id")); |
|
287 | + $this->assertSame($expected,$actual); |
|
288 | 288 | |
289 | - } |
|
289 | + } |
|
290 | 290 | |
291 | 291 | |
292 | - public function testbean_implements() |
|
293 | - { |
|
294 | - $campaign = new Campaign(); |
|
295 | - $this->assertEquals(false, $campaign->bean_implements('')); //test with blank value |
|
296 | - $this->assertEquals(false, $campaign->bean_implements('test')); //test with invalid value |
|
297 | - $this->assertEquals(true, $campaign->bean_implements('ACL')); //test with valid value |
|
292 | + public function testbean_implements() |
|
293 | + { |
|
294 | + $campaign = new Campaign(); |
|
295 | + $this->assertEquals(false, $campaign->bean_implements('')); //test with blank value |
|
296 | + $this->assertEquals(false, $campaign->bean_implements('test')); //test with invalid value |
|
297 | + $this->assertEquals(true, $campaign->bean_implements('ACL')); //test with valid value |
|
298 | 298 | |
299 | - } |
|
299 | + } |
|
300 | 300 | |
301 | 301 | |
302 | 302 | |
303 | 303 | public function testcreate_list_count_query() |
304 | 304 | { |
305 | 305 | |
306 | - $campaign = new Campaign(); |
|
306 | + $campaign = new Campaign(); |
|
307 | 307 | |
308 | - //test without parameters |
|
309 | - $expected = ""; |
|
310 | - $actual = $campaign->create_list_count_query(''); |
|
311 | - $this->assertSame($expected,$actual); |
|
312 | - |
|
313 | - //test with query parameters |
|
314 | - $expected = "SELECT count(*) c FROM campaigns"; |
|
315 | - $actual = $campaign->create_list_count_query('select * from campaigns'); |
|
316 | - $this->assertSame($expected,$actual); |
|
317 | - |
|
318 | - //test with distinct |
|
319 | - $expected = "SELECT count(DISTINCT campaigns.id) c FROM campaigns"; |
|
320 | - $actual = $campaign->create_list_count_query('SELECT distinct marketing_id FROM campaigns'); |
|
321 | - $this->assertSame($expected,$actual); |
|
308 | + //test without parameters |
|
309 | + $expected = ""; |
|
310 | + $actual = $campaign->create_list_count_query(''); |
|
311 | + $this->assertSame($expected,$actual); |
|
312 | + |
|
313 | + //test with query parameters |
|
314 | + $expected = "SELECT count(*) c FROM campaigns"; |
|
315 | + $actual = $campaign->create_list_count_query('select * from campaigns'); |
|
316 | + $this->assertSame($expected,$actual); |
|
317 | + |
|
318 | + //test with distinct |
|
319 | + $expected = "SELECT count(DISTINCT campaigns.id) c FROM campaigns"; |
|
320 | + $actual = $campaign->create_list_count_query('SELECT distinct marketing_id FROM campaigns'); |
|
321 | + $this->assertSame($expected,$actual); |
|
322 | 322 | |
323 | 323 | } |
324 | 324 | |
325 | 325 | |
326 | 326 | public function testgetDeletedCampaignLogLeadsCount() |
327 | 327 | { |
328 | - $campaign = new Campaign(); |
|
329 | - $result = $campaign->getDeletedCampaignLogLeadsCount(); |
|
330 | - $this->assertEquals(0,$result); |
|
328 | + $campaign = new Campaign(); |
|
329 | + $result = $campaign->getDeletedCampaignLogLeadsCount(); |
|
330 | + $this->assertEquals(0,$result); |
|
331 | 331 | |
332 | 332 | } |
333 | 333 |
@@ -3,184 +3,184 @@ |
||
3 | 3 | class EmployeeTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | 5 | |
6 | - public function testEmployee() { |
|
6 | + public function testEmployee() { |
|
7 | 7 | |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $employee = new Employee(); |
|
10 | - $this->assertInstanceOf('Employee',$employee); |
|
11 | - $this->assertInstanceOf('Person',$employee); |
|
12 | - $this->assertInstanceOf('SugarBean',$employee); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $employee = new Employee(); |
|
10 | + $this->assertInstanceOf('Employee',$employee); |
|
11 | + $this->assertInstanceOf('Person',$employee); |
|
12 | + $this->assertInstanceOf('SugarBean',$employee); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('Employees', 'module_dir', $employee); |
|
15 | - $this->assertAttributeEquals('Employee', 'object_name', $employee); |
|
16 | - $this->assertAttributeEquals('users', 'table_name', $employee); |
|
17 | - $this->assertAttributeEquals(true, 'new_schema', $employee); |
|
14 | + $this->assertAttributeEquals('Employees', 'module_dir', $employee); |
|
15 | + $this->assertAttributeEquals('Employee', 'object_name', $employee); |
|
16 | + $this->assertAttributeEquals('users', 'table_name', $employee); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $employee); |
|
18 | 18 | |
19 | - } |
|
19 | + } |
|
20 | 20 | |
21 | 21 | |
22 | - public function testget_summary_text() { |
|
22 | + public function testget_summary_text() { |
|
23 | 23 | |
24 | - error_reporting(E_ERROR | E_PARSE); |
|
24 | + error_reporting(E_ERROR | E_PARSE); |
|
25 | 25 | |
26 | - $employee = new Employee(); |
|
26 | + $employee = new Employee(); |
|
27 | 27 | |
28 | - //test without setting name |
|
29 | - $this->assertEquals(' ',$employee->get_summary_text()); |
|
28 | + //test without setting name |
|
29 | + $this->assertEquals(' ',$employee->get_summary_text()); |
|
30 | 30 | |
31 | - //test with name set |
|
32 | - $employee->retrieve(1); |
|
33 | - $this->assertEquals('Administrator',$employee->get_summary_text()); |
|
31 | + //test with name set |
|
32 | + $employee->retrieve(1); |
|
33 | + $this->assertEquals('Administrator',$employee->get_summary_text()); |
|
34 | 34 | |
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | - public function testfill_in_additional_list_fields() { |
|
38 | + public function testfill_in_additional_list_fields() { |
|
39 | 39 | |
40 | - $employee = new Employee(); |
|
40 | + $employee = new Employee(); |
|
41 | 41 | |
42 | - //execute the method and test if it works and does not throws an exception. |
|
43 | - try { |
|
44 | - $employee->fill_in_additional_list_fields(); |
|
45 | - $this->assertTrue(true); |
|
46 | - } |
|
47 | - catch (Exception $e) { |
|
48 | - $this->fail(); |
|
49 | - } |
|
42 | + //execute the method and test if it works and does not throws an exception. |
|
43 | + try { |
|
44 | + $employee->fill_in_additional_list_fields(); |
|
45 | + $this->assertTrue(true); |
|
46 | + } |
|
47 | + catch (Exception $e) { |
|
48 | + $this->fail(); |
|
49 | + } |
|
50 | 50 | |
51 | - } |
|
51 | + } |
|
52 | 52 | |
53 | - public function testfill_in_additional_detail_fields() |
|
54 | - { |
|
55 | - $employee = new Employee(); |
|
53 | + public function testfill_in_additional_detail_fields() |
|
54 | + { |
|
55 | + $employee = new Employee(); |
|
56 | 56 | |
57 | 57 | |
58 | - //test with a empty employee bean |
|
59 | - $employee->fill_in_additional_detail_fields(); |
|
60 | - $this->assertEquals("", $employee->reports_to_name); |
|
58 | + //test with a empty employee bean |
|
59 | + $employee->fill_in_additional_detail_fields(); |
|
60 | + $this->assertEquals("", $employee->reports_to_name); |
|
61 | 61 | |
62 | 62 | |
63 | - //test with a valid employee bean |
|
64 | - $employee->retrieve(1); |
|
65 | - $employee->fill_in_additional_detail_fields(); |
|
66 | - $this->assertEquals("", $employee->reports_to_name); |
|
63 | + //test with a valid employee bean |
|
64 | + $employee->retrieve(1); |
|
65 | + $employee->fill_in_additional_detail_fields(); |
|
66 | + $this->assertEquals("", $employee->reports_to_name); |
|
67 | 67 | |
68 | - } |
|
68 | + } |
|
69 | 69 | |
70 | - public function testretrieve_employee_id() |
|
71 | - { |
|
72 | - $employee = new Employee(); |
|
73 | - //$this->assertEquals('1' ,$employee->retrieve_employee_id('admin')); |
|
70 | + public function testretrieve_employee_id() |
|
71 | + { |
|
72 | + $employee = new Employee(); |
|
73 | + //$this->assertEquals('1' ,$employee->retrieve_employee_id('admin')); |
|
74 | 74 | |
75 | - $this->markTestSkipped('Bug in query: employee_name parameter is wrongly used as user_name'); |
|
75 | + $this->markTestSkipped('Bug in query: employee_name parameter is wrongly used as user_name'); |
|
76 | 76 | |
77 | - } |
|
77 | + } |
|
78 | 78 | |
79 | 79 | |
80 | - public function testverify_data() |
|
81 | - { |
|
82 | - $employee = new Employee(); |
|
83 | - $this->assertEquals(true ,$employee->verify_data() ); |
|
84 | - |
|
85 | - } |
|
86 | - |
|
87 | - public function testget_list_view_data(){ |
|
88 | - |
|
89 | - $employee = new Employee(); |
|
90 | - |
|
91 | - $expected = array ( |
|
92 | - 'SUGAR_LOGIN' => '1', |
|
93 | - 'FULL_NAME' => ' ', |
|
94 | - 'NAME' => ' ', |
|
95 | - 'IS_ADMIN' => '0', |
|
96 | - 'EXTERNAL_AUTH_ONLY' => '0', |
|
97 | - 'RECEIVE_NOTIFICATIONS' => '1', |
|
98 | - 'DELETED' => 0, |
|
99 | - 'PORTAL_ONLY' => '0', |
|
100 | - 'SHOW_ON_EMPLOYEES' => '1', |
|
101 | - 'ENCODED_NAME' => ' ', |
|
102 | - 'EMAIL1' => '', |
|
103 | - 'EMAIL1_LINK' => '<a href=\'javascript:void(0);\' onclick=\'SUGAR.quickCompose.init({"fullComposeUrl":"contact_id=\\u0026parent_type=Employees\\u0026parent_id=\\u0026parent_name=+\\u0026to_addrs_ids=\\u0026to_addrs_names=\\u0026to_addrs_emails=\\u0026to_email_addrs=+%26nbsp%3B%26lt%3B%26gt%3B\\u0026return_module=Employees\\u0026return_action=ListView\\u0026return_id=","composePackage":{"contact_id":"","parent_type":"Employees","parent_id":"","parent_name":" ","to_addrs_ids":"","to_addrs_names":"","to_addrs_emails":"","to_email_addrs":" \\u003C\\u003E","return_module":"Employees","return_action":"ListView","return_id":""}});\' class=\'\'>', |
|
104 | - 'MESSENGER_TYPE' => '', |
|
105 | - 'REPORTS_TO_NAME' => NULL, |
|
106 | - ); |
|
107 | - |
|
108 | - $actual = $employee->get_list_view_data(); |
|
109 | - $this->assertSame($expected, $actual); |
|
80 | + public function testverify_data() |
|
81 | + { |
|
82 | + $employee = new Employee(); |
|
83 | + $this->assertEquals(true ,$employee->verify_data() ); |
|
84 | + |
|
85 | + } |
|
86 | + |
|
87 | + public function testget_list_view_data(){ |
|
88 | + |
|
89 | + $employee = new Employee(); |
|
90 | + |
|
91 | + $expected = array ( |
|
92 | + 'SUGAR_LOGIN' => '1', |
|
93 | + 'FULL_NAME' => ' ', |
|
94 | + 'NAME' => ' ', |
|
95 | + 'IS_ADMIN' => '0', |
|
96 | + 'EXTERNAL_AUTH_ONLY' => '0', |
|
97 | + 'RECEIVE_NOTIFICATIONS' => '1', |
|
98 | + 'DELETED' => 0, |
|
99 | + 'PORTAL_ONLY' => '0', |
|
100 | + 'SHOW_ON_EMPLOYEES' => '1', |
|
101 | + 'ENCODED_NAME' => ' ', |
|
102 | + 'EMAIL1' => '', |
|
103 | + 'EMAIL1_LINK' => '<a href=\'javascript:void(0);\' onclick=\'SUGAR.quickCompose.init({"fullComposeUrl":"contact_id=\\u0026parent_type=Employees\\u0026parent_id=\\u0026parent_name=+\\u0026to_addrs_ids=\\u0026to_addrs_names=\\u0026to_addrs_emails=\\u0026to_email_addrs=+%26nbsp%3B%26lt%3B%26gt%3B\\u0026return_module=Employees\\u0026return_action=ListView\\u0026return_id=","composePackage":{"contact_id":"","parent_type":"Employees","parent_id":"","parent_name":" ","to_addrs_ids":"","to_addrs_names":"","to_addrs_emails":"","to_email_addrs":" \\u003C\\u003E","return_module":"Employees","return_action":"ListView","return_id":""}});\' class=\'\'>', |
|
104 | + 'MESSENGER_TYPE' => '', |
|
105 | + 'REPORTS_TO_NAME' => NULL, |
|
106 | + ); |
|
107 | + |
|
108 | + $actual = $employee->get_list_view_data(); |
|
109 | + $this->assertSame($expected, $actual); |
|
110 | 110 | |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | - public function testlist_view_parse_additional_sections(){ |
|
113 | + public function testlist_view_parse_additional_sections(){ |
|
114 | 114 | |
115 | - $employee = new Employee(); |
|
115 | + $employee = new Employee(); |
|
116 | 116 | |
117 | - //execute the method and test if it works and does not throws an exception. |
|
118 | - try { |
|
119 | - $employee->list_view_parse_additional_sections(new Sugar_Smarty(), $xTemplateSection); |
|
120 | - $this->assertTrue(true); |
|
121 | - } |
|
122 | - catch (Exception $e) { |
|
123 | - $this->fail(); |
|
124 | - } |
|
117 | + //execute the method and test if it works and does not throws an exception. |
|
118 | + try { |
|
119 | + $employee->list_view_parse_additional_sections(new Sugar_Smarty(), $xTemplateSection); |
|
120 | + $this->assertTrue(true); |
|
121 | + } |
|
122 | + catch (Exception $e) { |
|
123 | + $this->fail(); |
|
124 | + } |
|
125 | 125 | |
126 | - } |
|
126 | + } |
|
127 | 127 | |
128 | 128 | |
129 | - public function testcreate_export_query() { |
|
129 | + public function testcreate_export_query() { |
|
130 | 130 | |
131 | - $employee = new Employee(); |
|
131 | + $employee = new Employee(); |
|
132 | 132 | |
133 | - //test with empty string params |
|
134 | - $expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users WHERE users.deleted = 0 ORDER BY users.user_name"; |
|
135 | - $actual = $employee->create_export_query('',''); |
|
136 | - $this->assertSame($expected,$actual); |
|
133 | + //test with empty string params |
|
134 | + $expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users WHERE users.deleted = 0 ORDER BY users.user_name"; |
|
135 | + $actual = $employee->create_export_query('',''); |
|
136 | + $this->assertSame($expected,$actual); |
|
137 | 137 | |
138 | 138 | |
139 | - //test with valid string params |
|
140 | - $expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users WHERE users.user_name=\"\" AND users.deleted = 0 ORDER BY users.id"; |
|
141 | - $actual = $employee->create_export_query('users.id','users.user_name=""'); |
|
142 | - $this->assertSame($expected,$actual); |
|
139 | + //test with valid string params |
|
140 | + $expected = "SELECT id, user_name, first_name, last_name, description, date_entered, date_modified, modified_user_id, created_by, title, department, is_admin, phone_home, phone_mobile, phone_work, phone_other, phone_fax, address_street, address_city, address_state, address_postalcode, address_country, reports_to_id, portal_only, status, receive_notifications, employee_status, messenger_id, messenger_type, is_group FROM users WHERE users.user_name=\"\" AND users.deleted = 0 ORDER BY users.id"; |
|
141 | + $actual = $employee->create_export_query('users.id','users.user_name=""'); |
|
142 | + $this->assertSame($expected,$actual); |
|
143 | 143 | |
144 | - } |
|
144 | + } |
|
145 | 145 | |
146 | - public function testpreprocess_fields_on_save(){ |
|
146 | + public function testpreprocess_fields_on_save(){ |
|
147 | 147 | |
148 | - $employee = new Employee(); |
|
148 | + $employee = new Employee(); |
|
149 | 149 | |
150 | - //execute the method and test if it works and does not throws an exception. |
|
151 | - try { |
|
152 | - $employee->preprocess_fields_on_save(); |
|
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 | + $employee->preprocess_fields_on_save(); |
|
153 | + $this->assertTrue(true); |
|
154 | + } |
|
155 | + catch (Exception $e) { |
|
156 | + $this->fail(); |
|
157 | + } |
|
158 | 158 | |
159 | - } |
|
159 | + } |
|
160 | 160 | |
161 | - public function testcreate_new_list_query() |
|
161 | + public function testcreate_new_list_query() |
|
162 | 162 | { |
163 | - $employee = new Employee(); |
|
163 | + $employee = new Employee(); |
|
164 | 164 | |
165 | - //test with empty string params |
|
166 | - $expected = " SELECT users.* , ' ' c_accept_status_fields , ' ' call_id , ' ' securitygroup_noninher_fields , ' ' securitygroup_id , LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as full_name, LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as name , jt2.last_name reports_to_name , jt2.created_by reports_to_name_owner , 'Users' reports_to_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM users LEFT JOIN users jt2 ON users.reports_to_id=jt2.id AND jt2.deleted=0\n\n AND jt2.deleted=0 where ( users.portal_only = 0 ) AND users.deleted=0"; |
|
167 | - $actual = $employee->create_new_list_query('',''); |
|
168 | - $this->assertSame($expected,$actual); |
|
165 | + //test with empty string params |
|
166 | + $expected = " SELECT users.* , ' ' c_accept_status_fields , ' ' call_id , ' ' securitygroup_noninher_fields , ' ' securitygroup_id , LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as full_name, LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as name , jt2.last_name reports_to_name , jt2.created_by reports_to_name_owner , 'Users' reports_to_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM users LEFT JOIN users jt2 ON users.reports_to_id=jt2.id AND jt2.deleted=0\n\n AND jt2.deleted=0 where ( users.portal_only = 0 ) AND users.deleted=0"; |
|
167 | + $actual = $employee->create_new_list_query('',''); |
|
168 | + $this->assertSame($expected,$actual); |
|
169 | 169 | |
170 | 170 | |
171 | - //test with valid string params |
|
172 | - $expected = " SELECT users.* , ' ' c_accept_status_fields , ' ' call_id , ' ' securitygroup_noninher_fields , ' ' securitygroup_id , LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as full_name, LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as name , jt2.last_name reports_to_name , jt2.created_by reports_to_name_owner , 'Users' reports_to_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM users LEFT JOIN users jt2 ON users.reports_to_id=jt2.id AND jt2.deleted=0\n\n AND jt2.deleted=0 where (users.user_name=\"\" and users.portal_only = 0 ) AND users.deleted=0"; |
|
173 | - $actual = $employee->create_new_list_query('users.id','users.user_name=""'); |
|
174 | - $this->assertSame($expected,$actual); |
|
171 | + //test with valid string params |
|
172 | + $expected = " SELECT users.* , ' ' c_accept_status_fields , ' ' call_id , ' ' securitygroup_noninher_fields , ' ' securitygroup_id , LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as full_name, LTRIM(RTRIM(CONCAT(IFNULL(users.first_name,''),' ',IFNULL(users.last_name,'')))) as name , jt2.last_name reports_to_name , jt2.created_by reports_to_name_owner , 'Users' reports_to_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM users LEFT JOIN users jt2 ON users.reports_to_id=jt2.id AND jt2.deleted=0\n\n AND jt2.deleted=0 where (users.user_name=\"\" and users.portal_only = 0 ) AND users.deleted=0"; |
|
173 | + $actual = $employee->create_new_list_query('users.id','users.user_name=""'); |
|
174 | + $this->assertSame($expected,$actual); |
|
175 | 175 | |
176 | 176 | } |
177 | 177 | |
178 | 178 | |
179 | 179 | public function testhasCustomFields() |
180 | 180 | { |
181 | - $employee = new Employee(); |
|
182 | - $result = $employee->hasCustomFields(); |
|
183 | - $this->assertEquals(false,$result); |
|
181 | + $employee = new Employee(); |
|
182 | + $result = $employee->hasCustomFields(); |
|
183 | + $this->assertEquals(false,$result); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | } |
@@ -3,165 +3,165 @@ |
||
3 | 3 | class AuditTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | 5 | |
6 | - public function testAudit() { |
|
6 | + public function testAudit() { |
|
7 | 7 | |
8 | - error_reporting(E_ERROR | E_PARSE); |
|
8 | + error_reporting(E_ERROR | E_PARSE); |
|
9 | 9 | |
10 | - //execute the contructor and check for the Object type and attributes |
|
11 | - $audit = new Audit(); |
|
12 | - $this->assertInstanceOf('Audit',$audit); |
|
13 | - $this->assertInstanceOf('SugarBean',$audit); |
|
14 | - $this->assertAttributeEquals('Audit', 'module_dir', $audit); |
|
15 | - $this->assertAttributeEquals('Audit', 'object_name', $audit); |
|
10 | + //execute the contructor and check for the Object type and attributes |
|
11 | + $audit = new Audit(); |
|
12 | + $this->assertInstanceOf('Audit',$audit); |
|
13 | + $this->assertInstanceOf('SugarBean',$audit); |
|
14 | + $this->assertAttributeEquals('Audit', 'module_dir', $audit); |
|
15 | + $this->assertAttributeEquals('Audit', 'object_name', $audit); |
|
16 | 16 | |
17 | 17 | |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | - public function testget_summary_text() |
|
21 | - { |
|
22 | - $audit = new Audit(); |
|
20 | + public function testget_summary_text() |
|
21 | + { |
|
22 | + $audit = new Audit(); |
|
23 | 23 | |
24 | - //test without setting name |
|
25 | - $this->assertEquals(Null,$audit->get_summary_text()); |
|
24 | + //test without setting name |
|
25 | + $this->assertEquals(Null,$audit->get_summary_text()); |
|
26 | 26 | |
27 | - //test with name set |
|
28 | - $audit->name = "test"; |
|
29 | - $this->assertEquals('test',$audit->get_summary_text()); |
|
27 | + //test with name set |
|
28 | + $audit->name = "test"; |
|
29 | + $this->assertEquals('test',$audit->get_summary_text()); |
|
30 | 30 | |
31 | - } |
|
31 | + } |
|
32 | 32 | |
33 | 33 | public function testcreate_export_query() |
34 | 34 | { |
35 | - $audit = new Audit(); |
|
35 | + $audit = new Audit(); |
|
36 | 36 | |
37 | - //execute the method and test if it works and does not throws an exception. |
|
38 | - try { |
|
39 | - $audit->create_export_query('', ''); |
|
40 | - $this->assertTrue(true); |
|
41 | - } |
|
42 | - catch (Exception $e) { |
|
43 | - $this->fail(); |
|
44 | - } |
|
37 | + //execute the method and test if it works and does not throws an exception. |
|
38 | + try { |
|
39 | + $audit->create_export_query('', ''); |
|
40 | + $this->assertTrue(true); |
|
41 | + } |
|
42 | + catch (Exception $e) { |
|
43 | + $this->fail(); |
|
44 | + } |
|
45 | 45 | |
46 | - $this->markTestIncomplete('method has no implementation'); |
|
46 | + $this->markTestIncomplete('method has no implementation'); |
|
47 | 47 | } |
48 | 48 | |
49 | - public function testfill_in_additional_list_fields() |
|
50 | - { |
|
49 | + public function testfill_in_additional_list_fields() |
|
50 | + { |
|
51 | 51 | |
52 | - $audit = new Audit(); |
|
53 | - //execute the method and test if it works and does not throws an exception. |
|
54 | - try { |
|
55 | - $audit->fill_in_additional_list_fields(); |
|
56 | - $this->assertTrue(true); |
|
57 | - } |
|
58 | - catch (Exception $e) { |
|
59 | - $this->fail(); |
|
60 | - } |
|
52 | + $audit = new Audit(); |
|
53 | + //execute the method and test if it works and does not throws an exception. |
|
54 | + try { |
|
55 | + $audit->fill_in_additional_list_fields(); |
|
56 | + $this->assertTrue(true); |
|
57 | + } |
|
58 | + catch (Exception $e) { |
|
59 | + $this->fail(); |
|
60 | + } |
|
61 | 61 | |
62 | - $this->markTestIncomplete('method has no implementation'); |
|
62 | + $this->markTestIncomplete('method has no implementation'); |
|
63 | 63 | |
64 | - } |
|
64 | + } |
|
65 | 65 | |
66 | - public function testfill_in_additional_detail_fields() |
|
67 | - { |
|
66 | + public function testfill_in_additional_detail_fields() |
|
67 | + { |
|
68 | 68 | |
69 | - $audit = new Audit(); |
|
70 | - //execute the method and test if it works and does not throws an exception. |
|
71 | - try { |
|
72 | - $audit->fill_in_additional_detail_fields(); |
|
73 | - $this->assertTrue(true); |
|
74 | - } |
|
75 | - catch (Exception $e) { |
|
76 | - $this->fail(); |
|
77 | - } |
|
69 | + $audit = new Audit(); |
|
70 | + //execute the method and test if it works and does not throws an exception. |
|
71 | + try { |
|
72 | + $audit->fill_in_additional_detail_fields(); |
|
73 | + $this->assertTrue(true); |
|
74 | + } |
|
75 | + catch (Exception $e) { |
|
76 | + $this->fail(); |
|
77 | + } |
|
78 | 78 | |
79 | - $this->markTestIncomplete('method has no implementation'); |
|
79 | + $this->markTestIncomplete('method has no implementation'); |
|
80 | 80 | |
81 | - } |
|
81 | + } |
|
82 | 82 | |
83 | - public function testfill_in_additional_parent_fields() |
|
84 | - { |
|
85 | - $audit = new Audit(); |
|
86 | - //execute the method and test if it works and does not throws an exception. |
|
87 | - try { |
|
88 | - $audit->fill_in_additional_parent_fields(); |
|
89 | - $this->assertTrue(true); |
|
90 | - } |
|
91 | - catch (Exception $e) { |
|
92 | - $this->fail(); |
|
93 | - } |
|
83 | + public function testfill_in_additional_parent_fields() |
|
84 | + { |
|
85 | + $audit = new Audit(); |
|
86 | + //execute the method and test if it works and does not throws an exception. |
|
87 | + try { |
|
88 | + $audit->fill_in_additional_parent_fields(); |
|
89 | + $this->assertTrue(true); |
|
90 | + } |
|
91 | + catch (Exception $e) { |
|
92 | + $this->fail(); |
|
93 | + } |
|
94 | 94 | |
95 | - $this->markTestIncomplete('method has no implementation'); |
|
95 | + $this->markTestIncomplete('method has no implementation'); |
|
96 | 96 | |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | - public function testget_list_view_data() |
|
100 | - { |
|
99 | + public function testget_list_view_data() |
|
100 | + { |
|
101 | 101 | |
102 | - $audit = new Audit(); |
|
103 | - //execute the method and test if it works and does not throws an exception. |
|
104 | - try { |
|
105 | - $audit->get_list_view_data(); |
|
106 | - $this->assertTrue(true); |
|
107 | - } |
|
108 | - catch (Exception $e) { |
|
109 | - $this->fail(); |
|
110 | - } |
|
102 | + $audit = new Audit(); |
|
103 | + //execute the method and test if it works and does not throws an exception. |
|
104 | + try { |
|
105 | + $audit->get_list_view_data(); |
|
106 | + $this->assertTrue(true); |
|
107 | + } |
|
108 | + catch (Exception $e) { |
|
109 | + $this->fail(); |
|
110 | + } |
|
111 | 111 | |
112 | - $this->markTestIncomplete('method has no implementation'); |
|
112 | + $this->markTestIncomplete('method has no implementation'); |
|
113 | 113 | |
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | - public function testget_audit_link() |
|
118 | - { |
|
117 | + public function testget_audit_link() |
|
118 | + { |
|
119 | 119 | |
120 | - $audit = new Audit(); |
|
121 | - //execute the method and test if it works and does not throws an exception. |
|
122 | - try { |
|
123 | - $audit->get_audit_link(); |
|
124 | - $this->assertTrue(true); |
|
125 | - } |
|
126 | - catch (Exception $e) { |
|
127 | - $this->fail(); |
|
128 | - } |
|
120 | + $audit = new Audit(); |
|
121 | + //execute the method and test if it works and does not throws an exception. |
|
122 | + try { |
|
123 | + $audit->get_audit_link(); |
|
124 | + $this->assertTrue(true); |
|
125 | + } |
|
126 | + catch (Exception $e) { |
|
127 | + $this->fail(); |
|
128 | + } |
|
129 | 129 | |
130 | - $this->markTestIncomplete('method has no implementation'); |
|
130 | + $this->markTestIncomplete('method has no implementation'); |
|
131 | 131 | |
132 | - } |
|
132 | + } |
|
133 | 133 | |
134 | 134 | |
135 | - public function testget_audit_list() |
|
136 | - { |
|
135 | + public function testget_audit_list() |
|
136 | + { |
|
137 | 137 | |
138 | - global $focus; |
|
139 | - $focus = new Account(); //use audit enabbled module object |
|
138 | + global $focus; |
|
139 | + $focus = new Account(); //use audit enabbled module object |
|
140 | 140 | |
141 | - $audit = new Audit(); |
|
141 | + $audit = new Audit(); |
|
142 | 142 | |
143 | - //execute the method and verify that it returns an array |
|
144 | - $result = $audit->get_audit_list(); |
|
145 | - $this->assertTrue(is_array($result)); |
|
143 | + //execute the method and verify that it returns an array |
|
144 | + $result = $audit->get_audit_list(); |
|
145 | + $this->assertTrue(is_array($result)); |
|
146 | 146 | |
147 | - } |
|
147 | + } |
|
148 | 148 | |
149 | - public function testgetAssociatedFieldName() |
|
150 | - { |
|
151 | - global $focus; |
|
152 | - $focus = new Account(); //use audit enabbled module object |
|
149 | + public function testgetAssociatedFieldName() |
|
150 | + { |
|
151 | + global $focus; |
|
152 | + $focus = new Account(); //use audit enabbled module object |
|
153 | 153 | |
154 | - $audit = new Audit(); |
|
154 | + $audit = new Audit(); |
|
155 | 155 | |
156 | - //test with name field |
|
157 | - $result = $audit->getAssociatedFieldName("name","1"); |
|
158 | - $this->assertEquals("1",$result); |
|
156 | + //test with name field |
|
157 | + $result = $audit->getAssociatedFieldName("name","1"); |
|
158 | + $this->assertEquals("1",$result); |
|
159 | 159 | |
160 | - //test with parent_id field |
|
161 | - $result = $audit->getAssociatedFieldName("parent_id","1"); |
|
162 | - $this->assertEquals(null,$result); |
|
160 | + //test with parent_id field |
|
161 | + $result = $audit->getAssociatedFieldName("parent_id","1"); |
|
162 | + $this->assertEquals(null,$result); |
|
163 | 163 | |
164 | - } |
|
164 | + } |
|
165 | 165 | |
166 | 166 | |
167 | 167 | } |
@@ -3,82 +3,82 @@ |
||
3 | 3 | class AOR_Scheduled_ReportsTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | 5 | |
6 | - public function testAOR_Scheduled_Reports(){ |
|
6 | + public function testAOR_Scheduled_Reports(){ |
|
7 | 7 | |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $aorScheduledReports = new AOR_Scheduled_Reports(); |
|
10 | - $this->assertInstanceOf('AOR_Scheduled_Reports',$aorScheduledReports); |
|
11 | - $this->assertInstanceOf('Basic',$aorScheduledReports); |
|
12 | - $this->assertInstanceOf('SugarBean',$aorScheduledReports); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $aorScheduledReports = new AOR_Scheduled_Reports(); |
|
10 | + $this->assertInstanceOf('AOR_Scheduled_Reports',$aorScheduledReports); |
|
11 | + $this->assertInstanceOf('Basic',$aorScheduledReports); |
|
12 | + $this->assertInstanceOf('SugarBean',$aorScheduledReports); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('AOR_Scheduled_Reports', 'module_dir', $aorScheduledReports); |
|
15 | - $this->assertAttributeEquals('AOR_Scheduled_Reports', 'object_name', $aorScheduledReports); |
|
16 | - $this->assertAttributeEquals('aor_scheduled_reports', 'table_name', $aorScheduledReports); |
|
17 | - $this->assertAttributeEquals(true, 'new_schema', $aorScheduledReports); |
|
18 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aorScheduledReports); |
|
19 | - $this->assertAttributeEquals(false, 'importable', $aorScheduledReports); |
|
14 | + $this->assertAttributeEquals('AOR_Scheduled_Reports', 'module_dir', $aorScheduledReports); |
|
15 | + $this->assertAttributeEquals('AOR_Scheduled_Reports', 'object_name', $aorScheduledReports); |
|
16 | + $this->assertAttributeEquals('aor_scheduled_reports', 'table_name', $aorScheduledReports); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $aorScheduledReports); |
|
18 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aorScheduledReports); |
|
19 | + $this->assertAttributeEquals(false, 'importable', $aorScheduledReports); |
|
20 | 20 | |
21 | - } |
|
21 | + } |
|
22 | 22 | |
23 | - public function testbean_implements(){ |
|
23 | + public function testbean_implements(){ |
|
24 | 24 | |
25 | - error_reporting(E_ERROR | E_PARSE); |
|
25 | + error_reporting(E_ERROR | E_PARSE); |
|
26 | 26 | |
27 | - $aorScheduledReports = new AOR_Scheduled_Reports(); |
|
28 | - $this->assertEquals(false, $aorScheduledReports->bean_implements('')); //test with blank value |
|
29 | - $this->assertEquals(false, $aorScheduledReports->bean_implements('test')); //test with invalid value |
|
30 | - $this->assertEquals(true, $aorScheduledReports->bean_implements('ACL')); //test with valid value |
|
27 | + $aorScheduledReports = new AOR_Scheduled_Reports(); |
|
28 | + $this->assertEquals(false, $aorScheduledReports->bean_implements('')); //test with blank value |
|
29 | + $this->assertEquals(false, $aorScheduledReports->bean_implements('test')); //test with invalid value |
|
30 | + $this->assertEquals(true, $aorScheduledReports->bean_implements('ACL')); //test with valid value |
|
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | - public function testSaveAndGet_email_recipients(){ |
|
34 | + public function testSaveAndGet_email_recipients(){ |
|
35 | 35 | |
36 | - $aorScheduledReports = new AOR_Scheduled_Reports(); |
|
37 | - $aorScheduledReports->name = "test"; |
|
38 | - $aorScheduledReports->description = "test description"; |
|
39 | - $_POST['email_recipients']= Array('email_target_type'=> array('Email Address','all','Specify User') ,'email' =>array('[email protected]','','1') ); |
|
36 | + $aorScheduledReports = new AOR_Scheduled_Reports(); |
|
37 | + $aorScheduledReports->name = "test"; |
|
38 | + $aorScheduledReports->description = "test description"; |
|
39 | + $_POST['email_recipients']= Array('email_target_type'=> array('Email Address','all','Specify User') ,'email' =>array('[email protected]','','1') ); |
|
40 | 40 | |
41 | 41 | |
42 | - //test save and test for record ID to verify that record is saved |
|
43 | - $aorScheduledReports->save(); |
|
44 | - $this->assertTrue(isset($aorScheduledReports->id)); |
|
45 | - $this->assertEquals(36, strlen($aorScheduledReports->id)); |
|
42 | + //test save and test for record ID to verify that record is saved |
|
43 | + $aorScheduledReports->save(); |
|
44 | + $this->assertTrue(isset($aorScheduledReports->id)); |
|
45 | + $this->assertEquals(36, strlen($aorScheduledReports->id)); |
|
46 | 46 | |
47 | 47 | |
48 | 48 | |
49 | - //test get_email_recipients |
|
50 | - $expected = array('[email protected]','','1'); |
|
51 | - $aorScheduledReports->retrieve($aorScheduledReports->id); |
|
52 | - $emails = $aorScheduledReports->get_email_recipients(); |
|
49 | + //test get_email_recipients |
|
50 | + $expected = array('[email protected]','','1'); |
|
51 | + $aorScheduledReports->retrieve($aorScheduledReports->id); |
|
52 | + $emails = $aorScheduledReports->get_email_recipients(); |
|
53 | 53 | |
54 | - $this->assertTrue(is_array($emails)); |
|
55 | - $this->assertEquals('[email protected]',$emails[0]); |
|
54 | + $this->assertTrue(is_array($emails)); |
|
55 | + $this->assertEquals('[email protected]',$emails[0]); |
|
56 | 56 | |
57 | 57 | |
58 | - $aorScheduledReports->mark_deleted($aorScheduledReports->id); |
|
59 | - unset($aorScheduledReports); |
|
58 | + $aorScheduledReports->mark_deleted($aorScheduledReports->id); |
|
59 | + unset($aorScheduledReports); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | |
65 | - public function testshouldRun(){ |
|
65 | + public function testshouldRun(){ |
|
66 | 66 | |
67 | 67 | |
68 | - $aorScheduledReports = new AOR_Scheduled_Reports(); |
|
69 | - $aorScheduledReports->schedule = " 8 * * * *"; |
|
68 | + $aorScheduledReports = new AOR_Scheduled_Reports(); |
|
69 | + $aorScheduledReports->schedule = " 8 * * * *"; |
|
70 | 70 | |
71 | - //test without a last_run date |
|
72 | - $this->assertFalse($aorScheduledReports->shouldRun(new DateTime()) ); |
|
71 | + //test without a last_run date |
|
72 | + $this->assertFalse($aorScheduledReports->shouldRun(new DateTime()) ); |
|
73 | 73 | |
74 | - //test without a older last_run date |
|
75 | - $aorScheduledReports->last_run = date("d-m-y H:i:s", mktime(0,0,0,10,3,2014)); |
|
76 | - $this->assertTrue($aorScheduledReports->shouldRun(new DateTime())); |
|
74 | + //test without a older last_run date |
|
75 | + $aorScheduledReports->last_run = date("d-m-y H:i:s", mktime(0,0,0,10,3,2014)); |
|
76 | + $this->assertTrue($aorScheduledReports->shouldRun(new DateTime())); |
|
77 | 77 | |
78 | 78 | |
79 | - //test without a current last_run date |
|
80 | - $aorScheduledReports->last_run = new DateTime(); |
|
81 | - $this->assertFalse($aorScheduledReports->shouldRun(new DateTime())); |
|
79 | + //test without a current last_run date |
|
80 | + $aorScheduledReports->last_run = new DateTime(); |
|
81 | + $this->assertFalse($aorScheduledReports->shouldRun(new DateTime())); |
|
82 | 82 | |
83 | 83 | } |
84 | 84 |
@@ -2,22 +2,22 @@ |
||
2 | 2 | |
3 | 3 | class AOK_Knowledge_Base_CategoriesTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - public function testAOK_Knowledge_Base_Categories(){ |
|
5 | + public function testAOK_Knowledge_Base_Categories(){ |
|
6 | 6 | |
7 | - //execute the contructor and check for the Object type and type attribute |
|
8 | - $aok_KBCategories = new AOK_Knowledge_Base_Categories(); |
|
9 | - $this->assertInstanceOf('AOK_Knowledge_Base_Categories',$aok_KBCategories); |
|
10 | - $this->assertInstanceOf('Basic',$aok_KBCategories); |
|
11 | - $this->assertInstanceOf('SugarBean',$aok_KBCategories); |
|
7 | + //execute the contructor and check for the Object type and type attribute |
|
8 | + $aok_KBCategories = new AOK_Knowledge_Base_Categories(); |
|
9 | + $this->assertInstanceOf('AOK_Knowledge_Base_Categories',$aok_KBCategories); |
|
10 | + $this->assertInstanceOf('Basic',$aok_KBCategories); |
|
11 | + $this->assertInstanceOf('SugarBean',$aok_KBCategories); |
|
12 | 12 | |
13 | - $this->assertAttributeEquals('AOK_Knowledge_Base_Categories', 'module_dir', $aok_KBCategories); |
|
14 | - $this->assertAttributeEquals('AOK_Knowledge_Base_Categories', 'object_name', $aok_KBCategories); |
|
15 | - $this->assertAttributeEquals('aok_knowledge_base_categories', 'table_name', $aok_KBCategories); |
|
16 | - $this->assertAttributeEquals(true, 'new_schema', $aok_KBCategories); |
|
17 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aok_KBCategories); |
|
18 | - $this->assertAttributeEquals(false, 'importable', $aok_KBCategories); |
|
13 | + $this->assertAttributeEquals('AOK_Knowledge_Base_Categories', 'module_dir', $aok_KBCategories); |
|
14 | + $this->assertAttributeEquals('AOK_Knowledge_Base_Categories', 'object_name', $aok_KBCategories); |
|
15 | + $this->assertAttributeEquals('aok_knowledge_base_categories', 'table_name', $aok_KBCategories); |
|
16 | + $this->assertAttributeEquals(true, 'new_schema', $aok_KBCategories); |
|
17 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aok_KBCategories); |
|
18 | + $this->assertAttributeEquals(false, 'importable', $aok_KBCategories); |
|
19 | 19 | |
20 | - } |
|
20 | + } |
|
21 | 21 | |
22 | 22 | } |
23 | 23 | ?> |
24 | 24 | \ No newline at end of file |
@@ -6,25 +6,25 @@ discard block |
||
6 | 6 | |
7 | 7 | public function testjjwg_Areas() { |
8 | 8 | |
9 | - //execute the contructor and check for the Object type and attributes |
|
10 | - $jjwgAreas = new jjwg_Areas(); |
|
9 | + //execute the contructor and check for the Object type and attributes |
|
10 | + $jjwgAreas = new jjwg_Areas(); |
|
11 | 11 | |
12 | - $this->assertInstanceOf('jjwg_Areas',$jjwgAreas); |
|
13 | - $this->assertInstanceOf('Basic',$jjwgAreas); |
|
14 | - $this->assertInstanceOf('SugarBean',$jjwgAreas); |
|
12 | + $this->assertInstanceOf('jjwg_Areas',$jjwgAreas); |
|
13 | + $this->assertInstanceOf('Basic',$jjwgAreas); |
|
14 | + $this->assertInstanceOf('SugarBean',$jjwgAreas); |
|
15 | 15 | |
16 | - $this->assertAttributeEquals('jjwg_Areas', 'module_dir', $jjwgAreas); |
|
17 | - $this->assertAttributeEquals('jjwg_Areas', 'object_name', $jjwgAreas); |
|
18 | - $this->assertAttributeEquals('jjwg_areas', 'table_name', $jjwgAreas); |
|
16 | + $this->assertAttributeEquals('jjwg_Areas', 'module_dir', $jjwgAreas); |
|
17 | + $this->assertAttributeEquals('jjwg_Areas', 'object_name', $jjwgAreas); |
|
18 | + $this->assertAttributeEquals('jjwg_areas', 'table_name', $jjwgAreas); |
|
19 | 19 | |
20 | - $this->assertAttributeEquals(true, 'new_schema', $jjwgAreas); |
|
21 | - $this->assertAttributeEquals(true, 'importable', $jjwgAreas); |
|
22 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $jjwgAreas); |
|
20 | + $this->assertAttributeEquals(true, 'new_schema', $jjwgAreas); |
|
21 | + $this->assertAttributeEquals(true, 'importable', $jjwgAreas); |
|
22 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $jjwgAreas); |
|
23 | 23 | |
24 | - $this->assertAttributeEquals(null, 'polygon', $jjwgAreas); |
|
25 | - $this->assertAttributeEquals(true, 'point_on_vertex', $jjwgAreas); |
|
26 | - $this->assertAttributeEquals(0, 'area', $jjwgAreas); |
|
27 | - $this->assertAttributeEquals(null, 'centroid', $jjwgAreas); |
|
24 | + $this->assertAttributeEquals(null, 'polygon', $jjwgAreas); |
|
25 | + $this->assertAttributeEquals(true, 'point_on_vertex', $jjwgAreas); |
|
26 | + $this->assertAttributeEquals(0, 'area', $jjwgAreas); |
|
27 | + $this->assertAttributeEquals(null, 'centroid', $jjwgAreas); |
|
28 | 28 | |
29 | 29 | |
30 | 30 | } |
@@ -32,243 +32,243 @@ discard block |
||
32 | 32 | |
33 | 33 | public function testconfiguration() { |
34 | 34 | |
35 | - error_reporting(E_ERROR | E_PARSE); |
|
35 | + error_reporting(E_ERROR | E_PARSE); |
|
36 | 36 | |
37 | - $jjwgAreas = new jjwg_Areas(); |
|
38 | - $jjwgAreas->configuration(); |
|
37 | + $jjwgAreas = new jjwg_Areas(); |
|
38 | + $jjwgAreas->configuration(); |
|
39 | 39 | |
40 | - $this->assertInstanceOf('jjwg_Maps',$jjwgAreas->jjwg_Maps); |
|
41 | - $this->assertTrue(is_array($jjwgAreas->settings)); |
|
42 | - $this->assertGreaterThan(0,count($jjwgAreas->settings)); |
|
40 | + $this->assertInstanceOf('jjwg_Maps',$jjwgAreas->jjwg_Maps); |
|
41 | + $this->assertTrue(is_array($jjwgAreas->settings)); |
|
42 | + $this->assertGreaterThan(0,count($jjwgAreas->settings)); |
|
43 | 43 | |
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | 47 | public function testretrieve() { |
48 | 48 | $this->markTestSkipped("Skipped pending feedback on the area behaviour."); |
49 | - $jjwgAreas = new jjwg_Areas(); |
|
49 | + $jjwgAreas = new jjwg_Areas(); |
|
50 | 50 | |
51 | 51 | |
52 | - //test without pre settting attributes |
|
53 | - $jjwgAreas->retrieve(); |
|
54 | - $this->assertEquals(false ,$jjwgAreas->polygon); |
|
55 | - $this->assertEquals(0,$jjwgAreas->area); |
|
56 | - $this->assertEquals(null,$jjwgAreas->centroid); |
|
52 | + //test without pre settting attributes |
|
53 | + $jjwgAreas->retrieve(); |
|
54 | + $this->assertEquals(false ,$jjwgAreas->polygon); |
|
55 | + $this->assertEquals(0,$jjwgAreas->area); |
|
56 | + $this->assertEquals(null,$jjwgAreas->centroid); |
|
57 | 57 | |
58 | 58 | |
59 | - //test with required attributes preset |
|
60 | - $jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12"; |
|
59 | + //test with required attributes preset |
|
60 | + $jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12"; |
|
61 | 61 | |
62 | - $expected_polygon = array ( |
|
63 | - array ('lng' => '100', 'lat' => '80','elv' => '10' ), |
|
64 | - array ('lng' => '101', 'lat' => '81', 'elv' => '11'), |
|
65 | - array ('lng' => '102', 'lat' => '82', 'elv' => '12' ) |
|
66 | - ); |
|
67 | - $expected_centroid = array("lng"=>67.3333333333333285963817615993320941925048828125, "lat" =>54.0, "elv"=>0); |
|
62 | + $expected_polygon = array ( |
|
63 | + array ('lng' => '100', 'lat' => '80','elv' => '10' ), |
|
64 | + array ('lng' => '101', 'lat' => '81', 'elv' => '11'), |
|
65 | + array ('lng' => '102', 'lat' => '82', 'elv' => '12' ) |
|
66 | + ); |
|
67 | + $expected_centroid = array("lng"=>67.3333333333333285963817615993320941925048828125, "lat" =>54.0, "elv"=>0); |
|
68 | 68 | |
69 | - $jjwgAreas->retrieve(); |
|
69 | + $jjwgAreas->retrieve(); |
|
70 | 70 | |
71 | - $this->assertSame($expected_polygon ,$jjwgAreas->polygon); |
|
72 | - $this->assertEquals(20,$jjwgAreas->area); |
|
73 | - $this->assertSame($expected_centroid,$jjwgAreas->centroid); |
|
71 | + $this->assertSame($expected_polygon ,$jjwgAreas->polygon); |
|
72 | + $this->assertEquals(20,$jjwgAreas->area); |
|
73 | + $this->assertSame($expected_centroid,$jjwgAreas->centroid); |
|
74 | 74 | |
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | 78 | public function testdefine_polygon() { |
79 | 79 | |
80 | - $jjwgAreas = new jjwg_Areas(); |
|
80 | + $jjwgAreas = new jjwg_Areas(); |
|
81 | 81 | |
82 | - //test without pre settting attributes |
|
83 | - $actual = $jjwgAreas->define_polygon(); |
|
84 | - $this->assertEquals(false, $actual); |
|
82 | + //test without pre settting attributes |
|
83 | + $actual = $jjwgAreas->define_polygon(); |
|
84 | + $this->assertEquals(false, $actual); |
|
85 | 85 | |
86 | 86 | |
87 | - //test with required attributes preset |
|
88 | - $jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12"; |
|
89 | - $expected = array ( |
|
90 | - array ('lng' => '100', 'lat' => '80','elv' => '10' ), |
|
91 | - array ('lng' => '101', 'lat' => '81', 'elv' => '11'), |
|
92 | - array ('lng' => '102', 'lat' => '82', 'elv' => '12' ) |
|
93 | - ); |
|
94 | - $actual = $jjwgAreas->define_polygon(); |
|
95 | - $this->assertSame($actual, $expected); |
|
87 | + //test with required attributes preset |
|
88 | + $jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12"; |
|
89 | + $expected = array ( |
|
90 | + array ('lng' => '100', 'lat' => '80','elv' => '10' ), |
|
91 | + array ('lng' => '101', 'lat' => '81', 'elv' => '11'), |
|
92 | + array ('lng' => '102', 'lat' => '82', 'elv' => '12' ) |
|
93 | + ); |
|
94 | + $actual = $jjwgAreas->define_polygon(); |
|
95 | + $this->assertSame($actual, $expected); |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
99 | 99 | |
100 | 100 | public function testdefine_area_loc() { |
101 | 101 | |
102 | - $jjwgAreas = new jjwg_Areas(); |
|
102 | + $jjwgAreas = new jjwg_Areas(); |
|
103 | 103 | |
104 | - //test without pre settting attributes |
|
105 | - $result = $jjwgAreas->define_area_loc(); |
|
106 | - $this->assertEquals("N/A", $result['name']); |
|
107 | - $this->assertTrue(is_numeric($result['lat'])); |
|
108 | - $this->assertTrue(is_numeric($result['lng'])); |
|
104 | + //test without pre settting attributes |
|
105 | + $result = $jjwgAreas->define_area_loc(); |
|
106 | + $this->assertEquals("N/A", $result['name']); |
|
107 | + $this->assertTrue(is_numeric($result['lat'])); |
|
108 | + $this->assertTrue(is_numeric($result['lng'])); |
|
109 | 109 | |
110 | 110 | |
111 | - //test with required attributes preset |
|
112 | - $jjwgAreas->name = "test"; |
|
113 | - $jjwgAreas->centroid = array("lng"=> 100 , "lat"=> 50); |
|
111 | + //test with required attributes preset |
|
112 | + $jjwgAreas->name = "test"; |
|
113 | + $jjwgAreas->centroid = array("lng"=> 100 , "lat"=> 50); |
|
114 | 114 | |
115 | - $expected = array("name"=>"test", "lat"=>50, "lng"=>100); |
|
116 | - $result = $jjwgAreas->define_area_loc(); |
|
117 | - $this->assertSame($expected, $result); |
|
115 | + $expected = array("name"=>"test", "lat"=>50, "lng"=>100); |
|
116 | + $result = $jjwgAreas->define_area_loc(); |
|
117 | + $this->assertSame($expected, $result); |
|
118 | 118 | |
119 | 119 | } |
120 | 120 | |
121 | 121 | |
122 | 122 | public function testdefine_centroid() { |
123 | 123 | $this->markTestSkipped("Skipped pending feedback on the area behaviour."); |
124 | - $jjwgAreas = new jjwg_Areas(); |
|
124 | + $jjwgAreas = new jjwg_Areas(); |
|
125 | 125 | |
126 | - //test without setting up coordinates |
|
127 | - $result = $jjwgAreas->define_centroid(); |
|
128 | - $this->assertEquals(null, $result); |
|
126 | + //test without setting up coordinates |
|
127 | + $result = $jjwgAreas->define_centroid(); |
|
128 | + $this->assertEquals(null, $result); |
|
129 | 129 | |
130 | 130 | |
131 | - //test with coordinates setup |
|
132 | - $jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12"; |
|
133 | - $expected = array("lng"=>67.3333333333333285963817615993320941925048828125, "lat" =>54.0, "elv"=>0); |
|
131 | + //test with coordinates setup |
|
132 | + $jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12"; |
|
133 | + $expected = array("lng"=>67.3333333333333285963817615993320941925048828125, "lat" =>54.0, "elv"=>0); |
|
134 | 134 | |
135 | - $result = $jjwgAreas->define_centroid(); |
|
136 | - $this->assertSame($expected,$result); |
|
135 | + $result = $jjwgAreas->define_centroid(); |
|
136 | + $this->assertSame($expected,$result); |
|
137 | 137 | |
138 | 138 | } |
139 | 139 | |
140 | 140 | |
141 | 141 | public function testdefine_area() { |
142 | 142 | $this->markTestSkipped("Skipped pending feedback on the area behaviour."); |
143 | - $jjwgAreas = new jjwg_Areas(); |
|
143 | + $jjwgAreas = new jjwg_Areas(); |
|
144 | 144 | |
145 | - //test without setting up coordinates |
|
146 | - $result = $jjwgAreas->define_area(); |
|
147 | - $this->assertEquals(0, $result); |
|
145 | + //test without setting up coordinates |
|
146 | + $result = $jjwgAreas->define_area(); |
|
147 | + $this->assertEquals(0, $result); |
|
148 | 148 | |
149 | 149 | |
150 | - //test with coordinates setup |
|
151 | - $jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12"; |
|
150 | + //test with coordinates setup |
|
151 | + $jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12"; |
|
152 | 152 | |
153 | - $result = $jjwgAreas->define_area(); |
|
154 | - $this->assertEquals(20,$result); |
|
153 | + $result = $jjwgAreas->define_area(); |
|
154 | + $this->assertEquals(20,$result); |
|
155 | 155 | |
156 | 156 | } |
157 | 157 | |
158 | 158 | |
159 | 159 | public function testdefine_loc() { |
160 | 160 | |
161 | - $jjwgAreas = new jjwg_Areas(); |
|
161 | + $jjwgAreas = new jjwg_Areas(); |
|
162 | 162 | |
163 | - //test without pre settting attributes |
|
164 | - $result = $jjwgAreas->define_loc(array()); |
|
165 | - $this->assertEquals("N/A", $result['name']); |
|
166 | - $this->assertTrue(is_numeric($result['lat'])); |
|
167 | - $this->assertTrue(is_numeric($result['lng'])); |
|
163 | + //test without pre settting attributes |
|
164 | + $result = $jjwgAreas->define_loc(array()); |
|
165 | + $this->assertEquals("N/A", $result['name']); |
|
166 | + $this->assertTrue(is_numeric($result['lat'])); |
|
167 | + $this->assertTrue(is_numeric($result['lng'])); |
|
168 | 168 | |
169 | 169 | |
170 | - //test with required attributes preset |
|
171 | - $marker = array("name"=>"test", "lat"=>50, "lng"=>100); |
|
172 | - $result = $jjwgAreas->define_loc($marker); |
|
173 | - $this->assertSame($marker, $result); |
|
170 | + //test with required attributes preset |
|
171 | + $marker = array("name"=>"test", "lat"=>50, "lng"=>100); |
|
172 | + $result = $jjwgAreas->define_loc($marker); |
|
173 | + $this->assertSame($marker, $result); |
|
174 | 174 | |
175 | 175 | } |
176 | 176 | |
177 | 177 | |
178 | 178 | public function testis_valid_lng() { |
179 | 179 | |
180 | - $jjwgAreas = new jjwg_Areas(); |
|
180 | + $jjwgAreas = new jjwg_Areas(); |
|
181 | 181 | |
182 | - //test with invalid values |
|
183 | - $this->assertEquals(false, $jjwgAreas->is_valid_lng('') ); |
|
184 | - $this->assertEquals(false, $jjwgAreas->is_valid_lng(181) ); |
|
185 | - $this->assertEquals(false, $jjwgAreas->is_valid_lng(-181) ); |
|
182 | + //test with invalid values |
|
183 | + $this->assertEquals(false, $jjwgAreas->is_valid_lng('') ); |
|
184 | + $this->assertEquals(false, $jjwgAreas->is_valid_lng(181) ); |
|
185 | + $this->assertEquals(false, $jjwgAreas->is_valid_lng(-181) ); |
|
186 | 186 | |
187 | - //test with valid values |
|
188 | - $this->assertEquals(true, $jjwgAreas->is_valid_lng(180) ); |
|
189 | - $this->assertEquals(true, $jjwgAreas->is_valid_lng(-180) ); |
|
187 | + //test with valid values |
|
188 | + $this->assertEquals(true, $jjwgAreas->is_valid_lng(180) ); |
|
189 | + $this->assertEquals(true, $jjwgAreas->is_valid_lng(-180) ); |
|
190 | 190 | |
191 | 191 | } |
192 | 192 | |
193 | 193 | |
194 | 194 | public function testis_valid_lat() { |
195 | 195 | |
196 | - $jjwgAreas = new jjwg_Areas(); |
|
196 | + $jjwgAreas = new jjwg_Areas(); |
|
197 | 197 | |
198 | - //test with invalid values |
|
199 | - $this->assertEquals(false, $jjwgAreas->is_valid_lat('') ); |
|
200 | - $this->assertEquals(false, $jjwgAreas->is_valid_lat(91) ); |
|
201 | - $this->assertEquals(false, $jjwgAreas->is_valid_lat(-91) ); |
|
198 | + //test with invalid values |
|
199 | + $this->assertEquals(false, $jjwgAreas->is_valid_lat('') ); |
|
200 | + $this->assertEquals(false, $jjwgAreas->is_valid_lat(91) ); |
|
201 | + $this->assertEquals(false, $jjwgAreas->is_valid_lat(-91) ); |
|
202 | 202 | |
203 | - //test with valid values |
|
204 | - $this->assertEquals(true, $jjwgAreas->is_valid_lat(90) ); |
|
205 | - $this->assertEquals(true, $jjwgAreas->is_valid_lat(-90) ); |
|
203 | + //test with valid values |
|
204 | + $this->assertEquals(true, $jjwgAreas->is_valid_lat(90) ); |
|
205 | + $this->assertEquals(true, $jjwgAreas->is_valid_lat(-90) ); |
|
206 | 206 | |
207 | 207 | } |
208 | 208 | |
209 | 209 | |
210 | 210 | public function testis_marker_in_area() { |
211 | 211 | |
212 | - $jjwgAreas = new jjwg_Areas(); |
|
212 | + $jjwgAreas = new jjwg_Areas(); |
|
213 | 213 | |
214 | - $marker = array("name"=>"test", "lat"=>100, "lng"=>40); |
|
214 | + $marker = array("name"=>"test", "lat"=>100, "lng"=>40); |
|
215 | 215 | |
216 | - //test without setting up coordinates |
|
217 | - $this->assertEquals(false, $jjwgAreas->is_marker_in_area($marker) ); |
|
216 | + //test without setting up coordinates |
|
217 | + $this->assertEquals(false, $jjwgAreas->is_marker_in_area($marker) ); |
|
218 | 218 | |
219 | - //test with coordinates set |
|
220 | - $jjwgAreas->coordinates= "100,40,0.0 101,81,0.0 102,32,0.0"; |
|
221 | - $this->assertEquals(false, $jjwgAreas->is_marker_in_area($marker) ); |
|
219 | + //test with coordinates set |
|
220 | + $jjwgAreas->coordinates= "100,40,0.0 101,81,0.0 102,32,0.0"; |
|
221 | + $this->assertEquals(false, $jjwgAreas->is_marker_in_area($marker) ); |
|
222 | 222 | |
223 | 223 | } |
224 | 224 | |
225 | 225 | public function testis_point_in_area() { |
226 | 226 | |
227 | - $jjwgAreas = new jjwg_Areas(); |
|
227 | + $jjwgAreas = new jjwg_Areas(); |
|
228 | 228 | |
229 | - //test without setting up coordinates |
|
230 | - $this->assertEquals(false, $jjwgAreas->is_point_in_area(100,40) ); |
|
229 | + //test without setting up coordinates |
|
230 | + $this->assertEquals(false, $jjwgAreas->is_point_in_area(100,40) ); |
|
231 | 231 | |
232 | 232 | |
233 | - //test with coordinates set |
|
234 | - $jjwgAreas->coordinates= "100,40,10 101,81,11 102,82,12"; |
|
235 | - $this->assertEquals(false, $jjwgAreas->is_point_in_area(101,40) ); |
|
236 | - $this->assertEquals(true, $jjwgAreas->is_point_in_area(100,40) ); |
|
233 | + //test with coordinates set |
|
234 | + $jjwgAreas->coordinates= "100,40,10 101,81,11 102,82,12"; |
|
235 | + $this->assertEquals(false, $jjwgAreas->is_point_in_area(101,40) ); |
|
236 | + $this->assertEquals(true, $jjwgAreas->is_point_in_area(100,40) ); |
|
237 | 237 | |
238 | 238 | } |
239 | 239 | |
240 | 240 | |
241 | 241 | public function testpoint_in_polygon() { |
242 | 242 | |
243 | - $jjwgAreas = new jjwg_Areas(); |
|
243 | + $jjwgAreas = new jjwg_Areas(); |
|
244 | 244 | |
245 | - //test without setting up coordinates |
|
246 | - $this->assertEquals(false, $jjwgAreas->point_in_polygon('100,40,0.0') ); |
|
245 | + //test without setting up coordinates |
|
246 | + $this->assertEquals(false, $jjwgAreas->point_in_polygon('100,40,0.0') ); |
|
247 | 247 | |
248 | 248 | |
249 | - //test with coordinates set |
|
250 | - $jjwgAreas->coordinates= "100,40,10 101,81,11 102,82,12"; |
|
251 | - $this->assertEquals(true, $jjwgAreas->point_in_polygon('100,40,0.0') ); |
|
249 | + //test with coordinates set |
|
250 | + $jjwgAreas->coordinates= "100,40,10 101,81,11 102,82,12"; |
|
251 | + $this->assertEquals(true, $jjwgAreas->point_in_polygon('100,40,0.0') ); |
|
252 | 252 | |
253 | 253 | } |
254 | 254 | |
255 | 255 | public function testpoint_on_vertex() { |
256 | 256 | |
257 | - $jjwgAreas = new jjwg_Areas(); |
|
257 | + $jjwgAreas = new jjwg_Areas(); |
|
258 | 258 | |
259 | - $vertices= array("100,40,10", "101,81,11", "102,82,12"); |
|
260 | - $this->assertEquals(false, $jjwgAreas->point_on_vertex("100,40,0.0",$vertices)); |
|
261 | - $this->assertEquals(true, $jjwgAreas->point_on_vertex("100,40,10",$vertices)); |
|
259 | + $vertices= array("100,40,10", "101,81,11", "102,82,12"); |
|
260 | + $this->assertEquals(false, $jjwgAreas->point_on_vertex("100,40,0.0",$vertices)); |
|
261 | + $this->assertEquals(true, $jjwgAreas->point_on_vertex("100,40,10",$vertices)); |
|
262 | 262 | |
263 | 263 | } |
264 | 264 | |
265 | 265 | public function testpoint_string_to_coordinates() { |
266 | 266 | |
267 | - $jjwgAreas = new jjwg_Areas(); |
|
267 | + $jjwgAreas = new jjwg_Areas(); |
|
268 | 268 | |
269 | - $expected = array("x"=>100,"y"=>40); |
|
270 | - $actual = $jjwgAreas->point_string_to_coordinates("100,40,10"); |
|
271 | - $this->assertEquals($expected, $actual); |
|
269 | + $expected = array("x"=>100,"y"=>40); |
|
270 | + $actual = $jjwgAreas->point_string_to_coordinates("100,40,10"); |
|
271 | + $this->assertEquals($expected, $actual); |
|
272 | 272 | |
273 | 273 | } |
274 | 274 |
@@ -5,95 +5,95 @@ |
||
5 | 5 | |
6 | 6 | public function testAdministration() { |
7 | 7 | |
8 | - //execute the contructor and check for the Object type and type attribute |
|
9 | - $admin = new Administration(); |
|
10 | - $this->assertInstanceOf('Administration',$admin); |
|
11 | - $this->assertInstanceOf('SugarBean',$admin); |
|
8 | + //execute the contructor and check for the Object type and type attribute |
|
9 | + $admin = new Administration(); |
|
10 | + $this->assertInstanceOf('Administration',$admin); |
|
11 | + $this->assertInstanceOf('SugarBean',$admin); |
|
12 | 12 | |
13 | - $this->assertAttributeEquals('Administration', 'module_dir', $admin); |
|
14 | - $this->assertAttributeEquals('Administration', 'object_name', $admin); |
|
15 | - $this->assertAttributeEquals('config', 'table_name', $admin); |
|
16 | - $this->assertAttributeEquals(true, 'new_schema', $admin); |
|
17 | - $this->assertAttributeEquals(true, 'disable_custom_fields', $admin); |
|
18 | - $this->assertAttributeEquals( array('disclosure', 'notify','system','portal','proxy','massemailer','ldap','captcha','sugarpdf') , 'config_categories', $admin); |
|
19 | - $this->assertAttributeEquals( array("notify_send_by_default", "mail_smtpauth_req", "notify_on", 'portal_on', 'skypeout_on', 'system_mailmerge_on', 'proxy_auth', 'proxy_on', 'system_ldap_enabled','captcha_on') , 'checkbox_fields', $admin); |
|
13 | + $this->assertAttributeEquals('Administration', 'module_dir', $admin); |
|
14 | + $this->assertAttributeEquals('Administration', 'object_name', $admin); |
|
15 | + $this->assertAttributeEquals('config', 'table_name', $admin); |
|
16 | + $this->assertAttributeEquals(true, 'new_schema', $admin); |
|
17 | + $this->assertAttributeEquals(true, 'disable_custom_fields', $admin); |
|
18 | + $this->assertAttributeEquals( array('disclosure', 'notify','system','portal','proxy','massemailer','ldap','captcha','sugarpdf') , 'config_categories', $admin); |
|
19 | + $this->assertAttributeEquals( array("notify_send_by_default", "mail_smtpauth_req", "notify_on", 'portal_on', 'skypeout_on', 'system_mailmerge_on', 'proxy_auth', 'proxy_on', 'system_ldap_enabled','captcha_on') , 'checkbox_fields', $admin); |
|
20 | 20 | |
21 | 21 | } |
22 | 22 | |
23 | 23 | public function testretrieveSettings() { |
24 | 24 | |
25 | - $admin = new Administration(); |
|
25 | + $admin = new Administration(); |
|
26 | 26 | |
27 | - //execute with default parameters and test if it returns object itself |
|
28 | - $result = $admin->retrieveSettings(); |
|
29 | - $this->assertInstanceOf('Administration',$result); |
|
30 | - $this->assertSame($admin,$result); |
|
27 | + //execute with default parameters and test if it returns object itself |
|
28 | + $result = $admin->retrieveSettings(); |
|
29 | + $this->assertInstanceOf('Administration',$result); |
|
30 | + $this->assertSame($admin,$result); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | - //execute with a invalid category and test if it returns object itself. |
|
35 | - $result = $admin->retrieveSettings('test'); |
|
36 | - $this->assertInstanceOf('Administration',$result); |
|
37 | - $this->assertSame($admin,$result); |
|
38 | - $this->assertEquals(true,$admin->settings['test']); |
|
34 | + //execute with a invalid category and test if it returns object itself. |
|
35 | + $result = $admin->retrieveSettings('test'); |
|
36 | + $this->assertInstanceOf('Administration',$result); |
|
37 | + $this->assertSame($admin,$result); |
|
38 | + $this->assertEquals(true,$admin->settings['test']); |
|
39 | 39 | |
40 | 40 | |
41 | 41 | |
42 | - //execute with a valid category and test if it returns object itself. |
|
43 | - $result = $admin->retrieveSettings('notify'); |
|
44 | - $this->assertInstanceOf('Administration',$result); |
|
45 | - $this->assertSame($admin,$result); |
|
42 | + //execute with a valid category and test if it returns object itself. |
|
43 | + $result = $admin->retrieveSettings('notify'); |
|
44 | + $this->assertInstanceOf('Administration',$result); |
|
45 | + $this->assertSame($admin,$result); |
|
46 | 46 | |
47 | 47 | |
48 | 48 | |
49 | - //execute with a valid category and clean=true and test if it returns object itself. |
|
50 | - $admin = new Administration(); |
|
51 | - $result = $admin->retrieveSettings('notify',true); |
|
52 | - $this->assertInstanceOf('Administration',$result); |
|
53 | - $this->assertSame($admin,$result); |
|
49 | + //execute with a valid category and clean=true and test if it returns object itself. |
|
50 | + $admin = new Administration(); |
|
51 | + $result = $admin->retrieveSettings('notify',true); |
|
52 | + $this->assertInstanceOf('Administration',$result); |
|
53 | + $this->assertSame($admin,$result); |
|
54 | 54 | |
55 | 55 | |
56 | 56 | } |
57 | 57 | |
58 | 58 | public function testsaveConfig() { |
59 | 59 | |
60 | - $admin = new Administration(); |
|
60 | + $admin = new Administration(); |
|
61 | 61 | |
62 | - $_POST['proxy_test'] = "test value"; |
|
62 | + $_POST['proxy_test'] = "test value"; |
|
63 | 63 | |
64 | - //execute the method and verify that it sets the correct config key |
|
65 | - $admin->saveConfig(); |
|
66 | - $actual = $admin->settings['proxy_test']; |
|
67 | - $this->assertEquals($actual, "test value" ); |
|
64 | + //execute the method and verify that it sets the correct config key |
|
65 | + $admin->saveConfig(); |
|
66 | + $actual = $admin->settings['proxy_test']; |
|
67 | + $this->assertEquals($actual, "test value" ); |
|
68 | 68 | |
69 | 69 | } |
70 | 70 | |
71 | 71 | public function testsaveSetting() { |
72 | 72 | |
73 | - $admin = new Administration(); |
|
73 | + $admin = new Administration(); |
|
74 | 74 | |
75 | - //execute the method and verify that sets the correct config key |
|
76 | - $result = $admin->saveSetting('category', 'key', 'test value'); |
|
77 | - $admin->retrieveSettings('category'); |
|
78 | - $actual = $admin->settings['category_key']; |
|
79 | - $this->assertEquals($actual, "test value" ); |
|
75 | + //execute the method and verify that sets the correct config key |
|
76 | + $result = $admin->saveSetting('category', 'key', 'test value'); |
|
77 | + $admin->retrieveSettings('category'); |
|
78 | + $actual = $admin->settings['category_key']; |
|
79 | + $this->assertEquals($actual, "test value" ); |
|
80 | 80 | |
81 | 81 | } |
82 | 82 | |
83 | 83 | public function testget_config_prefix() { |
84 | 84 | |
85 | - $admin = new Administration(); |
|
85 | + $admin = new Administration(); |
|
86 | 86 | |
87 | - //test with empty string |
|
88 | - $expected = Array(false, false); |
|
89 | - $actual = $admin->get_config_prefix(""); |
|
90 | - $this->assertSame($expected, $actual); |
|
87 | + //test with empty string |
|
88 | + $expected = Array(false, false); |
|
89 | + $actual = $admin->get_config_prefix(""); |
|
90 | + $this->assertSame($expected, $actual); |
|
91 | 91 | |
92 | 92 | |
93 | - //test with a valid string |
|
94 | - $expected = Array("category", "test"); |
|
95 | - $actual = $admin->get_config_prefix("category_test"); |
|
96 | - $this->assertSame($expected, $actual); |
|
93 | + //test with a valid string |
|
94 | + $expected = Array("category", "test"); |
|
95 | + $actual = $admin->get_config_prefix("category_test"); |
|
96 | + $this->assertSame($expected, $actual); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 |
@@ -4,163 +4,163 @@ discard block |
||
4 | 4 | |
5 | 5 | class EmailTest extends PHPUnit_Framework_TestCase { |
6 | 6 | |
7 | - public function testEmail() |
|
8 | - { |
|
7 | + public function testEmail() |
|
8 | + { |
|
9 | 9 | |
10 | - //execute the contructor and check for the Object type and attributes |
|
11 | - $email = new Email(); |
|
12 | - $this->assertInstanceOf('Email',$email); |
|
13 | - $this->assertInstanceOf('SugarBean',$email); |
|
10 | + //execute the contructor and check for the Object type and attributes |
|
11 | + $email = new Email(); |
|
12 | + $this->assertInstanceOf('Email',$email); |
|
13 | + $this->assertInstanceOf('SugarBean',$email); |
|
14 | 14 | |
15 | - $this->assertAttributeEquals('Emails', 'module_dir', $email); |
|
16 | - $this->assertAttributeEquals('Email', 'object_name', $email); |
|
17 | - $this->assertAttributeEquals('emails', 'table_name', $email); |
|
18 | - $this->assertAttributeEquals('Emails', 'module_name', $email); |
|
15 | + $this->assertAttributeEquals('Emails', 'module_dir', $email); |
|
16 | + $this->assertAttributeEquals('Email', 'object_name', $email); |
|
17 | + $this->assertAttributeEquals('emails', 'table_name', $email); |
|
18 | + $this->assertAttributeEquals('Emails', 'module_name', $email); |
|
19 | 19 | |
20 | - $this->assertAttributeEquals(true, 'new_schema', $email); |
|
21 | - $this->assertAttributeEquals('archived', 'type', $email); |
|
20 | + $this->assertAttributeEquals(true, 'new_schema', $email); |
|
21 | + $this->assertAttributeEquals('archived', 'type', $email); |
|
22 | 22 | |
23 | - } |
|
23 | + } |
|
24 | 24 | |
25 | - public function testemail2init() { |
|
25 | + public function testemail2init() { |
|
26 | 26 | |
27 | - error_reporting(E_ERROR | E_PARSE); |
|
27 | + error_reporting(E_ERROR | E_PARSE); |
|
28 | 28 | |
29 | - $email = new Email(); |
|
30 | - $email->email2init(); |
|
29 | + $email = new Email(); |
|
30 | + $email->email2init(); |
|
31 | 31 | |
32 | - $this->assertInstanceOf('EmailUI',$email->et); |
|
32 | + $this->assertInstanceOf('EmailUI',$email->et); |
|
33 | 33 | |
34 | - } |
|
34 | + } |
|
35 | 35 | |
36 | - public function testbean_implements(){ |
|
36 | + public function testbean_implements(){ |
|
37 | 37 | |
38 | - $email = new Email(); |
|
39 | - $this->assertEquals(false, $email->bean_implements('')); //test with blank value |
|
40 | - $this->assertEquals(false, $email->bean_implements('test')); //test with invalid value |
|
41 | - $this->assertEquals(true, $email->bean_implements('ACL')); //test with valid value |
|
38 | + $email = new Email(); |
|
39 | + $this->assertEquals(false, $email->bean_implements('')); //test with blank value |
|
40 | + $this->assertEquals(false, $email->bean_implements('test')); //test with invalid value |
|
41 | + $this->assertEquals(true, $email->bean_implements('ACL')); //test with valid value |
|
42 | 42 | |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - public function testemail2saveAttachment() |
|
47 | - { |
|
46 | + public function testemail2saveAttachment() |
|
47 | + { |
|
48 | 48 | |
49 | - $email = new Email(); |
|
50 | - $result = $email->email2saveAttachment(); |
|
51 | - $this->assertTrue(is_array($result)); |
|
49 | + $email = new Email(); |
|
50 | + $result = $email->email2saveAttachment(); |
|
51 | + $this->assertTrue(is_array($result)); |
|
52 | 52 | |
53 | - } |
|
53 | + } |
|
54 | 54 | |
55 | - public function testsafeAttachmentName() { |
|
55 | + public function testsafeAttachmentName() { |
|
56 | 56 | |
57 | - $email = new Email(); |
|
57 | + $email = new Email(); |
|
58 | 58 | |
59 | - $this->assertEquals(false,$email->safeAttachmentName("test.ext")); |
|
60 | - $this->assertEquals(false,$email->safeAttachmentName("test.exe")); |
|
61 | - $this->assertEquals(true,$email->safeAttachmentName("test.cgi")); |
|
59 | + $this->assertEquals(false,$email->safeAttachmentName("test.ext")); |
|
60 | + $this->assertEquals(false,$email->safeAttachmentName("test.exe")); |
|
61 | + $this->assertEquals(true,$email->safeAttachmentName("test.cgi")); |
|
62 | 62 | |
63 | - } |
|
63 | + } |
|
64 | 64 | |
65 | 65 | |
66 | - public function testemail2ParseAddresses() { |
|
66 | + public function testemail2ParseAddresses() { |
|
67 | 67 | |
68 | 68 | |
69 | - $email = new Email(); |
|
69 | + $email = new Email(); |
|
70 | 70 | |
71 | - $email->email2init(); |
|
72 | - $addresses = "abc<[email protected]>,xyz<[email protected]>"; |
|
73 | - $expected = array (array('email' =>'[email protected]', 'display' => 'abc'), array('email' => '[email protected]','display' => 'xyz')); |
|
71 | + $email->email2init(); |
|
72 | + $addresses = "abc<[email protected]>,xyz<[email protected]>"; |
|
73 | + $expected = array (array('email' =>'[email protected]', 'display' => 'abc'), array('email' => '[email protected]','display' => 'xyz')); |
|
74 | 74 | |
75 | - $result = $email->email2ParseAddresses($addresses); |
|
76 | - $this->assertSame($expected, $result); |
|
75 | + $result = $email->email2ParseAddresses($addresses); |
|
76 | + $this->assertSame($expected, $result); |
|
77 | 77 | |
78 | - } |
|
78 | + } |
|
79 | 79 | |
80 | 80 | |
81 | - public function testemail2ParseAddressesForAddressesOnly() { |
|
81 | + public function testemail2ParseAddressesForAddressesOnly() { |
|
82 | 82 | |
83 | - $email = new Email(); |
|
83 | + $email = new Email(); |
|
84 | 84 | |
85 | - //test with simplest format |
|
86 | - $addresses = "[email protected],[email protected]"; |
|
87 | - $result = $email->email2ParseAddressesForAddressesOnly($addresses); |
|
88 | - $this->assertEquals(array("[email protected]", "[email protected]"), $result ); |
|
85 | + //test with simplest format |
|
86 | + $addresses = "[email protected],[email protected]"; |
|
87 | + $result = $email->email2ParseAddressesForAddressesOnly($addresses); |
|
88 | + $this->assertEquals(array("[email protected]", "[email protected]"), $result ); |
|
89 | 89 | |
90 | - //test with more used format |
|
91 | - $addresses = "abc<[email protected]>,xyz<[email protected]>"; |
|
92 | - $result = $email->email2ParseAddressesForAddressesOnly($addresses); |
|
93 | - $this->assertEquals(array("[email protected]", "[email protected]"), $result ); |
|
90 | + //test with more used format |
|
91 | + $addresses = "abc<[email protected]>,xyz<[email protected]>"; |
|
92 | + $result = $email->email2ParseAddressesForAddressesOnly($addresses); |
|
93 | + $this->assertEquals(array("[email protected]", "[email protected]"), $result ); |
|
94 | 94 | |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | 97 | |
98 | 98 | |
99 | - public function testemail2GetMime() { |
|
99 | + public function testemail2GetMime() { |
|
100 | 100 | |
101 | - $email = new Email(); |
|
101 | + $email = new Email(); |
|
102 | 102 | |
103 | - //test without a filename |
|
104 | - $result = $email->email2GetMime(); |
|
105 | - $this->assertEquals("application/octet-stream", $result ); |
|
103 | + //test without a filename |
|
104 | + $result = $email->email2GetMime(); |
|
105 | + $this->assertEquals("application/octet-stream", $result ); |
|
106 | 106 | |
107 | - //test with a filename |
|
108 | - $result = $email->email2GetMime('config.php'); |
|
109 | - $this->assertEquals("text/x-php", $result); |
|
107 | + //test with a filename |
|
108 | + $result = $email->email2GetMime('config.php'); |
|
109 | + $this->assertEquals("text/x-php", $result); |
|
110 | 110 | |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | 113 | |
114 | - public function testdecodeDuringSend() { |
|
114 | + public function testdecodeDuringSend() { |
|
115 | 115 | |
116 | - $email = new Email(); |
|
116 | + $email = new Email(); |
|
117 | 117 | |
118 | - $this->assertEquals("some text", $email->decodeDuringSend("some text") ); |
|
119 | - $this->assertEquals("< some text >", $email->decodeDuringSend("sugarLessThan some text sugarGreaterThan") ); |
|
118 | + $this->assertEquals("some text", $email->decodeDuringSend("some text") ); |
|
119 | + $this->assertEquals("< some text >", $email->decodeDuringSend("sugarLessThan some text sugarGreaterThan") ); |
|
120 | 120 | |
121 | - } |
|
121 | + } |
|
122 | 122 | |
123 | 123 | |
124 | - public function testisDraftEmail() |
|
125 | - { |
|
126 | - $email = new Email(); |
|
124 | + public function testisDraftEmail() |
|
125 | + { |
|
126 | + $email = new Email(); |
|
127 | 127 | |
128 | - //test with required parametr set |
|
129 | - $this->assertEquals(true, $email->isDraftEmail(array('saveDraft'=>'1')) ); |
|
128 | + //test with required parametr set |
|
129 | + $this->assertEquals(true, $email->isDraftEmail(array('saveDraft'=>'1')) ); |
|
130 | 130 | |
131 | 131 | |
132 | - //test with one of required attribute set |
|
133 | - $email->type = 'draft'; |
|
134 | - $this->assertEquals(false, $email->isDraftEmail()); |
|
132 | + //test with one of required attribute set |
|
133 | + $email->type = 'draft'; |
|
134 | + $this->assertEquals(false, $email->isDraftEmail()); |
|
135 | 135 | |
136 | 136 | |
137 | - //test with both of required attribute set |
|
138 | - $email->status = 'draft'; |
|
139 | - $this->assertEquals(true, $email->isDraftEmail()); |
|
137 | + //test with both of required attribute set |
|
138 | + $email->status = 'draft'; |
|
139 | + $this->assertEquals(true, $email->isDraftEmail()); |
|
140 | 140 | |
141 | - } |
|
141 | + } |
|
142 | 142 | |
143 | 143 | |
144 | 144 | public function testgetNamePlusEmailAddressesForCompose() |
145 | 145 | { |
146 | - $email = new Email(); |
|
146 | + $email = new Email(); |
|
147 | 147 | |
148 | - $result = $email->getNamePlusEmailAddressesForCompose("Users", array(1)); |
|
149 | - $this->assertGreaterThanOrEqual(0, strlen($result)); |
|
148 | + $result = $email->getNamePlusEmailAddressesForCompose("Users", array(1)); |
|
149 | + $this->assertGreaterThanOrEqual(0, strlen($result)); |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
153 | 153 | public function test_arrayToDelimitedString() |
154 | 154 | { |
155 | - $email = new Email(); |
|
155 | + $email = new Email(); |
|
156 | 156 | |
157 | - //test with empty array |
|
158 | - $result = $email->_arrayToDelimitedString(array()); |
|
159 | - $this->assertEquals("", $result); |
|
157 | + //test with empty array |
|
158 | + $result = $email->_arrayToDelimitedString(array()); |
|
159 | + $this->assertEquals("", $result); |
|
160 | 160 | |
161 | - //test with valid array |
|
162 | - $result = $email->_arrayToDelimitedString(array('value1','value2')); |
|
163 | - $this->assertEquals("value1,value2", $result); |
|
161 | + //test with valid array |
|
162 | + $result = $email->_arrayToDelimitedString(array('value1','value2')); |
|
163 | + $this->assertEquals("value1,value2", $result); |
|
164 | 164 | |
165 | 165 | } |
166 | 166 | |
@@ -213,734 +213,734 @@ discard block |
||
213 | 213 | */ |
214 | 214 | } |
215 | 215 | |
216 | - public function testsaveAndOthers() |
|
217 | - { |
|
218 | - |
|
219 | - $email = new Email(); |
|
220 | - |
|
221 | - $email->from_addr = "[email protected]"; |
|
222 | - $email->to_addrs = "[email protected]"; |
|
223 | - $email->cc_addrs = "[email protected]"; |
|
224 | - $email->bcc_addrs = "[email protected]"; |
|
225 | - |
|
226 | - $email->from_addr_name = "from"; |
|
227 | - $email->to_addrs_names = "to"; |
|
228 | - $email->cc_addrs_names = "cc"; |
|
229 | - $email->bcc_addrs_names = "bcc"; |
|
230 | - $email->reply_to_addr = "[email protected]"; |
|
231 | - $email->description = "test description"; |
|
232 | - $email->description_html = "test html description"; |
|
233 | - $email->raw_source = "test raw source"; |
|
216 | + public function testsaveAndOthers() |
|
217 | + { |
|
218 | + |
|
219 | + $email = new Email(); |
|
220 | + |
|
221 | + $email->from_addr = "[email protected]"; |
|
222 | + $email->to_addrs = "[email protected]"; |
|
223 | + $email->cc_addrs = "[email protected]"; |
|
224 | + $email->bcc_addrs = "[email protected]"; |
|
225 | + |
|
226 | + $email->from_addr_name = "from"; |
|
227 | + $email->to_addrs_names = "to"; |
|
228 | + $email->cc_addrs_names = "cc"; |
|
229 | + $email->bcc_addrs_names = "bcc"; |
|
230 | + $email->reply_to_addr = "[email protected]"; |
|
231 | + $email->description = "test description"; |
|
232 | + $email->description_html = "test html description"; |
|
233 | + $email->raw_source = "test raw source"; |
|
234 | 234 | |
235 | - $result = $email->save(); |
|
235 | + $result = $email->save(); |
|
236 | 236 | |
237 | - //test for record ID to verify that record is saved |
|
238 | - $this->assertTrue(isset($email->id)); |
|
239 | - $this->assertEquals(36, strlen($email->id)); |
|
237 | + //test for record ID to verify that record is saved |
|
238 | + $this->assertTrue(isset($email->id)); |
|
239 | + $this->assertEquals(36, strlen($email->id)); |
|
240 | 240 | |
241 | 241 | |
242 | - //test retrieve method |
|
243 | - $this->retrieve($email->id); |
|
242 | + //test retrieve method |
|
243 | + $this->retrieve($email->id); |
|
244 | 244 | |
245 | 245 | |
246 | - //test retrieveEmailAddresses method |
|
247 | - $this->retrieveEmailAddresses($email->id); |
|
246 | + //test retrieveEmailAddresses method |
|
247 | + $this->retrieveEmailAddresses($email->id); |
|
248 | 248 | |
249 | 249 | |
250 | - //test retrieveEmailText method |
|
251 | - $this->retrieveEmailText($email->id); |
|
250 | + //test retrieveEmailText method |
|
251 | + $this->retrieveEmailText($email->id); |
|
252 | 252 | |
253 | 253 | |
254 | - //test saveEmailAddresses method |
|
255 | - $this->saveEmailAddresses($email->id); |
|
254 | + //test saveEmailAddresses method |
|
255 | + $this->saveEmailAddresses($email->id); |
|
256 | 256 | |
257 | 257 | |
258 | - //test linkEmailToAddres method |
|
259 | - $this->linkEmailToAddress($email->id); |
|
258 | + //test linkEmailToAddres method |
|
259 | + $this->linkEmailToAddress($email->id); |
|
260 | 260 | |
261 | 261 | |
262 | - //test handleAttachments method |
|
263 | - $this->handleAttachments($email->id); |
|
262 | + //test handleAttachments method |
|
263 | + $this->handleAttachments($email->id); |
|
264 | 264 | |
265 | - //test delete method |
|
266 | - $this->delete($email->id); |
|
265 | + //test delete method |
|
266 | + $this->delete($email->id); |
|
267 | 267 | |
268 | - } |
|
268 | + } |
|
269 | 269 | |
270 | - public function retrieve($id) |
|
271 | - { |
|
272 | - $email = new Email(); |
|
270 | + public function retrieve($id) |
|
271 | + { |
|
272 | + $email = new Email(); |
|
273 | 273 | |
274 | - $result = $email->retrieve($id); |
|
274 | + $result = $email->retrieve($id); |
|
275 | 275 | |
276 | - $this->assertTrue(isset($result->id)); |
|
277 | - $this->assertEquals(36, strlen($result->id)); |
|
276 | + $this->assertTrue(isset($result->id)); |
|
277 | + $this->assertEquals(36, strlen($result->id)); |
|
278 | 278 | |
279 | 279 | |
280 | - $this->assertTrue(isset($result->from_addr)); |
|
281 | - $this->assertTrue(isset($result->to_addrs)); |
|
282 | - $this->assertTrue(isset($result->cc_addrs)); |
|
283 | - $this->assertTrue(isset($result->bcc_addrs)); |
|
280 | + $this->assertTrue(isset($result->from_addr)); |
|
281 | + $this->assertTrue(isset($result->to_addrs)); |
|
282 | + $this->assertTrue(isset($result->cc_addrs)); |
|
283 | + $this->assertTrue(isset($result->bcc_addrs)); |
|
284 | 284 | |
285 | 285 | |
286 | - $this->assertTrue(isset($result->raw_source)); |
|
287 | - $this->assertTrue(isset($result->description_html)); |
|
286 | + $this->assertTrue(isset($result->raw_source)); |
|
287 | + $this->assertTrue(isset($result->description_html)); |
|
288 | 288 | |
289 | - } |
|
289 | + } |
|
290 | 290 | |
291 | 291 | |
292 | - public function saveEmailAddresses($id) { |
|
292 | + public function saveEmailAddresses($id) { |
|
293 | 293 | |
294 | - $email = new Email(); |
|
294 | + $email = new Email(); |
|
295 | 295 | |
296 | - $email->id = $id; |
|
297 | - $email->from_addr = "[email protected]"; |
|
298 | - $email->to_addrs = "[email protected]"; |
|
299 | - $email->cc_addrs = "[email protected]"; |
|
300 | - $email->bcc_addrs = "[email protected]"; |
|
296 | + $email->id = $id; |
|
297 | + $email->from_addr = "[email protected]"; |
|
298 | + $email->to_addrs = "[email protected]"; |
|
299 | + $email->cc_addrs = "[email protected]"; |
|
300 | + $email->bcc_addrs = "[email protected]"; |
|
301 | 301 | |
302 | - $email->saveEmailAddresses(); |
|
302 | + $email->saveEmailAddresses(); |
|
303 | 303 | |
304 | 304 | |
305 | - //retrieve and verify that email addresses were saved properly |
|
306 | - $email->retrieveEmailAddresses(); |
|
305 | + //retrieve and verify that email addresses were saved properly |
|
306 | + $email->retrieveEmailAddresses(); |
|
307 | 307 | |
308 | - $this->assertNotSame(false, strpos($email->from_addr, "[email protected]") ); |
|
309 | - $this->assertNotSame(false, strpos($email->to_addrs, "[email protected]") ); |
|
310 | - $this->assertNotSame(false, strpos($email->cc_addrs, "[email protected]") ); |
|
311 | - $this->assertNotSame(false, strpos($email->bcc_addrs, "[email protected]") ); |
|
308 | + $this->assertNotSame(false, strpos($email->from_addr, "[email protected]") ); |
|
309 | + $this->assertNotSame(false, strpos($email->to_addrs, "[email protected]") ); |
|
310 | + $this->assertNotSame(false, strpos($email->cc_addrs, "[email protected]") ); |
|
311 | + $this->assertNotSame(false, strpos($email->bcc_addrs, "[email protected]") ); |
|
312 | 312 | |
313 | - } |
|
313 | + } |
|
314 | 314 | |
315 | 315 | |
316 | - public function retrieveEmailAddresses($id) { |
|
316 | + public function retrieveEmailAddresses($id) { |
|
317 | 317 | |
318 | - $email = new Email(); |
|
318 | + $email = new Email(); |
|
319 | 319 | |
320 | - $email->id = $id; |
|
321 | - $email->retrieveEmailAddresses(); |
|
320 | + $email->id = $id; |
|
321 | + $email->retrieveEmailAddresses(); |
|
322 | 322 | |
323 | - $this->assertTrue(isset($email->from_addr)); |
|
324 | - $this->assertTrue(isset($email->to_addrs)); |
|
325 | - $this->assertTrue(isset($email->cc_addrs)); |
|
326 | - $this->assertTrue(isset($email->bcc_addrs)); |
|
323 | + $this->assertTrue(isset($email->from_addr)); |
|
324 | + $this->assertTrue(isset($email->to_addrs)); |
|
325 | + $this->assertTrue(isset($email->cc_addrs)); |
|
326 | + $this->assertTrue(isset($email->bcc_addrs)); |
|
327 | 327 | |
328 | - } |
|
328 | + } |
|
329 | 329 | |
330 | - public function linkEmailToAddress($id) { |
|
330 | + public function linkEmailToAddress($id) { |
|
331 | 331 | |
332 | - $email = new Email(); |
|
332 | + $email = new Email(); |
|
333 | 333 | |
334 | - $email->id = $id; |
|
334 | + $email->id = $id; |
|
335 | 335 | |
336 | - $result = $email->linkEmailToAddress(1, 'from'); |
|
336 | + $result = $email->linkEmailToAddress(1, 'from'); |
|
337 | 337 | |
338 | - $this->assertTrue(isset($result)); |
|
339 | - $this->assertEquals(36, strlen($result)); |
|
338 | + $this->assertTrue(isset($result)); |
|
339 | + $this->assertEquals(36, strlen($result)); |
|
340 | 340 | |
341 | - } |
|
341 | + } |
|
342 | 342 | |
343 | 343 | |
344 | - public function retrieveEmailText($id) { |
|
344 | + public function retrieveEmailText($id) { |
|
345 | 345 | |
346 | - $email = new Email(); |
|
346 | + $email = new Email(); |
|
347 | 347 | |
348 | - $email->id = $id; |
|
348 | + $email->id = $id; |
|
349 | 349 | |
350 | - $email->retrieveEmailText(); |
|
350 | + $email->retrieveEmailText(); |
|
351 | 351 | |
352 | - $this->assertTrue(isset($email->from_addr_name)); |
|
353 | - $this->assertTrue(isset($email->reply_to_addr)); |
|
354 | - $this->assertTrue(isset($email->to_addrs_names)); |
|
355 | - $this->assertTrue(isset($email->cc_addrs_names)); |
|
356 | - $this->assertTrue(isset($email->bcc_addrs_names)); |
|
352 | + $this->assertTrue(isset($email->from_addr_name)); |
|
353 | + $this->assertTrue(isset($email->reply_to_addr)); |
|
354 | + $this->assertTrue(isset($email->to_addrs_names)); |
|
355 | + $this->assertTrue(isset($email->cc_addrs_names)); |
|
356 | + $this->assertTrue(isset($email->bcc_addrs_names)); |
|
357 | 357 | |
358 | - $this->assertTrue(isset($email->raw_source)); |
|
359 | - $this->assertTrue(isset($email->description_html)); |
|
358 | + $this->assertTrue(isset($email->raw_source)); |
|
359 | + $this->assertTrue(isset($email->description_html)); |
|
360 | 360 | |
361 | - } |
|
361 | + } |
|
362 | 362 | |
363 | 363 | |
364 | - public function handleAttachments($id) { |
|
364 | + public function handleAttachments($id) { |
|
365 | 365 | |
366 | - $email = new Email(); |
|
366 | + $email = new Email(); |
|
367 | 367 | |
368 | - $email = $email->retrieve($id); |
|
368 | + $email = $email->retrieve($id); |
|
369 | 369 | |
370 | - $email->type = 'out'; |
|
371 | - $email->status ='draft'; |
|
372 | - $_REQUEST['record'] = $id; |
|
370 | + $email->type = 'out'; |
|
371 | + $email->status ='draft'; |
|
372 | + $_REQUEST['record'] = $id; |
|
373 | 373 | |
374 | - $email->handleAttachments(); |
|
374 | + $email->handleAttachments(); |
|
375 | 375 | |
376 | 376 | |
377 | - $this->assertTrue(is_array($email->attachments)); |
|
377 | + $this->assertTrue(is_array($email->attachments)); |
|
378 | 378 | |
379 | - } |
|
379 | + } |
|
380 | 380 | |
381 | - public function delete($id) { |
|
381 | + public function delete($id) { |
|
382 | 382 | |
383 | - $email = new Email(); |
|
383 | + $email = new Email(); |
|
384 | 384 | |
385 | - $email->delete($id); |
|
385 | + $email->delete($id); |
|
386 | 386 | |
387 | - $result = $email->retrieve($id); |
|
388 | - $this->assertEquals(null,$result); |
|
387 | + $result = $email->retrieve($id); |
|
388 | + $this->assertEquals(null,$result); |
|
389 | 389 | |
390 | - } |
|
390 | + } |
|
391 | 391 | |
392 | 392 | |
393 | - public function testSaveTempNoteAttachmentsAndGetNotesAndDoesImportedEmailHaveAttachment() |
|
394 | - { |
|
393 | + public function testSaveTempNoteAttachmentsAndGetNotesAndDoesImportedEmailHaveAttachment() |
|
394 | + { |
|
395 | 395 | |
396 | - $email = new Email(); |
|
396 | + $email = new Email(); |
|
397 | 397 | |
398 | - $email->id = 1; |
|
398 | + $email->id = 1; |
|
399 | 399 | |
400 | - //test saveTempNoteAttachments method to create a note for email |
|
401 | - $email->saveTempNoteAttachments("test_file","test", "text/plain"); |
|
400 | + //test saveTempNoteAttachments method to create a note for email |
|
401 | + $email->saveTempNoteAttachments("test_file","test", "text/plain"); |
|
402 | 402 | |
403 | 403 | |
404 | 404 | |
405 | - //test doesImportedEmailHaveAttachment method to verify note created. |
|
406 | - $result = $email->doesImportedEmailHaveAttachment($email->id); |
|
407 | - $this->assertEquals(1,$result); |
|
405 | + //test doesImportedEmailHaveAttachment method to verify note created. |
|
406 | + $result = $email->doesImportedEmailHaveAttachment($email->id); |
|
407 | + $this->assertEquals(1,$result); |
|
408 | 408 | |
409 | 409 | |
410 | 410 | |
411 | - //test getNotes method and verify that it retrieves the created note. |
|
412 | - $email->getNotes($email->id); |
|
413 | - $this->assertTrue(is_array($email->attachments)); |
|
414 | - foreach($email->attachments as $note){ |
|
415 | - $this->assertTrue(isset($note)); |
|
416 | - $this->assertInstanceOf('Note',$note); |
|
417 | - } |
|
411 | + //test getNotes method and verify that it retrieves the created note. |
|
412 | + $email->getNotes($email->id); |
|
413 | + $this->assertTrue(is_array($email->attachments)); |
|
414 | + foreach($email->attachments as $note){ |
|
415 | + $this->assertTrue(isset($note)); |
|
416 | + $this->assertInstanceOf('Note',$note); |
|
417 | + } |
|
418 | 418 | |
419 | 419 | |
420 | - //finally cleanup |
|
421 | - $email->delete($email->id); |
|
420 | + //finally cleanup |
|
421 | + $email->delete($email->id); |
|
422 | 422 | |
423 | - } |
|
423 | + } |
|
424 | 424 | |
425 | 425 | |
426 | - public function testcleanEmails() |
|
427 | - { |
|
428 | - $email = new Email(); |
|
426 | + public function testcleanEmails() |
|
427 | + { |
|
428 | + $email = new Email(); |
|
429 | 429 | |
430 | - //test with simplest format |
|
431 | - $addresses = "[email protected],[email protected]"; |
|
432 | - $result = $email->cleanEmails($addresses); |
|
433 | - $this->assertEquals('[email protected], [email protected]', $result); |
|
430 | + //test with simplest format |
|
431 | + $addresses = "[email protected],[email protected]"; |
|
432 | + $result = $email->cleanEmails($addresses); |
|
433 | + $this->assertEquals('[email protected], [email protected]', $result); |
|
434 | 434 | |
435 | 435 | |
436 | - //test with more used format |
|
437 | - $addresses = "abc<[email protected]>,xyz<[email protected]>"; |
|
438 | - $result = $email->cleanEmails($addresses); |
|
439 | - $this->assertEquals('abc <[email protected]>, xyz <[email protected]>', $result ); |
|
436 | + //test with more used format |
|
437 | + $addresses = "abc<[email protected]>,xyz<[email protected]>"; |
|
438 | + $result = $email->cleanEmails($addresses); |
|
439 | + $this->assertEquals('abc <[email protected]>, xyz <[email protected]>', $result ); |
|
440 | 440 | |
441 | - } |
|
441 | + } |
|
442 | 442 | |
443 | 443 | |
444 | - public function testgetForwardHeader() { |
|
444 | + public function testgetForwardHeader() { |
|
445 | 445 | |
446 | - $email = new Email(); |
|
446 | + $email = new Email(); |
|
447 | 447 | |
448 | - $email->from_name = "from test"; |
|
449 | - $email->name = "test"; |
|
450 | - $email->date_sent = "2016-01-01"; |
|
451 | - $email->to_addrs = "[email protected]"; |
|
452 | - $email->cc_addrs = "[email protected]"; |
|
448 | + $email->from_name = "from test"; |
|
449 | + $email->name = "test"; |
|
450 | + $email->date_sent = "2016-01-01"; |
|
451 | + $email->to_addrs = "[email protected]"; |
|
452 | + $email->cc_addrs = "[email protected]"; |
|
453 | 453 | |
454 | - $expected = "<br /><br />> from test<br />> 2016-01-01<br />> [email protected]<br />> [email protected]<br />> test<br />> <br />"; |
|
454 | + $expected = "<br /><br />> from test<br />> 2016-01-01<br />> [email protected]<br />> [email protected]<br />> test<br />> <br />"; |
|
455 | 455 | |
456 | - $actual = $email->getForwardHeader(); |
|
457 | - $this->assertSame($expected, $actual); |
|
456 | + $actual = $email->getForwardHeader(); |
|
457 | + $this->assertSame($expected, $actual); |
|
458 | 458 | |
459 | - } |
|
459 | + } |
|
460 | 460 | |
461 | 461 | |
462 | - public function testgetReplyHeader() { |
|
462 | + public function testgetReplyHeader() { |
|
463 | 463 | |
464 | - $email = new Email(); |
|
464 | + $email = new Email(); |
|
465 | 465 | |
466 | - $email->from_name = "from test"; |
|
467 | - $email->time_start = "01:01:00"; |
|
468 | - $email->date_start = "2016-01-01"; |
|
466 | + $email->from_name = "from test"; |
|
467 | + $email->time_start = "01:01:00"; |
|
468 | + $email->date_start = "2016-01-01"; |
|
469 | 469 | |
470 | - $expected = "<br> 2016-01-01, 01:01:00, from test "; |
|
470 | + $expected = "<br> 2016-01-01, 01:01:00, from test "; |
|
471 | 471 | |
472 | - $actual = $email->getReplyHeader(); |
|
473 | - $this->assertSame($expected, $actual); |
|
472 | + $actual = $email->getReplyHeader(); |
|
473 | + $this->assertSame($expected, $actual); |
|
474 | 474 | |
475 | - } |
|
475 | + } |
|
476 | 476 | |
477 | 477 | |
478 | 478 | |
479 | - public function testquotePlainTextEmail() { |
|
479 | + public function testquotePlainTextEmail() { |
|
480 | 480 | |
481 | - $email = new Email(); |
|
481 | + $email = new Email(); |
|
482 | 482 | |
483 | - //test with plain string containing no line breaks |
|
484 | - $expected = "\n> some text\r"; |
|
485 | - $actual = $email->quotePlainTextEmail("some text"); |
|
486 | - $this->assertSame($expected, $actual); |
|
483 | + //test with plain string containing no line breaks |
|
484 | + $expected = "\n> some text\r"; |
|
485 | + $actual = $email->quotePlainTextEmail("some text"); |
|
486 | + $this->assertSame($expected, $actual); |
|
487 | 487 | |
488 | 488 | |
489 | - //test with string containing line breaks |
|
490 | - $expected = "\n> some\r> text\r> with\r> new\r> lines\r"; |
|
491 | - $actual = $email->quotePlainTextEmail("some\ntext\nwith\nnew\nlines"); |
|
492 | - $this->assertSame($expected, $actual); |
|
489 | + //test with string containing line breaks |
|
490 | + $expected = "\n> some\r> text\r> with\r> new\r> lines\r"; |
|
491 | + $actual = $email->quotePlainTextEmail("some\ntext\nwith\nnew\nlines"); |
|
492 | + $this->assertSame($expected, $actual); |
|
493 | 493 | |
494 | - } |
|
494 | + } |
|
495 | 495 | |
496 | 496 | |
497 | 497 | |
498 | - public function testquoteHtmlEmail() { |
|
498 | + public function testquoteHtmlEmail() { |
|
499 | 499 | |
500 | - $email = new Email(); |
|
500 | + $email = new Email(); |
|
501 | 501 | |
502 | - //test with empty string |
|
503 | - $expected = ""; |
|
504 | - $actual = $email->quoteHtmlEmail(""); |
|
505 | - $this->assertSame($expected, $actual); |
|
502 | + //test with empty string |
|
503 | + $expected = ""; |
|
504 | + $actual = $email->quoteHtmlEmail(""); |
|
505 | + $this->assertSame($expected, $actual); |
|
506 | 506 | |
507 | 507 | |
508 | - //test with plain string |
|
509 | - $expected = "<div style='border-left:1px solid #00c; padding:5px; margin-left:10px;'>some test</div>"; |
|
510 | - $actual = $email->quoteHtmlEmail("some test"); |
|
511 | - $this->assertSame($expected, $actual); |
|
508 | + //test with plain string |
|
509 | + $expected = "<div style='border-left:1px solid #00c; padding:5px; margin-left:10px;'>some test</div>"; |
|
510 | + $actual = $email->quoteHtmlEmail("some test"); |
|
511 | + $this->assertSame($expected, $actual); |
|
512 | 512 | |
513 | 513 | |
514 | - //test with string containing special charecters |
|
515 | - $expected = "<div style='border-left:1px solid #00c; padding:5px; margin-left:10px;'>some test with <&</div>"; |
|
516 | - $actual = $email->quoteHtmlEmail("some test with <&"); |
|
517 | - $this->assertSame($expected, $actual); |
|
514 | + //test with string containing special charecters |
|
515 | + $expected = "<div style='border-left:1px solid #00c; padding:5px; margin-left:10px;'>some test with <&</div>"; |
|
516 | + $actual = $email->quoteHtmlEmail("some test with <&"); |
|
517 | + $this->assertSame($expected, $actual); |
|
518 | 518 | |
519 | - } |
|
519 | + } |
|
520 | 520 | |
521 | 521 | |
522 | - public function testquoteHtmlEmailForNewEmailUI() { |
|
522 | + public function testquoteHtmlEmailForNewEmailUI() { |
|
523 | 523 | |
524 | - $email = new Email(); |
|
524 | + $email = new Email(); |
|
525 | 525 | |
526 | - //test with empty string |
|
527 | - $expected = ""; |
|
528 | - $actual = $email->quoteHtmlEmailForNewEmailUI(""); |
|
529 | - $this->assertSame($expected, $actual); |
|
526 | + //test with empty string |
|
527 | + $expected = ""; |
|
528 | + $actual = $email->quoteHtmlEmailForNewEmailUI(""); |
|
529 | + $this->assertSame($expected, $actual); |
|
530 | 530 | |
531 | 531 | |
532 | - //test with plain string |
|
533 | - $expected = "<div style='border-left:1px solid #00c; padding:5px; margin-left:10px;'>some test</div>"; |
|
534 | - $actual = $email->quoteHtmlEmailForNewEmailUI("some test"); |
|
535 | - $this->assertSame($expected, $actual); |
|
532 | + //test with plain string |
|
533 | + $expected = "<div style='border-left:1px solid #00c; padding:5px; margin-left:10px;'>some test</div>"; |
|
534 | + $actual = $email->quoteHtmlEmailForNewEmailUI("some test"); |
|
535 | + $this->assertSame($expected, $actual); |
|
536 | 536 | |
537 | 537 | |
538 | - //test with string containing special charecters |
|
539 | - $expected = "<div style='border-left:1px solid #00c; padding:5px; margin-left:10px;'>some test with</div>"; |
|
540 | - $actual = $email->quoteHtmlEmailForNewEmailUI("some test with \n"); |
|
541 | - $this->assertSame($expected, $actual); |
|
538 | + //test with string containing special charecters |
|
539 | + $expected = "<div style='border-left:1px solid #00c; padding:5px; margin-left:10px;'>some test with</div>"; |
|
540 | + $actual = $email->quoteHtmlEmailForNewEmailUI("some test with \n"); |
|
541 | + $this->assertSame($expected, $actual); |
|
542 | 542 | |
543 | - } |
|
543 | + } |
|
544 | 544 | |
545 | 545 | |
546 | - public function testcheck_email_settings() { |
|
546 | + public function testcheck_email_settings() { |
|
547 | 547 | |
548 | - global $current_user; |
|
548 | + global $current_user; |
|
549 | 549 | |
550 | - $email = new Email(); |
|
550 | + $email = new Email(); |
|
551 | 551 | |
552 | - //test without a valid current user |
|
553 | - $result = $email->check_email_settings(); |
|
554 | - $this->assertEquals(false, $result); |
|
552 | + //test without a valid current user |
|
553 | + $result = $email->check_email_settings(); |
|
554 | + $this->assertEquals(false, $result); |
|
555 | 555 | |
556 | 556 | |
557 | - //test with a valid current user |
|
558 | - $current_user = new User(1); |
|
559 | - $result = $email->check_email_settings(); |
|
560 | - $this->assertEquals(false, $result); |
|
557 | + //test with a valid current user |
|
558 | + $current_user = new User(1); |
|
559 | + $result = $email->check_email_settings(); |
|
560 | + $this->assertEquals(false, $result); |
|
561 | 561 | |
562 | - } |
|
562 | + } |
|
563 | 563 | |
564 | 564 | |
565 | - public function testjs_set_archived() { |
|
565 | + public function testjs_set_archived() { |
|
566 | 566 | |
567 | - $email = new Email(); |
|
567 | + $email = new Email(); |
|
568 | 568 | |
569 | - $actual = $email->js_set_archived(); |
|
570 | - $this->assertGreaterThan(0, strlen($actual)); |
|
569 | + $actual = $email->js_set_archived(); |
|
570 | + $this->assertGreaterThan(0, strlen($actual)); |
|
571 | 571 | |
572 | - } |
|
572 | + } |
|
573 | 573 | |
574 | 574 | |
575 | - public function testu_get_clear_form_js() { |
|
575 | + public function testu_get_clear_form_js() { |
|
576 | 576 | |
577 | - $email = new Email(); |
|
577 | + $email = new Email(); |
|
578 | 578 | |
579 | - //with empty params |
|
580 | - $expected = "\n <script type=\"text/javascript\" language=\"JavaScript\"><!-- Begin\n function clear_form(form) {\n var newLoc = \"index.php?action=\" + form.action.value + \"&module=\" + form.module.value + \"&query=true&clear_query=true\";\n if(typeof(form.advanced) != \"undefined\"){\n newLoc += \"&advanced=\" + form.advanced.value;\n }\n document.location.href= newLoc;\n }\n // End --></script>"; |
|
581 | - $actual = $email->u_get_clear_form_js('', '', ''); |
|
582 | - $this->assertSame($expected, $actual); |
|
579 | + //with empty params |
|
580 | + $expected = "\n <script type=\"text/javascript\" language=\"JavaScript\"><!-- Begin\n function clear_form(form) {\n var newLoc = \"index.php?action=\" + form.action.value + \"&module=\" + form.module.value + \"&query=true&clear_query=true\";\n if(typeof(form.advanced) != \"undefined\"){\n newLoc += \"&advanced=\" + form.advanced.value;\n }\n document.location.href= newLoc;\n }\n // End --></script>"; |
|
581 | + $actual = $email->u_get_clear_form_js('', '', ''); |
|
582 | + $this->assertSame($expected, $actual); |
|
583 | 583 | |
584 | 584 | |
585 | - //with valid params |
|
586 | - $expected = "\n <script type=\"text/javascript\" language=\"JavaScript\"><!-- Begin\n function clear_form(form) {\n var newLoc = \"index.php?action=\" + form.action.value + \"&module=\" + form.module.value + \"&query=true&clear_query=true&type=out&assigned_user_id=1\";\n if(typeof(form.advanced) != \"undefined\"){\n newLoc += \"&advanced=\" + form.advanced.value;\n }\n document.location.href= newLoc;\n }\n // End --></script>"; |
|
587 | - $actual = $email->u_get_clear_form_js('out', '', '1'); |
|
588 | - $this->assertSame($expected, $actual); |
|
585 | + //with valid params |
|
586 | + $expected = "\n <script type=\"text/javascript\" language=\"JavaScript\"><!-- Begin\n function clear_form(form) {\n var newLoc = \"index.php?action=\" + form.action.value + \"&module=\" + form.module.value + \"&query=true&clear_query=true&type=out&assigned_user_id=1\";\n if(typeof(form.advanced) != \"undefined\"){\n newLoc += \"&advanced=\" + form.advanced.value;\n }\n document.location.href= newLoc;\n }\n // End --></script>"; |
|
587 | + $actual = $email->u_get_clear_form_js('out', '', '1'); |
|
588 | + $this->assertSame($expected, $actual); |
|
589 | 589 | |
590 | - } |
|
590 | + } |
|
591 | 591 | |
592 | - public function testpickOneButton() { |
|
592 | + public function testpickOneButton() { |
|
593 | 593 | |
594 | - $email = new Email(); |
|
594 | + $email = new Email(); |
|
595 | 595 | |
596 | - $expected = "<div><input title=\"\"\n class=\"button\"\n type=\"button\" name=\"button\"\n onClick=\"window.location='index.php?module=Emails&action=Grab';\"\n style=\"margin-bottom:2px\"\n value=\" \"></div>"; |
|
597 | - $actual = $email->pickOneButton(); |
|
598 | - $this->assertSame($expected, $actual); |
|
596 | + $expected = "<div><input title=\"\"\n class=\"button\"\n type=\"button\" name=\"button\"\n onClick=\"window.location='index.php?module=Emails&action=Grab';\"\n style=\"margin-bottom:2px\"\n value=\" \"></div>"; |
|
597 | + $actual = $email->pickOneButton(); |
|
598 | + $this->assertSame($expected, $actual); |
|
599 | 599 | |
600 | - } |
|
600 | + } |
|
601 | 601 | |
602 | 602 | |
603 | - public function testgetUserEditorPreference() { |
|
603 | + public function testgetUserEditorPreference() { |
|
604 | 604 | |
605 | - $email = new Email(); |
|
605 | + $email = new Email(); |
|
606 | 606 | |
607 | - $result = $email->getUserEditorPreference(); |
|
608 | - $this->assertEquals("html",$result); |
|
607 | + $result = $email->getUserEditorPreference(); |
|
608 | + $this->assertEquals("html",$result); |
|
609 | 609 | |
610 | - } |
|
610 | + } |
|
611 | 611 | |
612 | - public function testparse_addrs() { |
|
612 | + public function testparse_addrs() { |
|
613 | 613 | |
614 | - $email = new Email(); |
|
614 | + $email = new Email(); |
|
615 | 615 | |
616 | - $addrs = "abc<[email protected]>;xyz<[email protected]>"; |
|
617 | - $addrs_ids = "1;2"; |
|
618 | - $addrs_names = "abc;xyz"; |
|
619 | - $addrs_emails = "[email protected];[email protected]"; |
|
616 | + $addrs = "abc<[email protected]>;xyz<[email protected]>"; |
|
617 | + $addrs_ids = "1;2"; |
|
618 | + $addrs_names = "abc;xyz"; |
|
619 | + $addrs_emails = "[email protected];[email protected]"; |
|
620 | 620 | |
621 | - $expected = array( array ('email' => '[email protected]', 'display' => 'abc', 'contact_id' => '1' ), array ('email' => '[email protected]', 'display' => 'xyz', 'contact_id' => '2' ) ); |
|
621 | + $expected = array( array ('email' => '[email protected]', 'display' => 'abc', 'contact_id' => '1' ), array ('email' => '[email protected]', 'display' => 'xyz', 'contact_id' => '2' ) ); |
|
622 | 622 | |
623 | - $actual = $email->parse_addrs($addrs , $addrs_ids, $addrs_names, $addrs_emails); |
|
623 | + $actual = $email->parse_addrs($addrs , $addrs_ids, $addrs_names, $addrs_emails); |
|
624 | 624 | |
625 | - $this->assertSame($expected, $actual); |
|
625 | + $this->assertSame($expected, $actual); |
|
626 | 626 | |
627 | - } |
|
627 | + } |
|
628 | 628 | |
629 | - public function testremove_empty_fields() { |
|
629 | + public function testremove_empty_fields() { |
|
630 | 630 | |
631 | - $email = new Email(); |
|
631 | + $email = new Email(); |
|
632 | 632 | |
633 | - //test for array with empty values |
|
634 | - $expected = array("val1", "val2"); |
|
635 | - $fields = array("val1", " ", "val2"); |
|
636 | - $actual = $email->remove_empty_fields($fields); |
|
637 | - $this->assertSame($expected, $actual); |
|
633 | + //test for array with empty values |
|
634 | + $expected = array("val1", "val2"); |
|
635 | + $fields = array("val1", " ", "val2"); |
|
636 | + $actual = $email->remove_empty_fields($fields); |
|
637 | + $this->assertSame($expected, $actual); |
|
638 | 638 | |
639 | 639 | |
640 | - //test for array without empty values |
|
641 | - $expected = array("val1","val2"); |
|
642 | - $fields = array("val1", "val2"); |
|
643 | - $actual = $email->remove_empty_fields($fields); |
|
644 | - $this->assertSame($expected, $actual); |
|
640 | + //test for array without empty values |
|
641 | + $expected = array("val1","val2"); |
|
642 | + $fields = array("val1", "val2"); |
|
643 | + $actual = $email->remove_empty_fields($fields); |
|
644 | + $this->assertSame($expected, $actual); |
|
645 | 645 | |
646 | - } |
|
646 | + } |
|
647 | 647 | |
648 | 648 | |
649 | - public function testhasSignatureInBody() { |
|
649 | + public function testhasSignatureInBody() { |
|
650 | 650 | |
651 | - $email = new Email(); |
|
651 | + $email = new Email(); |
|
652 | 652 | |
653 | - $email->description_html = "some html text with <b>sign</b>"; |
|
654 | - $email->description = "some text with sign"; |
|
653 | + $email->description_html = "some html text with <b>sign</b>"; |
|
654 | + $email->description = "some text with sign"; |
|
655 | 655 | |
656 | - //test for strings with signature present |
|
657 | - $sig = array("signature_html"=>"sign", "signature"=>"sign" ); |
|
658 | - $result = $email->hasSignatureInBody($sig); |
|
659 | - $this->assertEquals(true, $result); |
|
656 | + //test for strings with signature present |
|
657 | + $sig = array("signature_html"=>"sign", "signature"=>"sign" ); |
|
658 | + $result = $email->hasSignatureInBody($sig); |
|
659 | + $this->assertEquals(true, $result); |
|
660 | 660 | |
661 | - //test for strings with signature absent |
|
662 | - $sig = array("signature_html"=>"signature", "signature"=>"signature" ); |
|
663 | - $result = $email->hasSignatureInBody($sig); |
|
664 | - $this->assertEquals(false, $result); |
|
661 | + //test for strings with signature absent |
|
662 | + $sig = array("signature_html"=>"signature", "signature"=>"signature" ); |
|
663 | + $result = $email->hasSignatureInBody($sig); |
|
664 | + $this->assertEquals(false, $result); |
|
665 | 665 | |
666 | - } |
|
666 | + } |
|
667 | 667 | |
668 | 668 | |
669 | 669 | |
670 | - public function testremoveAllNewlines() { |
|
670 | + public function testremoveAllNewlines() { |
|
671 | 671 | |
672 | - $email = new Email(); |
|
672 | + $email = new Email(); |
|
673 | 673 | |
674 | - $this->assertEquals("", $email->removeAllNewlines("")); |
|
675 | - $this->assertEquals("some text", $email->removeAllNewlines("some text")); |
|
676 | - $this->assertEquals("some text", $email->removeAllNewlines("some text<br>")); |
|
677 | - $this->assertEquals("some text", $email->removeAllNewlines("some\n text\n")); |
|
678 | - $this->assertEquals("some text", $email->removeAllNewlines("some\r\n text\r\n")); |
|
674 | + $this->assertEquals("", $email->removeAllNewlines("")); |
|
675 | + $this->assertEquals("some text", $email->removeAllNewlines("some text")); |
|
676 | + $this->assertEquals("some text", $email->removeAllNewlines("some text<br>")); |
|
677 | + $this->assertEquals("some text", $email->removeAllNewlines("some\n text\n")); |
|
678 | + $this->assertEquals("some text", $email->removeAllNewlines("some\r\n text\r\n")); |
|
679 | 679 | |
680 | - } |
|
681 | - |
|
680 | + } |
|
682 | 681 | |
683 | - public function testgetStartPage() { |
|
684 | 682 | |
685 | - $email = new Email(); |
|
686 | - |
|
687 | - //test without assigned_user_id in url |
|
688 | - $url = "index.php?module=Users&offset=6&stamp=1453274421025259800&return_module=Users&action=DetailView&record=seed_max_id"; |
|
689 | - $expected = array ( |
|
690 | - 'module' => 'Users', |
|
691 | - 'action' => 'DetailView', |
|
692 | - 'group' => '', |
|
693 | - 'record' => 'seed_max_id', |
|
694 | - 'type' => '', |
|
695 | - 'offset' => '6', |
|
696 | - 'stamp' => '1453274421025259800', |
|
697 | - 'return_module' => 'Users', |
|
698 | - ); |
|
699 | - $actual = $email->getStartPage($url); |
|
700 | - $this->assertSame($expected,$actual); |
|
701 | - |
|
702 | - |
|
703 | - |
|
704 | - //test with assigned_user_id in url |
|
705 | - $url = "index.php?module=Users&offset=6&stamp=1453274421025259800&return_module=Users&action=DetailView&record=seed_max_id&assigned_user_id=1"; |
|
706 | - $expected = array ( |
|
707 | - 'module' => 'Users', |
|
708 | - 'action' => 'DetailView', |
|
709 | - 'group' => '', |
|
710 | - 'record' => 'seed_max_id', |
|
711 | - 'type' => '', |
|
712 | - 'offset' => '6', |
|
713 | - 'stamp' => '1453274421025259800', |
|
714 | - 'return_module' => 'Users', |
|
715 | - 'assigned_user_id' => '1', |
|
716 | - 'current_view' => 'DetailView&module=Users&assigned_user_id=1&type=' |
|
717 | - ); |
|
718 | - $actual = $email->getStartPage($url); |
|
719 | - $this->assertSame($expected,$actual); |
|
683 | + public function testgetStartPage() { |
|
684 | + |
|
685 | + $email = new Email(); |
|
686 | + |
|
687 | + //test without assigned_user_id in url |
|
688 | + $url = "index.php?module=Users&offset=6&stamp=1453274421025259800&return_module=Users&action=DetailView&record=seed_max_id"; |
|
689 | + $expected = array ( |
|
690 | + 'module' => 'Users', |
|
691 | + 'action' => 'DetailView', |
|
692 | + 'group' => '', |
|
693 | + 'record' => 'seed_max_id', |
|
694 | + 'type' => '', |
|
695 | + 'offset' => '6', |
|
696 | + 'stamp' => '1453274421025259800', |
|
697 | + 'return_module' => 'Users', |
|
698 | + ); |
|
699 | + $actual = $email->getStartPage($url); |
|
700 | + $this->assertSame($expected,$actual); |
|
701 | + |
|
702 | + |
|
703 | + |
|
704 | + //test with assigned_user_id in url |
|
705 | + $url = "index.php?module=Users&offset=6&stamp=1453274421025259800&return_module=Users&action=DetailView&record=seed_max_id&assigned_user_id=1"; |
|
706 | + $expected = array ( |
|
707 | + 'module' => 'Users', |
|
708 | + 'action' => 'DetailView', |
|
709 | + 'group' => '', |
|
710 | + 'record' => 'seed_max_id', |
|
711 | + 'type' => '', |
|
712 | + 'offset' => '6', |
|
713 | + 'stamp' => '1453274421025259800', |
|
714 | + 'return_module' => 'Users', |
|
715 | + 'assigned_user_id' => '1', |
|
716 | + 'current_view' => 'DetailView&module=Users&assigned_user_id=1&type=' |
|
717 | + ); |
|
718 | + $actual = $email->getStartPage($url); |
|
719 | + $this->assertSame($expected,$actual); |
|
720 | 720 | |
721 | - } |
|
721 | + } |
|
722 | 722 | |
723 | 723 | |
724 | 724 | |
725 | - public function testsetMailer() { |
|
725 | + public function testsetMailer() { |
|
726 | 726 | |
727 | - $email = new Email(); |
|
727 | + $email = new Email(); |
|
728 | 728 | |
729 | - $result = $email->setMailer(new SugarPHPMailer(),'',''); |
|
729 | + $result = $email->setMailer(new SugarPHPMailer(),'',''); |
|
730 | 730 | |
731 | - $this->assertInstanceOf('SugarPHPMailer',$result); |
|
732 | - $this->assertInstanceOf('OutboundEmail',$result->oe); |
|
731 | + $this->assertInstanceOf('SugarPHPMailer',$result); |
|
732 | + $this->assertInstanceOf('OutboundEmail',$result->oe); |
|
733 | 733 | |
734 | - } |
|
734 | + } |
|
735 | 735 | |
736 | 736 | |
737 | 737 | |
738 | - public function testhandleBody() { |
|
738 | + public function testhandleBody() { |
|
739 | 739 | |
740 | - $email = new Email(); |
|
740 | + $email = new Email(); |
|
741 | 741 | |
742 | - //test without setting REQUEST parameters |
|
743 | - $email->description = "some email description containing email text & ' <br> "; |
|
742 | + //test without setting REQUEST parameters |
|
743 | + $email->description = "some email description containing email text & ' <br> "; |
|
744 | 744 | |
745 | - $result = $email->handleBody(new SugarPHPMailer()); |
|
745 | + $result = $email->handleBody(new SugarPHPMailer()); |
|
746 | 746 | |
747 | - $this->assertEquals("some email description containing email text & ' \n ", $email->description); |
|
748 | - $this->assertInstanceOf('SugarPHPMailer',$result); |
|
747 | + $this->assertEquals("some email description containing email text & ' \n ", $email->description); |
|
748 | + $this->assertInstanceOf('SugarPHPMailer',$result); |
|
749 | 749 | |
750 | 750 | |
751 | - //test with REQUEST parameters set |
|
752 | - $_REQUEST['setEditor'] =1; |
|
753 | - $_REQUEST['description_html'] = "1"; |
|
754 | - $email->description_html = "some email description containing email text & ' <br> "; |
|
751 | + //test with REQUEST parameters set |
|
752 | + $_REQUEST['setEditor'] =1; |
|
753 | + $_REQUEST['description_html'] = "1"; |
|
754 | + $email->description_html = "some email description containing email text & ' <br> "; |
|
755 | 755 | |
756 | - $result = $email->handleBody(new SugarPHPMailer()); |
|
756 | + $result = $email->handleBody(new SugarPHPMailer()); |
|
757 | 757 | |
758 | - $this->assertEquals("some email description containing email text & ' \n ", $email->description); |
|
759 | - $this->assertInstanceOf('SugarPHPMailer',$result); |
|
758 | + $this->assertEquals("some email description containing email text & ' \n ", $email->description); |
|
759 | + $this->assertInstanceOf('SugarPHPMailer',$result); |
|
760 | 760 | |
761 | - } |
|
761 | + } |
|
762 | 762 | |
763 | 763 | |
764 | 764 | |
765 | - public function testhandleBodyInHTMLformat() { |
|
765 | + public function testhandleBodyInHTMLformat() { |
|
766 | 766 | |
767 | - $email = new Email(); |
|
767 | + $email = new Email(); |
|
768 | 768 | |
769 | - $mailer = new SugarPHPMailer(); |
|
770 | - $email->description_html = "some email description containing email text & ' <br> "; |
|
769 | + $mailer = new SugarPHPMailer(); |
|
770 | + $email->description_html = "some email description containing email text & ' <br> "; |
|
771 | 771 | |
772 | - $result = $email->handleBodyInHTMLformat($mailer); |
|
772 | + $result = $email->handleBodyInHTMLformat($mailer); |
|
773 | 773 | |
774 | - $this->assertEquals("some email description containing email text & ' \n ", $email->description); |
|
775 | - $this->assertEquals("some email description containing email text & ' <br> ", $mailer->Body); |
|
774 | + $this->assertEquals("some email description containing email text & ' \n ", $email->description); |
|
775 | + $this->assertEquals("some email description containing email text & ' <br> ", $mailer->Body); |
|
776 | 776 | |
777 | - } |
|
777 | + } |
|
778 | 778 | |
779 | 779 | |
780 | 780 | |
781 | - public function testlistviewACLHelper(){ |
|
781 | + public function testlistviewACLHelper(){ |
|
782 | 782 | |
783 | - $email = new Email(); |
|
783 | + $email = new Email(); |
|
784 | 784 | |
785 | - $expected = array("MAIN"=>"a", "PARENT"=>"a", "CONTACT"=>"a" ); |
|
786 | - $actual = $email->listviewACLHelper(); |
|
787 | - $this->assertSame($expected,$actual); |
|
785 | + $expected = array("MAIN"=>"a", "PARENT"=>"a", "CONTACT"=>"a" ); |
|
786 | + $actual = $email->listviewACLHelper(); |
|
787 | + $this->assertSame($expected,$actual); |
|
788 | 788 | |
789 | - } |
|
789 | + } |
|
790 | 790 | |
791 | - public function testgetSystemDefaultEmail() { |
|
791 | + public function testgetSystemDefaultEmail() { |
|
792 | 792 | |
793 | - $email = new Email(); |
|
793 | + $email = new Email(); |
|
794 | 794 | |
795 | - $expected = array( 'email' => '[email protected]', 'name' => 'SuiteCRM'); |
|
796 | - $actual = $email->getSystemDefaultEmail(); |
|
795 | + $expected = array( 'email' => '[email protected]', 'name' => 'SuiteCRM'); |
|
796 | + $actual = $email->getSystemDefaultEmail(); |
|
797 | 797 | |
798 | - $this->assertSame($expected,$actual); |
|
798 | + $this->assertSame($expected,$actual); |
|
799 | 799 | |
800 | - } |
|
800 | + } |
|
801 | 801 | |
802 | 802 | |
803 | 803 | public function testcreate_new_list_query() { |
804 | 804 | |
805 | - $email = new Email(); |
|
805 | + $email = new Email(); |
|
806 | 806 | |
807 | - //test with empty string params |
|
808 | - $expected = "SELECT emails.*, users.user_name as assigned_user_name\n FROM emails\n LEFT JOIN users ON emails.assigned_user_id=users.id \nWHERE emails.deleted=0 \n ORDER BY date_sent DESC"; |
|
809 | - $actual = $email->create_new_list_query('',''); |
|
810 | - $this->assertSame($expected,$actual); |
|
807 | + //test with empty string params |
|
808 | + $expected = "SELECT emails.*, users.user_name as assigned_user_name\n FROM emails\n LEFT JOIN users ON emails.assigned_user_id=users.id \nWHERE emails.deleted=0 \n ORDER BY date_sent DESC"; |
|
809 | + $actual = $email->create_new_list_query('',''); |
|
810 | + $this->assertSame($expected,$actual); |
|
811 | 811 | |
812 | 812 | |
813 | - //test with valid string params |
|
814 | - $expected = "SELECT emails.*, users.user_name as assigned_user_name\n FROM emails\n LEFT JOIN users ON emails.assigned_user_id=users.id \nWHERE users.user_name = \"\" AND emails.deleted=0 \n ORDER BY emails.id"; |
|
815 | - $actual = $email->create_new_list_query('emails.id','users.user_name = ""'); |
|
816 | - $this->assertSame($expected,$actual); |
|
813 | + //test with valid string params |
|
814 | + $expected = "SELECT emails.*, users.user_name as assigned_user_name\n FROM emails\n LEFT JOIN users ON emails.assigned_user_id=users.id \nWHERE users.user_name = \"\" AND emails.deleted=0 \n ORDER BY emails.id"; |
|
815 | + $actual = $email->create_new_list_query('emails.id','users.user_name = ""'); |
|
816 | + $this->assertSame($expected,$actual); |
|
817 | 817 | |
818 | 818 | } |
819 | 819 | |
820 | 820 | |
821 | - public function testfill_in_additional_list_fields() { |
|
821 | + public function testfill_in_additional_list_fields() { |
|
822 | 822 | |
823 | - $email = new Email(); |
|
823 | + $email = new Email(); |
|
824 | 824 | |
825 | - $email->parent_id = '1'; |
|
826 | - $email->parent_name = "test"; |
|
827 | - $email->parent_type = 'Contacts'; |
|
825 | + $email->parent_id = '1'; |
|
826 | + $email->parent_name = "test"; |
|
827 | + $email->parent_type = 'Contacts'; |
|
828 | 828 | |
829 | - $email->fill_in_additional_list_fields(); |
|
829 | + $email->fill_in_additional_list_fields(); |
|
830 | 830 | |
831 | - $this->assertEquals('DetailView', $email->link_action); |
|
832 | - $this->assertEquals('', $email->attachment_image ); |
|
831 | + $this->assertEquals('DetailView', $email->link_action); |
|
832 | + $this->assertEquals('', $email->attachment_image ); |
|
833 | 833 | |
834 | 834 | |
835 | - } |
|
835 | + } |
|
836 | 836 | |
837 | - public function testfill_in_additional_detail_fields() { |
|
837 | + public function testfill_in_additional_detail_fields() { |
|
838 | 838 | |
839 | - $email = new Email(); |
|
839 | + $email = new Email(); |
|
840 | 840 | |
841 | - $email->created_by = '1'; |
|
842 | - $email->modified_user_id = "1"; |
|
843 | - $email->type = 'out'; |
|
844 | - $email->status = 'send_error'; |
|
841 | + $email->created_by = '1'; |
|
842 | + $email->modified_user_id = "1"; |
|
843 | + $email->type = 'out'; |
|
844 | + $email->status = 'send_error'; |
|
845 | 845 | |
846 | - $email->fill_in_additional_list_fields(); |
|
846 | + $email->fill_in_additional_list_fields(); |
|
847 | 847 | |
848 | - $this->assertEquals('Administrator', $email->created_by_name); |
|
849 | - $this->assertEquals('Administrator', $email->modified_by_name ); |
|
850 | - $this->assertEquals('', $email->type_name); |
|
851 | - $this->assertEquals('', $email->name); |
|
852 | - $this->assertEquals('DetailView', $email->link_action); |
|
848 | + $this->assertEquals('Administrator', $email->created_by_name); |
|
849 | + $this->assertEquals('Administrator', $email->modified_by_name ); |
|
850 | + $this->assertEquals('', $email->type_name); |
|
851 | + $this->assertEquals('', $email->name); |
|
852 | + $this->assertEquals('DetailView', $email->link_action); |
|
853 | 853 | |
854 | - } |
|
854 | + } |
|
855 | 855 | |
856 | 856 | |
857 | 857 | |
858 | - public function testcreate_export_query() |
|
858 | + public function testcreate_export_query() |
|
859 | 859 | { |
860 | 860 | |
861 | - $email = new Email(); |
|
861 | + $email = new Email(); |
|
862 | 862 | |
863 | - //test with empty string params |
|
864 | - $expected = "SELECT emails.* FROM emails where emails.deleted=0 ORDER BY emails.name"; |
|
865 | - $actual = $email->create_export_query('',''); |
|
866 | - $this->assertSame($expected,$actual); |
|
863 | + //test with empty string params |
|
864 | + $expected = "SELECT emails.* FROM emails where emails.deleted=0 ORDER BY emails.name"; |
|
865 | + $actual = $email->create_export_query('',''); |
|
866 | + $this->assertSame($expected,$actual); |
|
867 | 867 | |
868 | - //test with valid string params |
|
869 | - $expected = "SELECT emails.* FROM emails where users.user_name = \"\" AND emails.deleted=0 ORDER BY emails.id"; |
|
870 | - $actual = $email->create_export_query('emails.id','users.user_name = ""'); |
|
871 | - $this->assertSame($expected,$actual); |
|
868 | + //test with valid string params |
|
869 | + $expected = "SELECT emails.* FROM emails where users.user_name = \"\" AND emails.deleted=0 ORDER BY emails.id"; |
|
870 | + $actual = $email->create_export_query('emails.id','users.user_name = ""'); |
|
871 | + $this->assertSame($expected,$actual); |
|
872 | 872 | |
873 | 873 | } |
874 | 874 | |
875 | - public function testget_list_view_data() { |
|
875 | + public function testget_list_view_data() { |
|
876 | 876 | |
877 | - $email = new Email(); |
|
877 | + $email = new Email(); |
|
878 | 878 | |
879 | - $email->from_addr_name = "Admin"; |
|
880 | - $email->id = 1; |
|
881 | - $email->intent = 'support'; |
|
882 | - $email->to_addrs = "[email protected]"; |
|
883 | - $email->link_action = "DetailView"; |
|
884 | - $email->type_name = "out"; |
|
879 | + $email->from_addr_name = "Admin"; |
|
880 | + $email->id = 1; |
|
881 | + $email->intent = 'support'; |
|
882 | + $email->to_addrs = "[email protected]"; |
|
883 | + $email->link_action = "DetailView"; |
|
884 | + $email->type_name = "out"; |
|
885 | 885 | |
886 | - $expected = array ( |
|
887 | - 'ID' => 1, |
|
888 | - 'FROM_ADDR_NAME' => 'Admin', |
|
889 | - 'TYPE' => 'Archived', |
|
890 | - 'INTENT' => 'support', |
|
891 | - 'FROM_ADDR' => NULL, |
|
892 | - 'QUICK_REPLY' => '<a href="index.php?module=Emails&action=Compose&replyForward=true&reply=reply&record=1&inbound_email_id=1">Reply</a>', |
|
893 | - 'STATUS' => NULL, |
|
894 | - 'CREATE_RELATED' => "~".preg_quote('<a href="index.php?module=Cases&action=EditView&inbound_email_id=1" ><img src="themes/SuiteR/images/CreateCases.gif?v=').'[\w-]+'.preg_quote('" border="0" alt="Create Cases" />Create Case</a>')."~", |
|
895 | - 'CONTACT_NAME' => '</a>[email protected]<a>', |
|
896 | - 'CONTACT_ID' => '', |
|
897 | - 'ATTACHMENT_IMAGE' => NULL, |
|
898 | - 'LINK_ACTION' => 'DetailView', |
|
899 | - 'TYPE_NAME' => 'out', |
|
900 | - ); |
|
901 | - |
|
902 | - $actual = $email->get_list_view_data(); |
|
903 | - foreach($expected as $expectedKey => $expectedVal){ |
|
886 | + $expected = array ( |
|
887 | + 'ID' => 1, |
|
888 | + 'FROM_ADDR_NAME' => 'Admin', |
|
889 | + 'TYPE' => 'Archived', |
|
890 | + 'INTENT' => 'support', |
|
891 | + 'FROM_ADDR' => NULL, |
|
892 | + 'QUICK_REPLY' => '<a href="index.php?module=Emails&action=Compose&replyForward=true&reply=reply&record=1&inbound_email_id=1">Reply</a>', |
|
893 | + 'STATUS' => NULL, |
|
894 | + 'CREATE_RELATED' => "~".preg_quote('<a href="index.php?module=Cases&action=EditView&inbound_email_id=1" ><img src="themes/SuiteR/images/CreateCases.gif?v=').'[\w-]+'.preg_quote('" border="0" alt="Create Cases" />Create Case</a>')."~", |
|
895 | + 'CONTACT_NAME' => '</a>[email protected]<a>', |
|
896 | + 'CONTACT_ID' => '', |
|
897 | + 'ATTACHMENT_IMAGE' => NULL, |
|
898 | + 'LINK_ACTION' => 'DetailView', |
|
899 | + 'TYPE_NAME' => 'out', |
|
900 | + ); |
|
901 | + |
|
902 | + $actual = $email->get_list_view_data(); |
|
903 | + foreach($expected as $expectedKey => $expectedVal){ |
|
904 | 904 | if($expectedKey == 'CREATE_RELATED'){ |
905 | 905 | $this->assertRegExp($expected[$expectedKey],$actual[$expectedKey]); |
906 | 906 | }else { |
907 | 907 | $this->assertSame($expected[$expectedKey], $actual[$expectedKey]); |
908 | 908 | } |
909 | 909 | } |
910 | - } |
|
910 | + } |
|
911 | 911 | |
912 | 912 | public function testquickCreateForm() { |
913 | 913 | |
914 | - $email = new Email(); |
|
914 | + $email = new Email(); |
|
915 | 915 | |
916 | - $expected = "~".preg_quote("Quick Create <a id='' onclick='return quick_create_overlib(\"\", \"SuiteR\", this);' href=\"#\" ><img src=\"themes/SuiteR/images/advanced_search.gif?v=") |
|
916 | + $expected = "~".preg_quote("Quick Create <a id='' onclick='return quick_create_overlib(\"\", \"SuiteR\", this);' href=\"#\" ><img src=\"themes/SuiteR/images/advanced_search.gif?v=") |
|
917 | 917 | . '[\w-]+' |
918 | 918 | .preg_quote("\" border='0' align='absmiddle' alt=\"Quick Create\" /></a>") |
919 | 919 | ."~"; |
920 | 920 | |
921 | - $actual = $email->quickCreateForm(); |
|
922 | - $this->assertRegExp($expected,$actual); |
|
921 | + $actual = $email->quickCreateForm(); |
|
922 | + $this->assertRegExp($expected,$actual); |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | |
926 | 926 | |
927 | 927 | public function testsearchImportedEmails() |
928 | 928 | { |
929 | - $email = new Email(); |
|
929 | + $email = new Email(); |
|
930 | 930 | |
931 | - $actual = $email->searchImportedEmails(); |
|
932 | - $this->assertTrue(is_array($actual)); |
|
931 | + $actual = $email->searchImportedEmails(); |
|
932 | + $this->assertTrue(is_array($actual)); |
|
933 | 933 | |
934 | 934 | } |
935 | 935 | |
936 | 936 | |
937 | 937 | public function test_genereateSearchImportedEmailsQuery() |
938 | 938 | { |
939 | - $email = new Email(); |
|
939 | + $email = new Email(); |
|
940 | 940 | |
941 | - $expected = "SELECT emails.id , emails.mailbox_id, emails.name, emails.date_sent, emails.status, emails.type, emails.flagged, emails.reply_to_status,\n emails_text.from_addr, emails_text.to_addrs FROM emails JOIN emails_text on emails.id = emails_text.email_id WHERE (emails.type= 'inbound' OR emails.type='archived' OR emails.type='out') AND emails.deleted = 0 "; |
|
942 | - $actual = $email->_genereateSearchImportedEmailsQuery(); |
|
943 | - $this->assertSame($expected,$actual); |
|
941 | + $expected = "SELECT emails.id , emails.mailbox_id, emails.name, emails.date_sent, emails.status, emails.type, emails.flagged, emails.reply_to_status,\n emails_text.from_addr, emails_text.to_addrs FROM emails JOIN emails_text on emails.id = emails_text.email_id WHERE (emails.type= 'inbound' OR emails.type='archived' OR emails.type='out') AND emails.deleted = 0 "; |
|
942 | + $actual = $email->_genereateSearchImportedEmailsQuery(); |
|
943 | + $this->assertSame($expected,$actual); |
|
944 | 944 | |
945 | 945 | } |
946 | 946 | |
@@ -948,174 +948,174 @@ discard block |
||
948 | 948 | public function test_generateSearchImportWhereClause() |
949 | 949 | { |
950 | 950 | |
951 | - $email = new Email(); |
|
951 | + $email = new Email(); |
|
952 | 952 | |
953 | - //test without request params |
|
954 | - $expected = ""; |
|
955 | - $actual = $email->_generateSearchImportWhereClause(); |
|
956 | - $this->assertSame($expected,$actual); |
|
953 | + //test without request params |
|
954 | + $expected = ""; |
|
955 | + $actual = $email->_generateSearchImportWhereClause(); |
|
956 | + $this->assertSame($expected,$actual); |
|
957 | 957 | |
958 | 958 | |
959 | - //test with searchDateFrom request param only |
|
960 | - $_REQUEST['searchDateFrom']= "2015-01-01 00:00:00"; |
|
961 | - $expected = "emails.date_sent >= '' "; |
|
962 | - $actual = $email->_generateSearchImportWhereClause(); |
|
963 | - $this->assertSame($expected,$actual); |
|
959 | + //test with searchDateFrom request param only |
|
960 | + $_REQUEST['searchDateFrom']= "2015-01-01 00:00:00"; |
|
961 | + $expected = "emails.date_sent >= '' "; |
|
962 | + $actual = $email->_generateSearchImportWhereClause(); |
|
963 | + $this->assertSame($expected,$actual); |
|
964 | 964 | |
965 | 965 | |
966 | - //test with searchDateTo request param only |
|
967 | - $_REQUEST['searchDateFrom'] = ""; |
|
968 | - $_REQUEST['searchDateTo']= "2015-01-01 00:00:00"; |
|
969 | - $expected = "emails.date_sent <= '' "; |
|
970 | - $actual = $email->_generateSearchImportWhereClause(); |
|
971 | - $this->assertSame($expected,$actual); |
|
966 | + //test with searchDateTo request param only |
|
967 | + $_REQUEST['searchDateFrom'] = ""; |
|
968 | + $_REQUEST['searchDateTo']= "2015-01-01 00:00:00"; |
|
969 | + $expected = "emails.date_sent <= '' "; |
|
970 | + $actual = $email->_generateSearchImportWhereClause(); |
|
971 | + $this->assertSame($expected,$actual); |
|
972 | 972 | |
973 | 973 | |
974 | - //test with both request params |
|
975 | - $_REQUEST['searchDateFrom']= "2015-01-01 00:00:00"; |
|
976 | - $_REQUEST['searchDateTo']= "2015-01-01 00:00:00"; |
|
977 | - $expected = "( emails.date_sent >= '' AND\n emails.date_sent <= '' )"; |
|
978 | - $actual = $email->_generateSearchImportWhereClause(); |
|
979 | - $this->assertSame($expected,$actual); |
|
974 | + //test with both request params |
|
975 | + $_REQUEST['searchDateFrom']= "2015-01-01 00:00:00"; |
|
976 | + $_REQUEST['searchDateTo']= "2015-01-01 00:00:00"; |
|
977 | + $expected = "( emails.date_sent >= '' AND\n emails.date_sent <= '' )"; |
|
978 | + $actual = $email->_generateSearchImportWhereClause(); |
|
979 | + $this->assertSame($expected,$actual); |
|
980 | 980 | |
981 | 981 | } |
982 | 982 | |
983 | 983 | |
984 | - public function testtrimLongTo() { |
|
984 | + public function testtrimLongTo() { |
|
985 | 985 | |
986 | - $email = new Email(); |
|
986 | + $email = new Email(); |
|
987 | 987 | |
988 | - $this->assertEquals("test string", $email->trimLongTo("test string")); //test without any separator |
|
989 | - $this->assertEquals("test string 1...", $email->trimLongTo("test string 1, test string2")); //test with , separator |
|
990 | - $this->assertEquals("test string 1...", $email->trimLongTo("test string 1; test string2"));//test with ; separator |
|
988 | + $this->assertEquals("test string", $email->trimLongTo("test string")); //test without any separator |
|
989 | + $this->assertEquals("test string 1...", $email->trimLongTo("test string 1, test string2")); //test with , separator |
|
990 | + $this->assertEquals("test string 1...", $email->trimLongTo("test string 1; test string2"));//test with ; separator |
|
991 | 991 | |
992 | - } |
|
992 | + } |
|
993 | 993 | |
994 | - public function testget_summary_text() { |
|
994 | + public function testget_summary_text() { |
|
995 | 995 | |
996 | - $email = new Email(); |
|
996 | + $email = new Email(); |
|
997 | 997 | |
998 | - //test without setting name |
|
999 | - $this->assertEquals(Null,$email->get_summary_text()); |
|
998 | + //test without setting name |
|
999 | + $this->assertEquals(Null,$email->get_summary_text()); |
|
1000 | 1000 | |
1001 | - //test with name set |
|
1002 | - $email->name = "test"; |
|
1003 | - $this->assertEquals('test',$email->get_summary_text()); |
|
1001 | + //test with name set |
|
1002 | + $email->name = "test"; |
|
1003 | + $this->assertEquals('test',$email->get_summary_text()); |
|
1004 | 1004 | |
1005 | - } |
|
1005 | + } |
|
1006 | 1006 | |
1007 | - public function testdistributionForm() { |
|
1007 | + public function testdistributionForm() { |
|
1008 | 1008 | require_once('include/utils/layout_utils.php'); |
1009 | - $email = new Email(); |
|
1009 | + $email = new Email(); |
|
1010 | 1010 | |
1011 | - //test with empty string |
|
1012 | - $result = $email->distributionForm(''); |
|
1013 | - $this->assertGreaterThan(0, strlen($result)); |
|
1011 | + //test with empty string |
|
1012 | + $result = $email->distributionForm(''); |
|
1013 | + $this->assertGreaterThan(0, strlen($result)); |
|
1014 | 1014 | |
1015 | - //test with valid string |
|
1016 | - $result = $email->distributionForm('test'); |
|
1017 | - $this->assertGreaterThan(0, strlen($result)); |
|
1015 | + //test with valid string |
|
1016 | + $result = $email->distributionForm('test'); |
|
1017 | + $this->assertGreaterThan(0, strlen($result)); |
|
1018 | 1018 | |
1019 | - } |
|
1019 | + } |
|
1020 | 1020 | |
1021 | 1021 | |
1022 | - public function testuserSelectTable() { |
|
1022 | + public function testuserSelectTable() { |
|
1023 | 1023 | |
1024 | - $email = new Email(); |
|
1024 | + $email = new Email(); |
|
1025 | 1025 | |
1026 | - $result = $email->userSelectTable(); |
|
1027 | - $this->assertGreaterThan(0, strlen($result)); |
|
1026 | + $result = $email->userSelectTable(); |
|
1027 | + $this->assertGreaterThan(0, strlen($result)); |
|
1028 | 1028 | |
1029 | - } |
|
1029 | + } |
|
1030 | 1030 | |
1031 | 1031 | |
1032 | - public function testcheckInbox() { |
|
1032 | + public function testcheckInbox() { |
|
1033 | 1033 | |
1034 | 1034 | |
1035 | - $email = new Email(); |
|
1035 | + $email = new Email(); |
|
1036 | 1036 | |
1037 | - //test with empty string |
|
1038 | - $expected = "<div><input title=\"\"\n class=\"button\"\n type=\"button\" name=\"button\"\n onClick=\"window.location='index.php?module=Emails&action=Check&type=';\"\n style=\"margin-bottom:2px\"\n value=\" \"></div>"; |
|
1039 | - $actual = $email->checkInbox(''); |
|
1040 | - $this->assertSame($expected,$actual); |
|
1037 | + //test with empty string |
|
1038 | + $expected = "<div><input title=\"\"\n class=\"button\"\n type=\"button\" name=\"button\"\n onClick=\"window.location='index.php?module=Emails&action=Check&type=';\"\n style=\"margin-bottom:2px\"\n value=\" \"></div>"; |
|
1039 | + $actual = $email->checkInbox(''); |
|
1040 | + $this->assertSame($expected,$actual); |
|
1041 | 1041 | |
1042 | 1042 | |
1043 | - //test with valid string |
|
1044 | - $expected = "<div><input title=\"\"\n class=\"button\"\n type=\"button\" name=\"button\"\n onClick=\"window.location='index.php?module=Emails&action=Check&type=test';\"\n style=\"margin-bottom:2px\"\n value=\" \"></div>"; |
|
1045 | - $actual = $email->checkInbox('test'); |
|
1046 | - $this->assertSame($expected,$actual); |
|
1043 | + //test with valid string |
|
1044 | + $expected = "<div><input title=\"\"\n class=\"button\"\n type=\"button\" name=\"button\"\n onClick=\"window.location='index.php?module=Emails&action=Check&type=test';\"\n style=\"margin-bottom:2px\"\n value=\" \"></div>"; |
|
1045 | + $actual = $email->checkInbox('test'); |
|
1046 | + $this->assertSame($expected,$actual); |
|
1047 | 1047 | |
1048 | - } |
|
1048 | + } |
|
1049 | 1049 | |
1050 | 1050 | |
1051 | 1051 | |
1052 | - public function testfillPrimaryParentFields() { |
|
1052 | + public function testfillPrimaryParentFields() { |
|
1053 | 1053 | |
1054 | - $email = new Email(); |
|
1054 | + $email = new Email(); |
|
1055 | 1055 | |
1056 | - //execute the method and test if it works and does not throws an exception. |
|
1057 | - try { |
|
1058 | - $email->fillPrimaryParentFields(); |
|
1059 | - $this->assertTrue(true); |
|
1060 | - } |
|
1061 | - catch (Exception $e) { |
|
1062 | - $this->fail(); |
|
1063 | - } |
|
1056 | + //execute the method and test if it works and does not throws an exception. |
|
1057 | + try { |
|
1058 | + $email->fillPrimaryParentFields(); |
|
1059 | + $this->assertTrue(true); |
|
1060 | + } |
|
1061 | + catch (Exception $e) { |
|
1062 | + $this->fail(); |
|
1063 | + } |
|
1064 | 1064 | |
1065 | - } |
|
1065 | + } |
|
1066 | 1066 | |
1067 | 1067 | |
1068 | - public function testcid2Link() |
|
1069 | - { |
|
1070 | - $email = new Email(); |
|
1068 | + public function testcid2Link() |
|
1069 | + { |
|
1070 | + $email = new Email(); |
|
1071 | 1071 | |
1072 | - $email->description_html = "<img class=\"image\" src=\"cid:1\">"; |
|
1073 | - $email->imagePrefix = "prfx"; |
|
1072 | + $email->description_html = "<img class=\"image\" src=\"cid:1\">"; |
|
1073 | + $email->imagePrefix = "prfx"; |
|
1074 | 1074 | |
1075 | - //execute the method and test if it works and does not throws an exception. |
|
1076 | - try { |
|
1077 | - $email->cid2Link("1", "image/png"); |
|
1078 | - $this->assertTrue(true); |
|
1079 | - } |
|
1080 | - catch (Exception $e) { |
|
1081 | - $this->fail(); |
|
1082 | - } |
|
1075 | + //execute the method and test if it works and does not throws an exception. |
|
1076 | + try { |
|
1077 | + $email->cid2Link("1", "image/png"); |
|
1078 | + $this->assertTrue(true); |
|
1079 | + } |
|
1080 | + catch (Exception $e) { |
|
1081 | + $this->fail(); |
|
1082 | + } |
|
1083 | 1083 | |
1084 | 1084 | |
1085 | - } |
|
1085 | + } |
|
1086 | 1086 | |
1087 | 1087 | |
1088 | - public function testcids2Links() |
|
1089 | - { |
|
1090 | - $email = new Email(); |
|
1088 | + public function testcids2Links() |
|
1089 | + { |
|
1090 | + $email = new Email(); |
|
1091 | 1091 | |
1092 | - $email->description_html = "<img class=\"image\" src=\"cid:1\">"; |
|
1093 | - $email->imagePrefix = "prfx"; |
|
1092 | + $email->description_html = "<img class=\"image\" src=\"cid:1\">"; |
|
1093 | + $email->imagePrefix = "prfx"; |
|
1094 | 1094 | |
1095 | - //execute the method and test if it works and does not throws an exception. |
|
1096 | - try { |
|
1097 | - $email->cids2Links(); |
|
1098 | - $this->assertTrue(true); |
|
1099 | - } |
|
1100 | - catch (Exception $e) { |
|
1101 | - $this->fail(); |
|
1102 | - } |
|
1095 | + //execute the method and test if it works and does not throws an exception. |
|
1096 | + try { |
|
1097 | + $email->cids2Links(); |
|
1098 | + $this->assertTrue(true); |
|
1099 | + } |
|
1100 | + catch (Exception $e) { |
|
1101 | + $this->fail(); |
|
1102 | + } |
|
1103 | 1103 | |
1104 | - } |
|
1104 | + } |
|
1105 | 1105 | |
1106 | 1106 | |
1107 | 1107 | public function testsetFieldNullable() |
1108 | 1108 | { |
1109 | - $email = new Email(); |
|
1109 | + $email = new Email(); |
|
1110 | 1110 | |
1111 | - //execute the method and test if it works and does not throws an exception. |
|
1112 | - try { |
|
1113 | - $email->setFieldNullable("description"); |
|
1114 | - $this->assertTrue(true); |
|
1115 | - } |
|
1116 | - catch (Exception $e) { |
|
1117 | - $this->fail(); |
|
1118 | - } |
|
1111 | + //execute the method and test if it works and does not throws an exception. |
|
1112 | + try { |
|
1113 | + $email->setFieldNullable("description"); |
|
1114 | + $this->assertTrue(true); |
|
1115 | + } |
|
1116 | + catch (Exception $e) { |
|
1117 | + $this->fail(); |
|
1118 | + } |
|
1119 | 1119 | |
1120 | 1120 | |
1121 | 1121 | } |
@@ -1123,16 +1123,16 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | public function testrevertFieldNullable() |
1125 | 1125 | { |
1126 | - $email = new Email(); |
|
1126 | + $email = new Email(); |
|
1127 | 1127 | |
1128 | - //execute the method and test if it works and does not throws an exception. |
|
1129 | - try { |
|
1130 | - $email->revertFieldNullable("description"); |
|
1131 | - $this->assertTrue(true); |
|
1132 | - } |
|
1133 | - catch (Exception $e) { |
|
1134 | - $this->fail(); |
|
1135 | - } |
|
1128 | + //execute the method and test if it works and does not throws an exception. |
|
1129 | + try { |
|
1130 | + $email->revertFieldNullable("description"); |
|
1131 | + $this->assertTrue(true); |
|
1132 | + } |
|
1133 | + catch (Exception $e) { |
|
1134 | + $this->fail(); |
|
1135 | + } |
|
1136 | 1136 | |
1137 | 1137 | } |
1138 | 1138 |