@@ -6,38 +6,38 @@ discard block |
||
6 | 6 | |
7 | 7 | public function testjjwg_Maps() { |
8 | 8 | |
9 | - //execute the contructor and check for the Object type and attributes |
|
10 | - $jjwgMaps = new jjwg_Maps(); |
|
9 | + //execute the contructor and check for the Object type and attributes |
|
10 | + $jjwgMaps = new jjwg_Maps(); |
|
11 | 11 | |
12 | - $this->assertInstanceOf('jjwg_Maps',$jjwgMaps); |
|
13 | - $this->assertInstanceOf('Basic',$jjwgMaps); |
|
14 | - $this->assertInstanceOf('SugarBean',$jjwgMaps); |
|
12 | + $this->assertInstanceOf('jjwg_Maps',$jjwgMaps); |
|
13 | + $this->assertInstanceOf('Basic',$jjwgMaps); |
|
14 | + $this->assertInstanceOf('SugarBean',$jjwgMaps); |
|
15 | 15 | |
16 | - $this->assertAttributeEquals('jjwg_Maps', 'module_dir', $jjwgMaps); |
|
17 | - $this->assertAttributeEquals('jjwg_Maps', 'object_name', $jjwgMaps); |
|
18 | - $this->assertAttributeEquals('jjwg_maps', 'table_name', $jjwgMaps); |
|
16 | + $this->assertAttributeEquals('jjwg_Maps', 'module_dir', $jjwgMaps); |
|
17 | + $this->assertAttributeEquals('jjwg_Maps', 'object_name', $jjwgMaps); |
|
18 | + $this->assertAttributeEquals('jjwg_maps', 'table_name', $jjwgMaps); |
|
19 | 19 | |
20 | - $this->assertAttributeEquals(true, 'new_schema', $jjwgMaps); |
|
21 | - $this->assertAttributeEquals(true, 'importable', $jjwgMaps); |
|
22 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $jjwgMaps); |
|
20 | + $this->assertAttributeEquals(true, 'new_schema', $jjwgMaps); |
|
21 | + $this->assertAttributeEquals(true, 'importable', $jjwgMaps); |
|
22 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $jjwgMaps); |
|
23 | 23 | |
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | public function testconfiguration() { |
28 | 28 | |
29 | - error_reporting(E_ERROR | E_PARSE); |
|
29 | + error_reporting(E_ERROR | E_PARSE); |
|
30 | 30 | |
31 | - $jjwgMaps = new jjwg_Maps(); |
|
31 | + $jjwgMaps = new jjwg_Maps(); |
|
32 | 32 | |
33 | - //execute the method and test if it works and does not throws an exception. |
|
34 | - try { |
|
35 | - $jjwgMaps->configuration(); |
|
36 | - $this->assertTrue(true); |
|
37 | - } |
|
38 | - catch (Exception $e) { |
|
39 | - $this->fail(); |
|
40 | - } |
|
33 | + //execute the method and test if it works and does not throws an exception. |
|
34 | + try { |
|
35 | + $jjwgMaps->configuration(); |
|
36 | + $this->assertTrue(true); |
|
37 | + } |
|
38 | + catch (Exception $e) { |
|
39 | + $this->fail(); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | 43 | } |
@@ -45,274 +45,274 @@ discard block |
||
45 | 45 | |
46 | 46 | public function testsaveConfiguration() { |
47 | 47 | |
48 | - $jjwgMaps = new jjwg_Maps(); |
|
48 | + $jjwgMaps = new jjwg_Maps(); |
|
49 | 49 | |
50 | - //test with empty array/default |
|
51 | - $result = $jjwgMaps->saveConfiguration(); |
|
52 | - $this->assertEquals(false, $result); |
|
50 | + //test with empty array/default |
|
51 | + $result = $jjwgMaps->saveConfiguration(); |
|
52 | + $this->assertEquals(false, $result); |
|
53 | 53 | |
54 | 54 | |
55 | - //test with data array |
|
56 | - $result = $jjwgMaps->saveConfiguration(array("test"=>1)); |
|
57 | - $this->assertEquals(true, $result); |
|
55 | + //test with data array |
|
56 | + $result = $jjwgMaps->saveConfiguration(array("test"=>1)); |
|
57 | + $this->assertEquals(true, $result); |
|
58 | 58 | |
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testupdateGeocodeInfo() { |
63 | 63 | |
64 | - $jjwgMaps = new jjwg_Maps(); |
|
65 | - $bean = new Meeting(); |
|
64 | + $jjwgMaps = new jjwg_Maps(); |
|
65 | + $bean = new Meeting(); |
|
66 | 66 | |
67 | - //test without bean attributes set |
|
68 | - $result = $jjwgMaps->updateGeocodeInfo($bean); |
|
69 | - $this->assertSame(false, $result); |
|
67 | + //test without bean attributes set |
|
68 | + $result = $jjwgMaps->updateGeocodeInfo($bean); |
|
69 | + $this->assertSame(false, $result); |
|
70 | 70 | |
71 | 71 | |
72 | - //test with required attributes set |
|
73 | - $bean->id = 1; |
|
74 | - $bean->jjwg_maps_lat_c = "100"; |
|
75 | - $bean->jjwg_maps_lng_c = "40"; |
|
72 | + //test with required attributes set |
|
73 | + $bean->id = 1; |
|
74 | + $bean->jjwg_maps_lat_c = "100"; |
|
75 | + $bean->jjwg_maps_lng_c = "40"; |
|
76 | 76 | |
77 | - $result = $jjwgMaps->updateGeocodeInfo($bean); |
|
77 | + $result = $jjwgMaps->updateGeocodeInfo($bean); |
|
78 | 78 | |
79 | - $this->assertEquals(null, $result); |
|
80 | - $this->assertEquals(100, $bean->jjwg_maps_lat_c); |
|
81 | - $this->assertEquals(40, $bean->jjwg_maps_lng_c); |
|
82 | - $this->assertEquals('', $bean->jjwg_maps_geocode_status_c); |
|
83 | - $this->assertEquals('', $bean->jjwg_maps_address_c); |
|
79 | + $this->assertEquals(null, $result); |
|
80 | + $this->assertEquals(100, $bean->jjwg_maps_lat_c); |
|
81 | + $this->assertEquals(40, $bean->jjwg_maps_lng_c); |
|
82 | + $this->assertEquals('', $bean->jjwg_maps_geocode_status_c); |
|
83 | + $this->assertEquals('', $bean->jjwg_maps_address_c); |
|
84 | 84 | |
85 | 85 | } |
86 | 86 | |
87 | 87 | |
88 | 88 | public function testupdateRelatedMeetingsGeocodeInfo() { |
89 | 89 | |
90 | - $jjwgMaps = new jjwg_Maps(); |
|
91 | - $bean = new Account(); |
|
90 | + $jjwgMaps = new jjwg_Maps(); |
|
91 | + $bean = new Account(); |
|
92 | 92 | |
93 | - //test without setting bean attributes |
|
94 | - $result = $jjwgMaps->updateRelatedMeetingsGeocodeInfo($bean); |
|
95 | - $this->assertEquals(false, $result); |
|
93 | + //test without setting bean attributes |
|
94 | + $result = $jjwgMaps->updateRelatedMeetingsGeocodeInfo($bean); |
|
95 | + $this->assertEquals(false, $result); |
|
96 | 96 | |
97 | 97 | |
98 | - //test with required attributes set |
|
99 | - $bean->id = 1; |
|
100 | - $bean->jjwg_maps_lat_c = "100"; |
|
101 | - $bean->jjwg_maps_lng_c = "40"; |
|
98 | + //test with required attributes set |
|
99 | + $bean->id = 1; |
|
100 | + $bean->jjwg_maps_lat_c = "100"; |
|
101 | + $bean->jjwg_maps_lng_c = "40"; |
|
102 | 102 | |
103 | - $result = $jjwgMaps->updateRelatedMeetingsGeocodeInfo($bean); |
|
104 | - $this->assertSame(null, $result); |
|
105 | - $this->assertInstanceOf('jjwg_Address_Cache',$jjwgMaps->jjwg_Address_Cache); |
|
103 | + $result = $jjwgMaps->updateRelatedMeetingsGeocodeInfo($bean); |
|
104 | + $this->assertSame(null, $result); |
|
105 | + $this->assertInstanceOf('jjwg_Address_Cache',$jjwgMaps->jjwg_Address_Cache); |
|
106 | 106 | |
107 | 107 | } |
108 | 108 | |
109 | 109 | |
110 | 110 | public function testupdateMeetingGeocodeInfo() { |
111 | 111 | |
112 | - $jjwgMaps = new jjwg_Maps(); |
|
112 | + $jjwgMaps = new jjwg_Maps(); |
|
113 | 113 | |
114 | - //test with required attributes set |
|
115 | - $bean = new Meeting(); |
|
116 | - $bean->id = 1; |
|
117 | - $bean->jjwg_maps_lat_c = "100"; |
|
118 | - $bean->jjwg_maps_lng_c = "40"; |
|
114 | + //test with required attributes set |
|
115 | + $bean = new Meeting(); |
|
116 | + $bean->id = 1; |
|
117 | + $bean->jjwg_maps_lat_c = "100"; |
|
118 | + $bean->jjwg_maps_lng_c = "40"; |
|
119 | 119 | |
120 | - $result = $jjwgMaps->updateMeetingGeocodeInfo($bean); |
|
121 | - $this->assertSame(null, $result); |
|
120 | + $result = $jjwgMaps->updateMeetingGeocodeInfo($bean); |
|
121 | + $this->assertSame(null, $result); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | 125 | |
126 | 126 | public function testupdateGeocodeInfoByAssocQuery() { |
127 | 127 | |
128 | - $jjwgMaps = new jjwg_Maps(); |
|
128 | + $jjwgMaps = new jjwg_Maps(); |
|
129 | 129 | |
130 | - //test with empty parameters |
|
131 | - $result = $jjwgMaps->updateGeocodeInfoByAssocQuery('', array(), array()); |
|
132 | - $this->assertSame(false, $result); |
|
130 | + //test with empty parameters |
|
131 | + $result = $jjwgMaps->updateGeocodeInfoByAssocQuery('', array(), array()); |
|
132 | + $this->assertSame(false, $result); |
|
133 | 133 | |
134 | 134 | |
135 | - //test with non empty but invalid parameters |
|
136 | - $result = $jjwgMaps->updateGeocodeInfoByAssocQuery('test', array(), array()); |
|
137 | - $this->assertSame(false, $result); |
|
135 | + //test with non empty but invalid parameters |
|
136 | + $result = $jjwgMaps->updateGeocodeInfoByAssocQuery('test', array(), array()); |
|
137 | + $this->assertSame(false, $result); |
|
138 | 138 | |
139 | 139 | |
140 | - //test with non empty valid parameters |
|
141 | - $result = $jjwgMaps->updateGeocodeInfoByAssocQuery('accounts', array('id'=>1), array()); |
|
142 | - $this->assertSame(null, $result); |
|
140 | + //test with non empty valid parameters |
|
141 | + $result = $jjwgMaps->updateGeocodeInfoByAssocQuery('accounts', array('id'=>1), array()); |
|
142 | + $this->assertSame(null, $result); |
|
143 | 143 | |
144 | 144 | } |
145 | 145 | |
146 | 146 | |
147 | 147 | public function testupdateGeocodeInfoByBeanQuery() { |
148 | 148 | |
149 | - $jjwgMaps = new jjwg_Maps(); |
|
150 | - $bean = new Account(); |
|
149 | + $jjwgMaps = new jjwg_Maps(); |
|
150 | + $bean = new Account(); |
|
151 | 151 | |
152 | 152 | |
153 | - //test without setting bean attributes |
|
154 | - $result = $jjwgMaps->updateGeocodeInfoByBeanQuery($bean); |
|
155 | - $this->assertSame(false, $result); |
|
153 | + //test without setting bean attributes |
|
154 | + $result = $jjwgMaps->updateGeocodeInfoByBeanQuery($bean); |
|
155 | + $this->assertSame(false, $result); |
|
156 | 156 | |
157 | 157 | |
158 | - //test with required attributes set |
|
159 | - $bean->id = 1; |
|
160 | - $result = $jjwgMaps->updateGeocodeInfoByBeanQuery($bean); |
|
161 | - $this->assertSame(null, $result); |
|
158 | + //test with required attributes set |
|
159 | + $bean->id = 1; |
|
160 | + $result = $jjwgMaps->updateGeocodeInfoByBeanQuery($bean); |
|
161 | + $this->assertSame(null, $result); |
|
162 | 162 | |
163 | 163 | } |
164 | 164 | |
165 | 165 | |
166 | 166 | public function testdeleteAllGeocodeInfoByBeanQuery() { |
167 | 167 | |
168 | - $jjwgMaps = new jjwg_Maps(); |
|
169 | - $bean = new Call(); |
|
168 | + $jjwgMaps = new jjwg_Maps(); |
|
169 | + $bean = new Call(); |
|
170 | 170 | |
171 | 171 | |
172 | - //test with invalid geocode bean |
|
173 | - $result = $jjwgMaps->deleteAllGeocodeInfoByBeanQuery($bean); |
|
174 | - $this->assertSame(false, $result); |
|
172 | + //test with invalid geocode bean |
|
173 | + $result = $jjwgMaps->deleteAllGeocodeInfoByBeanQuery($bean); |
|
174 | + $this->assertSame(false, $result); |
|
175 | 175 | |
176 | 176 | |
177 | - //test with invalid geocode bean |
|
178 | - $bean = new Account(); |
|
179 | - $result = $jjwgMaps->deleteAllGeocodeInfoByBeanQuery($bean); |
|
180 | - $this->assertSame(null, $result); |
|
177 | + //test with invalid geocode bean |
|
178 | + $bean = new Account(); |
|
179 | + $result = $jjwgMaps->deleteAllGeocodeInfoByBeanQuery($bean); |
|
180 | + $this->assertSame(null, $result); |
|
181 | 181 | |
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | 185 | public function testgetGeocodeAddressesResult() { |
186 | 186 | |
187 | - $jjwgMaps = new jjwg_Maps(); |
|
187 | + $jjwgMaps = new jjwg_Maps(); |
|
188 | 188 | |
189 | - //test with invalid geocode bean |
|
190 | - $result = $jjwgMaps->getGeocodeAddressesResult("calls"); |
|
191 | - $this->assertSame(false, $result); |
|
189 | + //test with invalid geocode bean |
|
190 | + $result = $jjwgMaps->getGeocodeAddressesResult("calls"); |
|
191 | + $this->assertSame(false, $result); |
|
192 | 192 | |
193 | 193 | |
194 | - //test with invalid geocode bean |
|
195 | - $result = $jjwgMaps->getGeocodeAddressesResult("accounts"); |
|
196 | - $this->assertInstanceOf('mysqli_result',$result); |
|
194 | + //test with invalid geocode bean |
|
195 | + $result = $jjwgMaps->getGeocodeAddressesResult("accounts"); |
|
196 | + $this->assertInstanceOf('mysqli_result',$result); |
|
197 | 197 | |
198 | 198 | } |
199 | 199 | |
200 | 200 | |
201 | 201 | public function testgetGoogleMapsGeocode() { |
202 | 202 | |
203 | - $jjwgMaps = new jjwg_Maps(); |
|
204 | - |
|
205 | - //test with invalid value |
|
206 | - $expected = array ( |
|
207 | - 'address' => '', |
|
208 | - 'status' => 'ZERO_RESULTS', |
|
209 | - 'lat' => NULL, |
|
210 | - 'lng' => NULL, |
|
211 | - ); |
|
212 | - |
|
213 | - $actual = $jjwgMaps->getGoogleMapsGeocode(""); |
|
214 | - $this->assertSame($expected,$actual); |
|
215 | - |
|
216 | - |
|
217 | - //test with valid value |
|
218 | - $expected = array ( |
|
219 | - 'address' => 'washington D.C', |
|
220 | - 'status' => 'OK', |
|
221 | - 'lat' => 38.90719229999999839719748706556856632232666015625, |
|
222 | - 'lng' => -77.0368706999999943718648864887654781341552734375, |
|
223 | - ); |
|
224 | - $actual = $jjwgMaps->getGoogleMapsGeocode("washington D.C"); |
|
225 | - $this->assertSame($expected,$actual); |
|
203 | + $jjwgMaps = new jjwg_Maps(); |
|
204 | + |
|
205 | + //test with invalid value |
|
206 | + $expected = array ( |
|
207 | + 'address' => '', |
|
208 | + 'status' => 'ZERO_RESULTS', |
|
209 | + 'lat' => NULL, |
|
210 | + 'lng' => NULL, |
|
211 | + ); |
|
212 | + |
|
213 | + $actual = $jjwgMaps->getGoogleMapsGeocode(""); |
|
214 | + $this->assertSame($expected,$actual); |
|
215 | + |
|
216 | + |
|
217 | + //test with valid value |
|
218 | + $expected = array ( |
|
219 | + 'address' => 'washington D.C', |
|
220 | + 'status' => 'OK', |
|
221 | + 'lat' => 38.90719229999999839719748706556856632232666015625, |
|
222 | + 'lng' => -77.0368706999999943718648864887654781341552734375, |
|
223 | + ); |
|
224 | + $actual = $jjwgMaps->getGoogleMapsGeocode("washington D.C"); |
|
225 | + $this->assertSame($expected,$actual); |
|
226 | 226 | |
227 | 227 | |
228 | - //test with valid value and full array true |
|
229 | - $expected = |
|
230 | - array ( |
|
231 | - 'results' => |
|
232 | - array ( |
|
233 | - array ( |
|
234 | - 'address_components' => |
|
235 | - array ( |
|
236 | - array ( 'long_name' => 'Washington', 'short_name' => 'D.C.', 'types' => array ( 'locality', 'political', ), ), |
|
237 | - array ( 'long_name' => 'District of Columbia', 'short_name' => 'District of Columbia', 'types' => array ( 'administrative_area_level_2','political', ), ), |
|
238 | - array ( 'long_name' => 'District of Columbia', 'short_name' => 'DC', 'types' => array ( 'administrative_area_level_1', 'political', ), |
|
239 | - ), |
|
240 | - array ( 'long_name' => 'United States', 'short_name' => 'US', 'types' => array ( 'country', 'political', ), ), |
|
241 | - ), |
|
242 | - 'formatted_address' => 'Washington, DC, USA', |
|
243 | - 'geometry' => |
|
244 | - array ( |
|
245 | - 'bounds' => array ( 'northeast' => array ( 'lat' => 38.9955479999999994333848007954657077789306640625, 'lng' => -76.909392999999994344761944375932216644287109375, ), 'southwest' => array ( 'lat' => 38.8031495000000035133780329488217830657958984375, 'lng' => -77.1197399999999930741978459991514682769775390625, ), ), |
|
246 | - 'location' => array ( 'lat' => 38.90719229999999839719748706556856632232666015625, 'lng' => -77.0368706999999943718648864887654781341552734375,), |
|
247 | - 'location_type' => 'APPROXIMATE', |
|
248 | - 'viewport' => array ( 'northeast' => array ( 'lat' => 38.9955479999999994333848007954657077789306640625, 'lng' => -76.909392999999994344761944375932216644287109375,), 'southwest' => array ( 'lat' => 38.8031495000000035133780329488217830657958984375, 'lng' => -77.1197399999999930741978459991514682769775390625,), ), |
|
249 | - ), |
|
250 | - 'place_id' => 'ChIJW-T2Wt7Gt4kRKl2I1CJFUsI', |
|
251 | - 'types' => array ('locality', 'political'), |
|
252 | - ), |
|
253 | - ), |
|
254 | - 'status' => 'OK', |
|
255 | - ); |
|
256 | - |
|
257 | - $actual = $jjwgMaps->getGoogleMapsGeocode("washington D.C",true); |
|
228 | + //test with valid value and full array true |
|
229 | + $expected = |
|
230 | + array ( |
|
231 | + 'results' => |
|
232 | + array ( |
|
233 | + array ( |
|
234 | + 'address_components' => |
|
235 | + array ( |
|
236 | + array ( 'long_name' => 'Washington', 'short_name' => 'D.C.', 'types' => array ( 'locality', 'political', ), ), |
|
237 | + array ( 'long_name' => 'District of Columbia', 'short_name' => 'District of Columbia', 'types' => array ( 'administrative_area_level_2','political', ), ), |
|
238 | + array ( 'long_name' => 'District of Columbia', 'short_name' => 'DC', 'types' => array ( 'administrative_area_level_1', 'political', ), |
|
239 | + ), |
|
240 | + array ( 'long_name' => 'United States', 'short_name' => 'US', 'types' => array ( 'country', 'political', ), ), |
|
241 | + ), |
|
242 | + 'formatted_address' => 'Washington, DC, USA', |
|
243 | + 'geometry' => |
|
244 | + array ( |
|
245 | + 'bounds' => array ( 'northeast' => array ( 'lat' => 38.9955479999999994333848007954657077789306640625, 'lng' => -76.909392999999994344761944375932216644287109375, ), 'southwest' => array ( 'lat' => 38.8031495000000035133780329488217830657958984375, 'lng' => -77.1197399999999930741978459991514682769775390625, ), ), |
|
246 | + 'location' => array ( 'lat' => 38.90719229999999839719748706556856632232666015625, 'lng' => -77.0368706999999943718648864887654781341552734375,), |
|
247 | + 'location_type' => 'APPROXIMATE', |
|
248 | + 'viewport' => array ( 'northeast' => array ( 'lat' => 38.9955479999999994333848007954657077789306640625, 'lng' => -76.909392999999994344761944375932216644287109375,), 'southwest' => array ( 'lat' => 38.8031495000000035133780329488217830657958984375, 'lng' => -77.1197399999999930741978459991514682769775390625,), ), |
|
249 | + ), |
|
250 | + 'place_id' => 'ChIJW-T2Wt7Gt4kRKl2I1CJFUsI', |
|
251 | + 'types' => array ('locality', 'political'), |
|
252 | + ), |
|
253 | + ), |
|
254 | + 'status' => 'OK', |
|
255 | + ); |
|
256 | + |
|
257 | + $actual = $jjwgMaps->getGoogleMapsGeocode("washington D.C",true); |
|
258 | 258 | |
259 | - $this->assertSame($expected['results']['geometry'],$actual['results']['geometry']); |
|
260 | - //$this->assertSame($expected,$actual); |
|
259 | + $this->assertSame($expected['results']['geometry'],$actual['results']['geometry']); |
|
260 | + //$this->assertSame($expected,$actual); |
|
261 | 261 | |
262 | 262 | } |
263 | 263 | |
264 | 264 | |
265 | 265 | public function testdefineMapsAddress() { |
266 | 266 | |
267 | - $jjwgMaps = new jjwg_Maps(); |
|
267 | + $jjwgMaps = new jjwg_Maps(); |
|
268 | 268 | |
269 | 269 | |
270 | - //test for Account Object type |
|
271 | - $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
|
272 | - $result = $jjwgMaps->defineMapsAddress('Account',$address); |
|
273 | - //var_dump($result); |
|
274 | - $this->assertEquals(array('address' => "addr 1, addr 2, addr 3, addr 4, addr 5"), $result); |
|
270 | + //test for Account Object type |
|
271 | + $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
|
272 | + $result = $jjwgMaps->defineMapsAddress('Account',$address); |
|
273 | + //var_dump($result); |
|
274 | + $this->assertEquals(array('address' => "addr 1, addr 2, addr 3, addr 4, addr 5"), $result); |
|
275 | 275 | |
276 | 276 | |
277 | 277 | |
278 | - //test for Contact Object type |
|
279 | - $address = array('id'=>1, 'primary_address_street'=>"addr 1", 'primary_address_city'=>"addr 2", 'primary_address_state'=>"addr 3", 'primary_address_postalcode'=>"addr 4", 'primary_address_country'=>"addr 5"); |
|
280 | - $result = $jjwgMaps->defineMapsAddress('Contact',$address); |
|
281 | - $this->assertEquals(array('address' => "addr 1, addr 2, addr 3, addr 4, addr 5"), $result); |
|
278 | + //test for Contact Object type |
|
279 | + $address = array('id'=>1, 'primary_address_street'=>"addr 1", 'primary_address_city'=>"addr 2", 'primary_address_state'=>"addr 3", 'primary_address_postalcode'=>"addr 4", 'primary_address_country'=>"addr 5"); |
|
280 | + $result = $jjwgMaps->defineMapsAddress('Contact',$address); |
|
281 | + $this->assertEquals(array('address' => "addr 1, addr 2, addr 3, addr 4, addr 5"), $result); |
|
282 | 282 | |
283 | 283 | |
284 | 284 | |
285 | - //test for Leads Object type |
|
286 | - $address = array('id'=>1, 'primary_address_street'=>"addr 1", 'primary_address_city'=>"addr 2", 'primary_address_state'=>"addr 3", 'primary_address_postalcode'=>"addr 4", 'primary_address_country'=>"addr 5"); |
|
287 | - $result = $jjwgMaps->defineMapsAddress('Lead',$address); |
|
288 | - $this->assertEquals(array('address' => "addr 1, addr 2, addr 3, addr 4, addr 5"), $result); |
|
285 | + //test for Leads Object type |
|
286 | + $address = array('id'=>1, 'primary_address_street'=>"addr 1", 'primary_address_city'=>"addr 2", 'primary_address_state'=>"addr 3", 'primary_address_postalcode'=>"addr 4", 'primary_address_country'=>"addr 5"); |
|
287 | + $result = $jjwgMaps->defineMapsAddress('Lead',$address); |
|
288 | + $this->assertEquals(array('address' => "addr 1, addr 2, addr 3, addr 4, addr 5"), $result); |
|
289 | 289 | |
290 | 290 | |
291 | 291 | |
292 | - //test for Opportunities Object type |
|
293 | - $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
|
294 | - $result = $jjwgMaps->defineMapsAddress('Opportunity',$address); |
|
295 | - $this->assertEquals(false, $result); |
|
292 | + //test for Opportunities Object type |
|
293 | + $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
|
294 | + $result = $jjwgMaps->defineMapsAddress('Opportunity',$address); |
|
295 | + $this->assertEquals(false, $result); |
|
296 | 296 | |
297 | 297 | |
298 | 298 | |
299 | - //test for Case Object type |
|
300 | - $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
|
301 | - $result = $jjwgMaps->defineMapsAddress('Case',$address); |
|
302 | - $this->assertEquals(false, $result); |
|
299 | + //test for Case Object type |
|
300 | + $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
|
301 | + $result = $jjwgMaps->defineMapsAddress('Case',$address); |
|
302 | + $this->assertEquals(false, $result); |
|
303 | 303 | |
304 | 304 | |
305 | - //test for Project Object type |
|
306 | - $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
|
307 | - $result = $jjwgMaps->defineMapsAddress('Project',$address); |
|
308 | - $this->assertEquals(false, $result); |
|
305 | + //test for Project Object type |
|
306 | + $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
|
307 | + $result = $jjwgMaps->defineMapsAddress('Project',$address); |
|
308 | + $this->assertEquals(false, $result); |
|
309 | 309 | |
310 | 310 | |
311 | 311 | |
312 | - //test for Project Meetings type |
|
313 | - $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
|
314 | - $result = $jjwgMaps->defineMapsAddress('Meeting',$address); |
|
315 | - $this->assertEquals(false, $result); |
|
312 | + //test for Project Meetings type |
|
313 | + $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
|
314 | + $result = $jjwgMaps->defineMapsAddress('Meeting',$address); |
|
315 | + $this->assertEquals(false, $result); |
|
316 | 316 | |
317 | 317 | } |
318 | 318 | |
@@ -320,40 +320,40 @@ discard block |
||
320 | 320 | public function testdefineMapsFormattedAddress() { |
321 | 321 | |
322 | 322 | |
323 | - $jjwgMaps = new jjwg_Maps(); |
|
323 | + $jjwgMaps = new jjwg_Maps(); |
|
324 | 324 | |
325 | - $result = $jjwgMaps->defineMapsFormattedAddress(array()); |
|
326 | - $this->assertEquals(false, $result); |
|
325 | + $result = $jjwgMaps->defineMapsFormattedAddress(array()); |
|
326 | + $this->assertEquals(false, $result); |
|
327 | 327 | |
328 | 328 | |
329 | - //test for type billing |
|
330 | - $address = array('billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
|
331 | - $result = $jjwgMaps->defineMapsFormattedAddress($address,'billing'); |
|
332 | - $this->assertEquals("addr 1, addr 2, addr 3, addr 4, addr 5", $result); |
|
329 | + //test for type billing |
|
330 | + $address = array('billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
|
331 | + $result = $jjwgMaps->defineMapsFormattedAddress($address,'billing'); |
|
332 | + $this->assertEquals("addr 1, addr 2, addr 3, addr 4, addr 5", $result); |
|
333 | 333 | |
334 | 334 | |
335 | - //test for type shipping |
|
336 | - $address = array('shipping_address_street'=>"addr 1", 'shipping_address_city'=>"addr 2", 'shipping_address_state'=>"addr 3", 'shipping_address_postalcode'=>"addr 4", 'shipping_address_country'=>"addr 5"); |
|
337 | - $result = $jjwgMaps->defineMapsFormattedAddress($address,'shipping'); |
|
338 | - $this->assertEquals("addr 1, addr 2, addr 3, addr 4, addr 5", $result); |
|
335 | + //test for type shipping |
|
336 | + $address = array('shipping_address_street'=>"addr 1", 'shipping_address_city'=>"addr 2", 'shipping_address_state'=>"addr 3", 'shipping_address_postalcode'=>"addr 4", 'shipping_address_country'=>"addr 5"); |
|
337 | + $result = $jjwgMaps->defineMapsFormattedAddress($address,'shipping'); |
|
338 | + $this->assertEquals("addr 1, addr 2, addr 3, addr 4, addr 5", $result); |
|
339 | 339 | |
340 | 340 | |
341 | - //test for type primary |
|
342 | - $address = array('primary_address_street'=>"addr 1", 'primary_address_city'=>"addr 2", 'primary_address_state'=>"addr 3", 'primary_address_postalcode'=>"addr 4", 'primary_address_country'=>"addr 5"); |
|
343 | - $result = $jjwgMaps->defineMapsFormattedAddress($address,'primary'); |
|
344 | - $this->assertEquals("addr 1, addr 2, addr 3, addr 4, addr 5", $result); |
|
341 | + //test for type primary |
|
342 | + $address = array('primary_address_street'=>"addr 1", 'primary_address_city'=>"addr 2", 'primary_address_state'=>"addr 3", 'primary_address_postalcode'=>"addr 4", 'primary_address_country'=>"addr 5"); |
|
343 | + $result = $jjwgMaps->defineMapsFormattedAddress($address,'primary'); |
|
344 | + $this->assertEquals("addr 1, addr 2, addr 3, addr 4, addr 5", $result); |
|
345 | 345 | |
346 | 346 | |
347 | - //test for type alt |
|
348 | - $address = array('alt_address_street'=>"addr 1", 'alt_address_city'=>"addr 2", 'alt_address_state'=>"addr 3", 'alt_address_postalcode'=>"addr 4", 'alt_address_country'=>"addr 5"); |
|
349 | - $result = $jjwgMaps->defineMapsFormattedAddress($address,'alt'); |
|
350 | - $this->assertEquals("addr 1, addr 2, addr 3, addr 4, addr 5", $result); |
|
347 | + //test for type alt |
|
348 | + $address = array('alt_address_street'=>"addr 1", 'alt_address_city'=>"addr 2", 'alt_address_state'=>"addr 3", 'alt_address_postalcode'=>"addr 4", 'alt_address_country'=>"addr 5"); |
|
349 | + $result = $jjwgMaps->defineMapsFormattedAddress($address,'alt'); |
|
350 | + $this->assertEquals("addr 1, addr 2, addr 3, addr 4, addr 5", $result); |
|
351 | 351 | |
352 | 352 | |
353 | - //test for type address |
|
354 | - $address = array('address_street'=>"addr 1", 'address_city'=>"addr 2", 'address_state'=>"addr 3", 'address_postalcode'=>"addr 4"); |
|
355 | - $result = $jjwgMaps->defineMapsFormattedAddress($address,'address'); |
|
356 | - $this->assertEquals("addr 1, addr 2, addr 3, addr 4", $result); |
|
353 | + //test for type address |
|
354 | + $address = array('address_street'=>"addr 1", 'address_city'=>"addr 2", 'address_state'=>"addr 3", 'address_postalcode'=>"addr 4"); |
|
355 | + $result = $jjwgMaps->defineMapsFormattedAddress($address,'address'); |
|
356 | + $this->assertEquals("addr 1, addr 2, addr 3, addr 4", $result); |
|
357 | 357 | |
358 | 358 | |
359 | 359 | } |
@@ -361,52 +361,52 @@ discard block |
||
361 | 361 | |
362 | 362 | public function testis_valid_lng() { |
363 | 363 | |
364 | - $jjwgMaps = new jjwg_Maps(); |
|
364 | + $jjwgMaps = new jjwg_Maps(); |
|
365 | 365 | |
366 | - //test with invalid values |
|
367 | - $this->assertEquals(false, $jjwgMaps->is_valid_lng('') ); |
|
368 | - $this->assertEquals(false, $jjwgMaps->is_valid_lng(181) ); |
|
369 | - $this->assertEquals(false, $jjwgMaps->is_valid_lng(-181) ); |
|
366 | + //test with invalid values |
|
367 | + $this->assertEquals(false, $jjwgMaps->is_valid_lng('') ); |
|
368 | + $this->assertEquals(false, $jjwgMaps->is_valid_lng(181) ); |
|
369 | + $this->assertEquals(false, $jjwgMaps->is_valid_lng(-181) ); |
|
370 | 370 | |
371 | - //test with valid values |
|
372 | - $this->assertEquals(true, $jjwgMaps->is_valid_lng(180) ); |
|
373 | - $this->assertEquals(true, $jjwgMaps->is_valid_lng(-180) ); |
|
371 | + //test with valid values |
|
372 | + $this->assertEquals(true, $jjwgMaps->is_valid_lng(180) ); |
|
373 | + $this->assertEquals(true, $jjwgMaps->is_valid_lng(-180) ); |
|
374 | 374 | |
375 | 375 | } |
376 | 376 | |
377 | 377 | |
378 | 378 | public function testis_valid_lat() { |
379 | 379 | |
380 | - $jjwgMaps = new jjwg_Maps(); |
|
380 | + $jjwgMaps = new jjwg_Maps(); |
|
381 | 381 | |
382 | - //test with invalid values |
|
383 | - $this->assertEquals(false, $jjwgMaps->is_valid_lat('') ); |
|
384 | - $this->assertEquals(false, $jjwgMaps->is_valid_lat(91) ); |
|
385 | - $this->assertEquals(false, $jjwgMaps->is_valid_lat(-91) ); |
|
382 | + //test with invalid values |
|
383 | + $this->assertEquals(false, $jjwgMaps->is_valid_lat('') ); |
|
384 | + $this->assertEquals(false, $jjwgMaps->is_valid_lat(91) ); |
|
385 | + $this->assertEquals(false, $jjwgMaps->is_valid_lat(-91) ); |
|
386 | 386 | |
387 | - //test with valid values |
|
388 | - $this->assertEquals(true, $jjwgMaps->is_valid_lat(90) ); |
|
389 | - $this->assertEquals(true, $jjwgMaps->is_valid_lat(-90) ); |
|
387 | + //test with valid values |
|
388 | + $this->assertEquals(true, $jjwgMaps->is_valid_lat(90) ); |
|
389 | + $this->assertEquals(true, $jjwgMaps->is_valid_lat(-90) ); |
|
390 | 390 | |
391 | 391 | } |
392 | 392 | |
393 | 393 | |
394 | 394 | public function testlogGeocodeInfo() { |
395 | 395 | |
396 | - $jjwgMaps = new jjwg_Maps(); |
|
396 | + $jjwgMaps = new jjwg_Maps(); |
|
397 | 397 | |
398 | - $bean = new Meeting(); |
|
399 | - $bean->jjwg_maps_lat_c = "100"; |
|
400 | - $bean->jjwg_maps_lng_c = "40"; |
|
398 | + $bean = new Meeting(); |
|
399 | + $bean->jjwg_maps_lat_c = "100"; |
|
400 | + $bean->jjwg_maps_lng_c = "40"; |
|
401 | 401 | |
402 | - //execute the method and test if it works and does not throws an exception. |
|
403 | - try { |
|
404 | - $jjwgMaps->logGeocodeInfo($bean); |
|
405 | - $this->assertTrue(true); |
|
406 | - } |
|
407 | - catch (Exception $e) { |
|
408 | - $this->fail(); |
|
409 | - } |
|
402 | + //execute the method and test if it works and does not throws an exception. |
|
403 | + try { |
|
404 | + $jjwgMaps->logGeocodeInfo($bean); |
|
405 | + $this->assertTrue(true); |
|
406 | + } |
|
407 | + catch (Exception $e) { |
|
408 | + $this->fail(); |
|
409 | + } |
|
410 | 410 | |
411 | 411 | |
412 | 412 | } |
@@ -414,8 +414,8 @@ discard block |
||
414 | 414 | |
415 | 415 | public function testgetProspectLists() |
416 | 416 | { |
417 | - $result = getProspectLists(); |
|
418 | - $this->assertTrue(is_array($result)); |
|
417 | + $result = getProspectLists(); |
|
418 | + $this->assertTrue(is_array($result)); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class jjwg_MapsTest extends PHPUnit_Framework_TestCase{ |
|
3 | +class jjwg_MapsTest extends PHPUnit_Framework_TestCase { |
|
4 | 4 | |
5 | 5 | |
6 | 6 | |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | //execute the contructor and check for the Object type and attributes |
10 | 10 | $jjwgMaps = new jjwg_Maps(); |
11 | 11 | |
12 | - $this->assertInstanceOf('jjwg_Maps',$jjwgMaps); |
|
13 | - $this->assertInstanceOf('Basic',$jjwgMaps); |
|
14 | - $this->assertInstanceOf('SugarBean',$jjwgMaps); |
|
12 | + $this->assertInstanceOf('jjwg_Maps', $jjwgMaps); |
|
13 | + $this->assertInstanceOf('Basic', $jjwgMaps); |
|
14 | + $this->assertInstanceOf('SugarBean', $jjwgMaps); |
|
15 | 15 | |
16 | 16 | $this->assertAttributeEquals('jjwg_Maps', 'module_dir', $jjwgMaps); |
17 | 17 | $this->assertAttributeEquals('jjwg_Maps', 'object_name', $jjwgMaps); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | $result = $jjwgMaps->updateRelatedMeetingsGeocodeInfo($bean); |
104 | 104 | $this->assertSame(null, $result); |
105 | - $this->assertInstanceOf('jjwg_Address_Cache',$jjwgMaps->jjwg_Address_Cache); |
|
105 | + $this->assertInstanceOf('jjwg_Address_Cache', $jjwgMaps->jjwg_Address_Cache); |
|
106 | 106 | |
107 | 107 | } |
108 | 108 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | //test with invalid geocode bean |
195 | 195 | $result = $jjwgMaps->getGeocodeAddressesResult("accounts"); |
196 | - $this->assertInstanceOf('mysqli_result',$result); |
|
196 | + $this->assertInstanceOf('mysqli_result', $result); |
|
197 | 197 | |
198 | 198 | } |
199 | 199 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $jjwgMaps = new jjwg_Maps(); |
204 | 204 | |
205 | 205 | //test with invalid value |
206 | - $expected = array ( |
|
206 | + $expected = array( |
|
207 | 207 | 'address' => '', |
208 | 208 | 'status' => 'ZERO_RESULTS', |
209 | 209 | 'lat' => NULL, |
@@ -211,52 +211,52 @@ discard block |
||
211 | 211 | ); |
212 | 212 | |
213 | 213 | $actual = $jjwgMaps->getGoogleMapsGeocode(""); |
214 | - $this->assertSame($expected,$actual); |
|
214 | + $this->assertSame($expected, $actual); |
|
215 | 215 | |
216 | 216 | |
217 | 217 | //test with valid value |
218 | - $expected = array ( |
|
218 | + $expected = array( |
|
219 | 219 | 'address' => 'washington D.C', |
220 | 220 | 'status' => 'OK', |
221 | 221 | 'lat' => 38.90719229999999839719748706556856632232666015625, |
222 | 222 | 'lng' => -77.0368706999999943718648864887654781341552734375, |
223 | 223 | ); |
224 | 224 | $actual = $jjwgMaps->getGoogleMapsGeocode("washington D.C"); |
225 | - $this->assertSame($expected,$actual); |
|
225 | + $this->assertSame($expected, $actual); |
|
226 | 226 | |
227 | 227 | |
228 | 228 | //test with valid value and full array true |
229 | 229 | $expected = |
230 | - array ( |
|
230 | + array( |
|
231 | 231 | 'results' => |
232 | - array ( |
|
233 | - array ( |
|
232 | + array( |
|
233 | + array( |
|
234 | 234 | 'address_components' => |
235 | - array ( |
|
236 | - array ( 'long_name' => 'Washington', 'short_name' => 'D.C.', 'types' => array ( 'locality', 'political', ), ), |
|
237 | - array ( 'long_name' => 'District of Columbia', 'short_name' => 'District of Columbia', 'types' => array ( 'administrative_area_level_2','political', ), ), |
|
238 | - array ( 'long_name' => 'District of Columbia', 'short_name' => 'DC', 'types' => array ( 'administrative_area_level_1', 'political', ), |
|
235 | + array( |
|
236 | + array('long_name' => 'Washington', 'short_name' => 'D.C.', 'types' => array('locality', 'political',),), |
|
237 | + array('long_name' => 'District of Columbia', 'short_name' => 'District of Columbia', 'types' => array('administrative_area_level_2', 'political',),), |
|
238 | + array('long_name' => 'District of Columbia', 'short_name' => 'DC', 'types' => array('administrative_area_level_1', 'political',), |
|
239 | 239 | ), |
240 | - array ( 'long_name' => 'United States', 'short_name' => 'US', 'types' => array ( 'country', 'political', ), ), |
|
240 | + array('long_name' => 'United States', 'short_name' => 'US', 'types' => array('country', 'political',),), |
|
241 | 241 | ), |
242 | 242 | 'formatted_address' => 'Washington, DC, USA', |
243 | 243 | 'geometry' => |
244 | - array ( |
|
245 | - 'bounds' => array ( 'northeast' => array ( 'lat' => 38.9955479999999994333848007954657077789306640625, 'lng' => -76.909392999999994344761944375932216644287109375, ), 'southwest' => array ( 'lat' => 38.8031495000000035133780329488217830657958984375, 'lng' => -77.1197399999999930741978459991514682769775390625, ), ), |
|
246 | - 'location' => array ( 'lat' => 38.90719229999999839719748706556856632232666015625, 'lng' => -77.0368706999999943718648864887654781341552734375,), |
|
244 | + array( |
|
245 | + 'bounds' => array('northeast' => array('lat' => 38.9955479999999994333848007954657077789306640625, 'lng' => -76.909392999999994344761944375932216644287109375,), 'southwest' => array('lat' => 38.8031495000000035133780329488217830657958984375, 'lng' => -77.1197399999999930741978459991514682769775390625,),), |
|
246 | + 'location' => array('lat' => 38.90719229999999839719748706556856632232666015625, 'lng' => -77.0368706999999943718648864887654781341552734375,), |
|
247 | 247 | 'location_type' => 'APPROXIMATE', |
248 | - 'viewport' => array ( 'northeast' => array ( 'lat' => 38.9955479999999994333848007954657077789306640625, 'lng' => -76.909392999999994344761944375932216644287109375,), 'southwest' => array ( 'lat' => 38.8031495000000035133780329488217830657958984375, 'lng' => -77.1197399999999930741978459991514682769775390625,), ), |
|
248 | + 'viewport' => array('northeast' => array('lat' => 38.9955479999999994333848007954657077789306640625, 'lng' => -76.909392999999994344761944375932216644287109375,), 'southwest' => array('lat' => 38.8031495000000035133780329488217830657958984375, 'lng' => -77.1197399999999930741978459991514682769775390625,),), |
|
249 | 249 | ), |
250 | 250 | 'place_id' => 'ChIJW-T2Wt7Gt4kRKl2I1CJFUsI', |
251 | - 'types' => array ('locality', 'political'), |
|
251 | + 'types' => array('locality', 'political'), |
|
252 | 252 | ), |
253 | 253 | ), |
254 | 254 | 'status' => 'OK', |
255 | 255 | ); |
256 | 256 | |
257 | - $actual = $jjwgMaps->getGoogleMapsGeocode("washington D.C",true); |
|
257 | + $actual = $jjwgMaps->getGoogleMapsGeocode("washington D.C", true); |
|
258 | 258 | |
259 | - $this->assertSame($expected['results']['geometry'],$actual['results']['geometry']); |
|
259 | + $this->assertSame($expected['results']['geometry'], $actual['results']['geometry']); |
|
260 | 260 | //$this->assertSame($expected,$actual); |
261 | 261 | |
262 | 262 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | |
270 | 270 | //test for Account Object type |
271 | 271 | $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
272 | - $result = $jjwgMaps->defineMapsAddress('Account',$address); |
|
272 | + $result = $jjwgMaps->defineMapsAddress('Account', $address); |
|
273 | 273 | //var_dump($result); |
274 | 274 | $this->assertEquals(array('address' => "addr 1, addr 2, addr 3, addr 4, addr 5"), $result); |
275 | 275 | |
@@ -277,41 +277,41 @@ discard block |
||
277 | 277 | |
278 | 278 | //test for Contact Object type |
279 | 279 | $address = array('id'=>1, 'primary_address_street'=>"addr 1", 'primary_address_city'=>"addr 2", 'primary_address_state'=>"addr 3", 'primary_address_postalcode'=>"addr 4", 'primary_address_country'=>"addr 5"); |
280 | - $result = $jjwgMaps->defineMapsAddress('Contact',$address); |
|
280 | + $result = $jjwgMaps->defineMapsAddress('Contact', $address); |
|
281 | 281 | $this->assertEquals(array('address' => "addr 1, addr 2, addr 3, addr 4, addr 5"), $result); |
282 | 282 | |
283 | 283 | |
284 | 284 | |
285 | 285 | //test for Leads Object type |
286 | 286 | $address = array('id'=>1, 'primary_address_street'=>"addr 1", 'primary_address_city'=>"addr 2", 'primary_address_state'=>"addr 3", 'primary_address_postalcode'=>"addr 4", 'primary_address_country'=>"addr 5"); |
287 | - $result = $jjwgMaps->defineMapsAddress('Lead',$address); |
|
287 | + $result = $jjwgMaps->defineMapsAddress('Lead', $address); |
|
288 | 288 | $this->assertEquals(array('address' => "addr 1, addr 2, addr 3, addr 4, addr 5"), $result); |
289 | 289 | |
290 | 290 | |
291 | 291 | |
292 | 292 | //test for Opportunities Object type |
293 | 293 | $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
294 | - $result = $jjwgMaps->defineMapsAddress('Opportunity',$address); |
|
294 | + $result = $jjwgMaps->defineMapsAddress('Opportunity', $address); |
|
295 | 295 | $this->assertEquals(false, $result); |
296 | 296 | |
297 | 297 | |
298 | 298 | |
299 | 299 | //test for Case Object type |
300 | 300 | $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
301 | - $result = $jjwgMaps->defineMapsAddress('Case',$address); |
|
301 | + $result = $jjwgMaps->defineMapsAddress('Case', $address); |
|
302 | 302 | $this->assertEquals(false, $result); |
303 | 303 | |
304 | 304 | |
305 | 305 | //test for Project Object type |
306 | 306 | $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
307 | - $result = $jjwgMaps->defineMapsAddress('Project',$address); |
|
307 | + $result = $jjwgMaps->defineMapsAddress('Project', $address); |
|
308 | 308 | $this->assertEquals(false, $result); |
309 | 309 | |
310 | 310 | |
311 | 311 | |
312 | 312 | //test for Project Meetings type |
313 | 313 | $address = array('id'=>1, 'billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
314 | - $result = $jjwgMaps->defineMapsAddress('Meeting',$address); |
|
314 | + $result = $jjwgMaps->defineMapsAddress('Meeting', $address); |
|
315 | 315 | $this->assertEquals(false, $result); |
316 | 316 | |
317 | 317 | } |
@@ -328,31 +328,31 @@ discard block |
||
328 | 328 | |
329 | 329 | //test for type billing |
330 | 330 | $address = array('billing_address_street'=>"addr 1", 'billing_address_city'=>"addr 2", 'billing_address_state'=>"addr 3", 'billing_address_postalcode'=>"addr 4", 'billing_address_country'=>"addr 5"); |
331 | - $result = $jjwgMaps->defineMapsFormattedAddress($address,'billing'); |
|
331 | + $result = $jjwgMaps->defineMapsFormattedAddress($address, 'billing'); |
|
332 | 332 | $this->assertEquals("addr 1, addr 2, addr 3, addr 4, addr 5", $result); |
333 | 333 | |
334 | 334 | |
335 | 335 | //test for type shipping |
336 | 336 | $address = array('shipping_address_street'=>"addr 1", 'shipping_address_city'=>"addr 2", 'shipping_address_state'=>"addr 3", 'shipping_address_postalcode'=>"addr 4", 'shipping_address_country'=>"addr 5"); |
337 | - $result = $jjwgMaps->defineMapsFormattedAddress($address,'shipping'); |
|
337 | + $result = $jjwgMaps->defineMapsFormattedAddress($address, 'shipping'); |
|
338 | 338 | $this->assertEquals("addr 1, addr 2, addr 3, addr 4, addr 5", $result); |
339 | 339 | |
340 | 340 | |
341 | 341 | //test for type primary |
342 | 342 | $address = array('primary_address_street'=>"addr 1", 'primary_address_city'=>"addr 2", 'primary_address_state'=>"addr 3", 'primary_address_postalcode'=>"addr 4", 'primary_address_country'=>"addr 5"); |
343 | - $result = $jjwgMaps->defineMapsFormattedAddress($address,'primary'); |
|
343 | + $result = $jjwgMaps->defineMapsFormattedAddress($address, 'primary'); |
|
344 | 344 | $this->assertEquals("addr 1, addr 2, addr 3, addr 4, addr 5", $result); |
345 | 345 | |
346 | 346 | |
347 | 347 | //test for type alt |
348 | 348 | $address = array('alt_address_street'=>"addr 1", 'alt_address_city'=>"addr 2", 'alt_address_state'=>"addr 3", 'alt_address_postalcode'=>"addr 4", 'alt_address_country'=>"addr 5"); |
349 | - $result = $jjwgMaps->defineMapsFormattedAddress($address,'alt'); |
|
349 | + $result = $jjwgMaps->defineMapsFormattedAddress($address, 'alt'); |
|
350 | 350 | $this->assertEquals("addr 1, addr 2, addr 3, addr 4, addr 5", $result); |
351 | 351 | |
352 | 352 | |
353 | 353 | //test for type address |
354 | 354 | $address = array('address_street'=>"addr 1", 'address_city'=>"addr 2", 'address_state'=>"addr 3", 'address_postalcode'=>"addr 4"); |
355 | - $result = $jjwgMaps->defineMapsFormattedAddress($address,'address'); |
|
355 | + $result = $jjwgMaps->defineMapsFormattedAddress($address, 'address'); |
|
356 | 356 | $this->assertEquals("addr 1, addr 2, addr 3, addr 4", $result); |
357 | 357 | |
358 | 358 | |
@@ -364,13 +364,13 @@ discard block |
||
364 | 364 | $jjwgMaps = new jjwg_Maps(); |
365 | 365 | |
366 | 366 | //test with invalid values |
367 | - $this->assertEquals(false, $jjwgMaps->is_valid_lng('') ); |
|
368 | - $this->assertEquals(false, $jjwgMaps->is_valid_lng(181) ); |
|
369 | - $this->assertEquals(false, $jjwgMaps->is_valid_lng(-181) ); |
|
367 | + $this->assertEquals(false, $jjwgMaps->is_valid_lng('')); |
|
368 | + $this->assertEquals(false, $jjwgMaps->is_valid_lng(181)); |
|
369 | + $this->assertEquals(false, $jjwgMaps->is_valid_lng(-181)); |
|
370 | 370 | |
371 | 371 | //test with valid values |
372 | - $this->assertEquals(true, $jjwgMaps->is_valid_lng(180) ); |
|
373 | - $this->assertEquals(true, $jjwgMaps->is_valid_lng(-180) ); |
|
372 | + $this->assertEquals(true, $jjwgMaps->is_valid_lng(180)); |
|
373 | + $this->assertEquals(true, $jjwgMaps->is_valid_lng(-180)); |
|
374 | 374 | |
375 | 375 | } |
376 | 376 | |
@@ -380,13 +380,13 @@ discard block |
||
380 | 380 | $jjwgMaps = new jjwg_Maps(); |
381 | 381 | |
382 | 382 | //test with invalid values |
383 | - $this->assertEquals(false, $jjwgMaps->is_valid_lat('') ); |
|
384 | - $this->assertEquals(false, $jjwgMaps->is_valid_lat(91) ); |
|
385 | - $this->assertEquals(false, $jjwgMaps->is_valid_lat(-91) ); |
|
383 | + $this->assertEquals(false, $jjwgMaps->is_valid_lat('')); |
|
384 | + $this->assertEquals(false, $jjwgMaps->is_valid_lat(91)); |
|
385 | + $this->assertEquals(false, $jjwgMaps->is_valid_lat(-91)); |
|
386 | 386 | |
387 | 387 | //test with valid values |
388 | - $this->assertEquals(true, $jjwgMaps->is_valid_lat(90) ); |
|
389 | - $this->assertEquals(true, $jjwgMaps->is_valid_lat(-90) ); |
|
388 | + $this->assertEquals(true, $jjwgMaps->is_valid_lat(90)); |
|
389 | + $this->assertEquals(true, $jjwgMaps->is_valid_lat(-90)); |
|
390 | 390 | |
391 | 391 | } |
392 | 392 |
@@ -34,8 +34,7 @@ discard block |
||
34 | 34 | try { |
35 | 35 | $jjwgMaps->configuration(); |
36 | 36 | $this->assertTrue(true); |
37 | - } |
|
38 | - catch (Exception $e) { |
|
37 | + } catch (Exception $e) { |
|
39 | 38 | $this->fail(); |
40 | 39 | } |
41 | 40 | |
@@ -403,8 +402,7 @@ discard block |
||
403 | 402 | try { |
404 | 403 | $jjwgMaps->logGeocodeInfo($bean); |
405 | 404 | $this->assertTrue(true); |
406 | - } |
|
407 | - catch (Exception $e) { |
|
405 | + } catch (Exception $e) { |
|
408 | 406 | $this->fail(); |
409 | 407 | } |
410 | 408 |
@@ -5,75 +5,75 @@ discard block |
||
5 | 5 | |
6 | 6 | public function testMergeRecord() { |
7 | 7 | |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $mergeRecord = new MergeRecord(); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $mergeRecord = new MergeRecord(); |
|
10 | 10 | |
11 | - $this->assertInstanceOf('MergeRecord',$mergeRecord); |
|
12 | - $this->assertInstanceOf('SugarBean',$mergeRecord); |
|
11 | + $this->assertInstanceOf('MergeRecord',$mergeRecord); |
|
12 | + $this->assertInstanceOf('SugarBean',$mergeRecord); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('MergeRecords', 'module_dir', $mergeRecord); |
|
15 | - $this->assertAttributeEquals('MergeRecord', 'object_name', $mergeRecord); |
|
14 | + $this->assertAttributeEquals('MergeRecords', 'module_dir', $mergeRecord); |
|
15 | + $this->assertAttributeEquals('MergeRecord', 'object_name', $mergeRecord); |
|
16 | 16 | |
17 | - $this->assertAttributeEquals(true, 'new_schema', $mergeRecord); |
|
18 | - $this->assertAttributeEquals(true, 'acl_display_only', $mergeRecord); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $mergeRecord); |
|
18 | + $this->assertAttributeEquals(true, 'acl_display_only', $mergeRecord); |
|
19 | 19 | |
20 | 20 | } |
21 | 21 | |
22 | 22 | public function testsave() { |
23 | 23 | |
24 | - $mergeRecord = new MergeRecord(); |
|
25 | - //$mergeRecord->save(); |
|
24 | + $mergeRecord = new MergeRecord(); |
|
25 | + //$mergeRecord->save(); |
|
26 | 26 | |
27 | - $this->markTestIncomplete('method has no implementation'); |
|
27 | + $this->markTestIncomplete('method has no implementation'); |
|
28 | 28 | |
29 | 29 | } |
30 | 30 | |
31 | 31 | public function testretrieve() { |
32 | 32 | |
33 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
34 | - global $db; |
|
35 | - unset ($db->database); |
|
36 | - $db->checkConnection(); |
|
33 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
34 | + global $db; |
|
35 | + unset ($db->database); |
|
36 | + $db->checkConnection(); |
|
37 | 37 | |
38 | - $mergeRecord = new MergeRecord(); |
|
38 | + $mergeRecord = new MergeRecord(); |
|
39 | 39 | |
40 | - //preset variables required |
|
41 | - $mergeRecord->merge_bean = "Users"; |
|
42 | - $_REQUEST['action'] = 'Step2'; |
|
40 | + //preset variables required |
|
41 | + $mergeRecord->merge_bean = "Users"; |
|
42 | + $_REQUEST['action'] = 'Step2'; |
|
43 | 43 | |
44 | 44 | |
45 | - $mergeRecord->retrieve("1"); |
|
45 | + $mergeRecord->retrieve("1"); |
|
46 | 46 | |
47 | - $this->assertTrue(isset($mergeRecord->merge_bean->id)); |
|
48 | - $this->assertEquals(1, $mergeRecord->merge_bean->id); |
|
47 | + $this->assertTrue(isset($mergeRecord->merge_bean->id)); |
|
48 | + $this->assertEquals(1, $mergeRecord->merge_bean->id); |
|
49 | 49 | |
50 | 50 | } |
51 | 51 | |
52 | 52 | public function testload_merge_bean() { |
53 | 53 | |
54 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
55 | - global $db; |
|
56 | - unset ($db->database); |
|
57 | - $db->checkConnection(); |
|
54 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
55 | + global $db; |
|
56 | + unset ($db->database); |
|
57 | + $db->checkConnection(); |
|
58 | 58 | |
59 | - $mergeRecord = new MergeRecord(); |
|
59 | + $mergeRecord = new MergeRecord(); |
|
60 | 60 | |
61 | - //test without merge_id |
|
62 | - $mergeRecord->load_merge_bean("Contacts"); |
|
61 | + //test without merge_id |
|
62 | + $mergeRecord->load_merge_bean("Contacts"); |
|
63 | 63 | |
64 | - $this->assertAttributeEquals('Contacts', 'merge_module', $mergeRecord); |
|
65 | - $this->assertAttributeEquals('Contact', 'merge_bean_class', $mergeRecord); |
|
66 | - $this->assertAttributeEquals('modules/Contacts/Contact.php', 'merge_bean_file_path', $mergeRecord); |
|
64 | + $this->assertAttributeEquals('Contacts', 'merge_module', $mergeRecord); |
|
65 | + $this->assertAttributeEquals('Contact', 'merge_bean_class', $mergeRecord); |
|
66 | + $this->assertAttributeEquals('modules/Contacts/Contact.php', 'merge_bean_file_path', $mergeRecord); |
|
67 | 67 | |
68 | 68 | |
69 | - //test with merge_id |
|
70 | - $mergeRecord->load_merge_bean("Users", false, 1); |
|
69 | + //test with merge_id |
|
70 | + $mergeRecord->load_merge_bean("Users", false, 1); |
|
71 | 71 | |
72 | - $this->assertAttributeEquals('Users', 'merge_module', $mergeRecord); |
|
73 | - $this->assertAttributeEquals('User', 'merge_bean_class', $mergeRecord); |
|
74 | - $this->assertAttributeEquals('modules/Users/User.php', 'merge_bean_file_path', $mergeRecord); |
|
72 | + $this->assertAttributeEquals('Users', 'merge_module', $mergeRecord); |
|
73 | + $this->assertAttributeEquals('User', 'merge_bean_class', $mergeRecord); |
|
74 | + $this->assertAttributeEquals('modules/Users/User.php', 'merge_bean_file_path', $mergeRecord); |
|
75 | 75 | |
76 | - $this->assertInstanceOf('User',$mergeRecord->merge_bean); |
|
76 | + $this->assertInstanceOf('User',$mergeRecord->merge_bean); |
|
77 | 77 | |
78 | 78 | |
79 | 79 | } |
@@ -81,279 +81,279 @@ discard block |
||
81 | 81 | |
82 | 82 | public function testload_merge_bean2() { |
83 | 83 | |
84 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
85 | - global $db; |
|
86 | - unset ($db->database); |
|
87 | - $db->checkConnection(); |
|
84 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
85 | + global $db; |
|
86 | + unset ($db->database); |
|
87 | + $db->checkConnection(); |
|
88 | 88 | |
89 | - $mergeRecord = new MergeRecord(); |
|
89 | + $mergeRecord = new MergeRecord(); |
|
90 | 90 | |
91 | - //test without merge_id |
|
92 | - $mergeRecord->load_merge_bean2("Contacts"); |
|
91 | + //test without merge_id |
|
92 | + $mergeRecord->load_merge_bean2("Contacts"); |
|
93 | 93 | |
94 | - $this->assertAttributeEquals('Contacts', 'merge_module2', $mergeRecord); |
|
95 | - $this->assertAttributeEquals('Contact', 'merge_bean_class2', $mergeRecord); |
|
96 | - $this->assertAttributeEquals('modules/Contacts/Contact.php', 'merge_bean_file_path2', $mergeRecord); |
|
94 | + $this->assertAttributeEquals('Contacts', 'merge_module2', $mergeRecord); |
|
95 | + $this->assertAttributeEquals('Contact', 'merge_bean_class2', $mergeRecord); |
|
96 | + $this->assertAttributeEquals('modules/Contacts/Contact.php', 'merge_bean_file_path2', $mergeRecord); |
|
97 | 97 | |
98 | 98 | |
99 | - //test with merge_id |
|
100 | - $mergeRecord->load_merge_bean2("Users", false, 1); |
|
99 | + //test with merge_id |
|
100 | + $mergeRecord->load_merge_bean2("Users", false, 1); |
|
101 | 101 | |
102 | - $this->assertAttributeEquals('Users', 'merge_module2', $mergeRecord); |
|
103 | - $this->assertAttributeEquals('User', 'merge_bean_class2', $mergeRecord); |
|
104 | - $this->assertAttributeEquals('modules/Users/User.php', 'merge_bean_file_path2', $mergeRecord); |
|
102 | + $this->assertAttributeEquals('Users', 'merge_module2', $mergeRecord); |
|
103 | + $this->assertAttributeEquals('User', 'merge_bean_class2', $mergeRecord); |
|
104 | + $this->assertAttributeEquals('modules/Users/User.php', 'merge_bean_file_path2', $mergeRecord); |
|
105 | 105 | |
106 | - $this->assertInstanceOf('User',$mergeRecord->merge_bean2); |
|
106 | + $this->assertInstanceOf('User',$mergeRecord->merge_bean2); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
110 | 110 | public function testfill_in_additional_list_fields() { |
111 | 111 | |
112 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
113 | - global $db; |
|
114 | - unset ($db->database); |
|
115 | - $db->checkConnection(); |
|
112 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
113 | + global $db; |
|
114 | + unset ($db->database); |
|
115 | + $db->checkConnection(); |
|
116 | 116 | |
117 | 117 | |
118 | - $mergeRecord = new MergeRecord(); |
|
118 | + $mergeRecord = new MergeRecord(); |
|
119 | 119 | |
120 | - $mergeRecord->load_merge_bean("Users", false, 1); |
|
120 | + $mergeRecord->load_merge_bean("Users", false, 1); |
|
121 | 121 | |
122 | - //execute the method and test if it works and does not throws an exception. |
|
123 | - try { |
|
124 | - $mergeRecord->fill_in_additional_list_fields(); |
|
125 | - $this->assertTrue(true); |
|
126 | - } |
|
127 | - catch (Exception $e) { |
|
128 | - $this->fail(); |
|
129 | - } |
|
122 | + //execute the method and test if it works and does not throws an exception. |
|
123 | + try { |
|
124 | + $mergeRecord->fill_in_additional_list_fields(); |
|
125 | + $this->assertTrue(true); |
|
126 | + } |
|
127 | + catch (Exception $e) { |
|
128 | + $this->fail(); |
|
129 | + } |
|
130 | 130 | |
131 | 131 | } |
132 | 132 | |
133 | 133 | public function testfill_in_additional_detail_fields() { |
134 | 134 | |
135 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
136 | - global $db; |
|
137 | - unset ($db->database); |
|
138 | - $db->checkConnection(); |
|
135 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
136 | + global $db; |
|
137 | + unset ($db->database); |
|
138 | + $db->checkConnection(); |
|
139 | 139 | |
140 | 140 | |
141 | - $mergeRecord = new MergeRecord(); |
|
141 | + $mergeRecord = new MergeRecord(); |
|
142 | 142 | |
143 | - $mergeRecord->load_merge_bean("Users", false, 1); |
|
143 | + $mergeRecord->load_merge_bean("Users", false, 1); |
|
144 | 144 | |
145 | - //execute the method and test if it works and does not throws an exception. |
|
146 | - try { |
|
147 | - $mergeRecord->fill_in_additional_detail_fields(); |
|
148 | - $this->assertTrue(true); |
|
149 | - } |
|
150 | - catch (Exception $e) { |
|
151 | - $this->fail(); |
|
152 | - } |
|
145 | + //execute the method and test if it works and does not throws an exception. |
|
146 | + try { |
|
147 | + $mergeRecord->fill_in_additional_detail_fields(); |
|
148 | + $this->assertTrue(true); |
|
149 | + } |
|
150 | + catch (Exception $e) { |
|
151 | + $this->fail(); |
|
152 | + } |
|
153 | 153 | |
154 | 154 | |
155 | 155 | } |
156 | 156 | |
157 | 157 | public function testget_summary_text() { |
158 | 158 | |
159 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
160 | - global $db; |
|
161 | - unset ($db->database); |
|
162 | - $db->checkConnection(); |
|
159 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
160 | + global $db; |
|
161 | + unset ($db->database); |
|
162 | + $db->checkConnection(); |
|
163 | 163 | |
164 | - $mergeRecord = new MergeRecord(); |
|
164 | + $mergeRecord = new MergeRecord(); |
|
165 | 165 | |
166 | - $mergeRecord->load_merge_bean("Users"); |
|
166 | + $mergeRecord->load_merge_bean("Users"); |
|
167 | 167 | |
168 | 168 | |
169 | - //test without setting name |
|
170 | - $this->assertEquals(Null,$mergeRecord->get_summary_text()); |
|
169 | + //test without setting name |
|
170 | + $this->assertEquals(Null,$mergeRecord->get_summary_text()); |
|
171 | 171 | |
172 | 172 | |
173 | - //test with name set |
|
174 | - $mergeRecord->merge_bean->name = "test"; |
|
175 | - $this->assertEquals('test',$mergeRecord->get_summary_text()); |
|
173 | + //test with name set |
|
174 | + $mergeRecord->merge_bean->name = "test"; |
|
175 | + $this->assertEquals('test',$mergeRecord->get_summary_text()); |
|
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | 179 | public function testget_list_view_data() { |
180 | 180 | |
181 | - $mergeRecord = new MergeRecord(); |
|
181 | + $mergeRecord = new MergeRecord(); |
|
182 | 182 | |
183 | - $mergeRecord->load_merge_bean("Users"); |
|
183 | + $mergeRecord->load_merge_bean("Users"); |
|
184 | 184 | |
185 | - $result = $mergeRecord->get_list_view_data(); |
|
185 | + $result = $mergeRecord->get_list_view_data(); |
|
186 | 186 | |
187 | - $this->assertTrue(is_array($result)); |
|
187 | + $this->assertTrue(is_array($result)); |
|
188 | 188 | |
189 | 189 | } |
190 | 190 | |
191 | 191 | public function testbuild_generic_where_clause() { |
192 | 192 | |
193 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
194 | - global $db; |
|
195 | - unset ($db->database); |
|
196 | - $db->checkConnection(); |
|
193 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
194 | + global $db; |
|
195 | + unset ($db->database); |
|
196 | + $db->checkConnection(); |
|
197 | 197 | |
198 | - $mergeRecord = new MergeRecord(); |
|
198 | + $mergeRecord = new MergeRecord(); |
|
199 | 199 | |
200 | - $mergeRecord->load_merge_bean("Contacts"); |
|
200 | + $mergeRecord->load_merge_bean("Contacts"); |
|
201 | 201 | |
202 | 202 | |
203 | - //test with string |
|
204 | - $expected = "contacts.last_name like 'test%' or contacts.first_name like 'test%' or accounts.name like 'test%' or contacts.assistant like 'test%' or ea.email_address like 'test%'"; |
|
205 | - $actual = $mergeRecord->build_generic_where_clause('test'); |
|
206 | - $this->assertSame($expected,$actual); |
|
203 | + //test with string |
|
204 | + $expected = "contacts.last_name like 'test%' or contacts.first_name like 'test%' or accounts.name like 'test%' or contacts.assistant like 'test%' or ea.email_address like 'test%'"; |
|
205 | + $actual = $mergeRecord->build_generic_where_clause('test'); |
|
206 | + $this->assertSame($expected,$actual); |
|
207 | 207 | |
208 | 208 | |
209 | - //test with number |
|
210 | - $expected = "contacts.last_name like '1%' or contacts.first_name like '1%' or accounts.name like '1%' or contacts.assistant like '1%' or ea.email_address like '1%' or contacts.phone_home like '%1%' or contacts.phone_mobile like '%1%' or contacts.phone_work like '%1%' or contacts.phone_other like '%1%' or contacts.phone_fax like '%1%' or contacts.assistant_phone like '%1%'"; |
|
211 | - $actual = $mergeRecord->build_generic_where_clause(1); |
|
212 | - $this->assertSame($expected,$actual); |
|
209 | + //test with number |
|
210 | + $expected = "contacts.last_name like '1%' or contacts.first_name like '1%' or accounts.name like '1%' or contacts.assistant like '1%' or ea.email_address like '1%' or contacts.phone_home like '%1%' or contacts.phone_mobile like '%1%' or contacts.phone_work like '%1%' or contacts.phone_other like '%1%' or contacts.phone_fax like '%1%' or contacts.assistant_phone like '%1%'"; |
|
211 | + $actual = $mergeRecord->build_generic_where_clause(1); |
|
212 | + $this->assertSame($expected,$actual); |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | |
216 | 216 | |
217 | 217 | public function testbean_implements() { |
218 | 218 | |
219 | - $mergeRecord = new MergeRecord(); |
|
219 | + $mergeRecord = new MergeRecord(); |
|
220 | 220 | |
221 | - $this->assertEquals(false, $mergeRecord->bean_implements('')); //test with blank value |
|
222 | - $this->assertEquals(false, $mergeRecord->bean_implements('test')); //test with invalid value |
|
223 | - $this->assertEquals(true, $mergeRecord->bean_implements('ACL')); //test with valid value |
|
221 | + $this->assertEquals(false, $mergeRecord->bean_implements('')); //test with blank value |
|
222 | + $this->assertEquals(false, $mergeRecord->bean_implements('test')); //test with invalid value |
|
223 | + $this->assertEquals(true, $mergeRecord->bean_implements('ACL')); //test with valid value |
|
224 | 224 | |
225 | 225 | } |
226 | 226 | |
227 | 227 | public function testACLAccess(){ |
228 | 228 | |
229 | - $mergeRecord = new MergeRecord(); |
|
229 | + $mergeRecord = new MergeRecord(); |
|
230 | 230 | |
231 | - //test without loading merge bean |
|
232 | - $this->assertEquals(true, $mergeRecord->ACLAccess('')); //test with valid value |
|
231 | + //test without loading merge bean |
|
232 | + $this->assertEquals(true, $mergeRecord->ACLAccess('')); //test with valid value |
|
233 | 233 | |
234 | 234 | |
235 | - //test with merge bean loaded |
|
236 | - $mergeRecord->load_merge_bean("Meetings"); |
|
235 | + //test with merge bean loaded |
|
236 | + $mergeRecord->load_merge_bean("Meetings"); |
|
237 | 237 | |
238 | - $this->assertEquals(true,$mergeRecord->ACLAccess('edit')); |
|
239 | - $this->assertEquals(true,$mergeRecord->ACLAccess('save')); |
|
240 | - $this->assertEquals(true,$mergeRecord->ACLAccess('editview')); |
|
241 | - $this->assertEquals(true,$mergeRecord->ACLAccess('delete')); |
|
238 | + $this->assertEquals(true,$mergeRecord->ACLAccess('edit')); |
|
239 | + $this->assertEquals(true,$mergeRecord->ACLAccess('save')); |
|
240 | + $this->assertEquals(true,$mergeRecord->ACLAccess('editview')); |
|
241 | + $this->assertEquals(true,$mergeRecord->ACLAccess('delete')); |
|
242 | 242 | |
243 | 243 | } |
244 | 244 | |
245 | 245 | public function testpopulate_search_params() { |
246 | 246 | |
247 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
248 | - global $db; |
|
249 | - unset ($db->database); |
|
250 | - $db->checkConnection(); |
|
247 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
248 | + global $db; |
|
249 | + unset ($db->database); |
|
250 | + $db->checkConnection(); |
|
251 | 251 | |
252 | 252 | |
253 | - $mergeRecord = new MergeRecord(); |
|
253 | + $mergeRecord = new MergeRecord(); |
|
254 | 254 | |
255 | - $mergeRecord->load_merge_bean("Meetings"); |
|
255 | + $mergeRecord->load_merge_bean("Meetings"); |
|
256 | 256 | |
257 | - $expected = array ( |
|
258 | - 'id' => array ( 'name' => 'id', 'vname' => 'LBL_ID', 'type' => 'id', 'required' => true, 'reportable' => true, 'comment' => 'Unique identifier', 'inline_edit' => false, 'value' => '1', 'search_type' => 'Exact'), |
|
259 | - 'name' => array ( 'name' => 'name','vname' => 'LBL_SUBJECT','required' => true, 'type' => 'name', 'dbType' => 'varchar', 'unified_search' => true, 'full_text_search' => array ('boost' => 3), 'len' => '50','comment' => 'Meeting name', 'importable' => 'required', 'value' => 'test', 'search_type' => 'Exact' ) |
|
260 | - ); |
|
257 | + $expected = array ( |
|
258 | + 'id' => array ( 'name' => 'id', 'vname' => 'LBL_ID', 'type' => 'id', 'required' => true, 'reportable' => true, 'comment' => 'Unique identifier', 'inline_edit' => false, 'value' => '1', 'search_type' => 'Exact'), |
|
259 | + 'name' => array ( 'name' => 'name','vname' => 'LBL_SUBJECT','required' => true, 'type' => 'name', 'dbType' => 'varchar', 'unified_search' => true, 'full_text_search' => array ('boost' => 3), 'len' => '50','comment' => 'Meeting name', 'importable' => 'required', 'value' => 'test', 'search_type' => 'Exact' ) |
|
260 | + ); |
|
261 | 261 | |
262 | - $mergeRecord->populate_search_params(array('nameSearchField'=>'test','idSearchField'=>'1')); |
|
262 | + $mergeRecord->populate_search_params(array('nameSearchField'=>'test','idSearchField'=>'1')); |
|
263 | 263 | |
264 | - $this->assertSame($expected, $mergeRecord->field_search_params); |
|
264 | + $this->assertSame($expected, $mergeRecord->field_search_params); |
|
265 | 265 | |
266 | 266 | } |
267 | 267 | |
268 | 268 | public function testget_inputs_for_search_params() |
269 | 269 | { |
270 | 270 | |
271 | - error_reporting(E_ERROR | E_PARSE); |
|
271 | + error_reporting(E_ERROR | E_PARSE); |
|
272 | 272 | |
273 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
274 | - global $db; |
|
275 | - unset ($db->database); |
|
276 | - $db->checkConnection(); |
|
273 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
274 | + global $db; |
|
275 | + unset ($db->database); |
|
276 | + $db->checkConnection(); |
|
277 | 277 | |
278 | 278 | |
279 | - $mergeRecord = new MergeRecord(); |
|
279 | + $mergeRecord = new MergeRecord(); |
|
280 | 280 | |
281 | - $mergeRecord->load_merge_bean("Meetings"); |
|
281 | + $mergeRecord->load_merge_bean("Meetings"); |
|
282 | 282 | |
283 | - $expected = "<input type='hidden' name='idSearchField' value='1' />\n<input type='hidden' name='idSearchType' value='' />\n<input type='hidden' name='nameSearchField' value='test' />\n<input type='hidden' name='nameSearchType' value='' />\n"; |
|
283 | + $expected = "<input type='hidden' name='idSearchField' value='1' />\n<input type='hidden' name='idSearchType' value='' />\n<input type='hidden' name='nameSearchField' value='test' />\n<input type='hidden' name='nameSearchType' value='' />\n"; |
|
284 | 284 | |
285 | - $result = $mergeRecord->get_inputs_for_search_params(array('nameSearchField'=>'test','idSearchField'=>'1')); |
|
285 | + $result = $mergeRecord->get_inputs_for_search_params(array('nameSearchField'=>'test','idSearchField'=>'1')); |
|
286 | 286 | |
287 | - $this->assertSame($expected, $result); |
|
287 | + $this->assertSame($expected, $result); |
|
288 | 288 | |
289 | 289 | } |
290 | 290 | |
291 | 291 | public function testemail_addresses_query() { |
292 | 292 | |
293 | - $mergeRecord = new MergeRecord(); |
|
293 | + $mergeRecord = new MergeRecord(); |
|
294 | 294 | |
295 | - $expected = "accounts.id IN (SELECT ear.bean_id FROM email_addresses ea\n LEFT JOIN email_addr_bean_rel ear ON ea.id = ear.email_address_id \n WHERE ear.bean_module = 'Accounts'\n AND ear.bean_id != '1' \n AND ear.deleted = 0"; |
|
295 | + $expected = "accounts.id IN (SELECT ear.bean_id FROM email_addresses ea\n LEFT JOIN email_addr_bean_rel ear ON ea.id = ear.email_address_id \n WHERE ear.bean_module = 'Accounts'\n AND ear.bean_id != '1' \n AND ear.deleted = 0"; |
|
296 | 296 | |
297 | - $result = $mergeRecord->email_addresses_query("accounts", "Accounts", 1); |
|
297 | + $result = $mergeRecord->email_addresses_query("accounts", "Accounts", 1); |
|
298 | 298 | |
299 | - $this->assertSame($expected, $result); |
|
299 | + $this->assertSame($expected, $result); |
|
300 | 300 | |
301 | 301 | } |
302 | 302 | |
303 | 303 | public function testrelease_name_query() { |
304 | 304 | |
305 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
306 | - global $db; |
|
307 | - unset ($db->database); |
|
308 | - $db->checkConnection(); |
|
305 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
306 | + global $db; |
|
307 | + unset ($db->database); |
|
308 | + $db->checkConnection(); |
|
309 | 309 | |
310 | - $mergeRecord = new MergeRecord(); |
|
310 | + $mergeRecord = new MergeRecord(); |
|
311 | 311 | |
312 | - //test with type = like |
|
313 | - $result = $mergeRecord->release_name_query("like", "test"); |
|
314 | - $this->assertSame(null, $result); |
|
312 | + //test with type = like |
|
313 | + $result = $mergeRecord->release_name_query("like", "test"); |
|
314 | + $this->assertSame(null, $result); |
|
315 | 315 | |
316 | - //test with type = start |
|
317 | - $result = $mergeRecord->release_name_query("start", "test"); |
|
318 | - $this->assertSame(null, $result); |
|
316 | + //test with type = start |
|
317 | + $result = $mergeRecord->release_name_query("start", "test"); |
|
318 | + $this->assertSame(null, $result); |
|
319 | 319 | |
320 | 320 | |
321 | 321 | } |
322 | 322 | |
323 | 323 | public function testcreate_where_statement() { |
324 | 324 | |
325 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
326 | - global $db; |
|
327 | - unset ($db->database); |
|
328 | - $db->checkConnection(); |
|
325 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
326 | + global $db; |
|
327 | + unset ($db->database); |
|
328 | + $db->checkConnection(); |
|
329 | 329 | |
330 | - $mergeRecord = new MergeRecord(); |
|
330 | + $mergeRecord = new MergeRecord(); |
|
331 | 331 | |
332 | - $mergeRecord->load_merge_bean("Contacts"); |
|
333 | - $mergeRecord->populate_search_params(array('nameSearchField'=>'test','idSearchField'=>'1')); |
|
332 | + $mergeRecord->load_merge_bean("Contacts"); |
|
333 | + $mergeRecord->populate_search_params(array('nameSearchField'=>'test','idSearchField'=>'1')); |
|
334 | 334 | |
335 | - $expected = array( "contacts.id='1'", "contacts.name='test'", "contacts.id !=''" ); |
|
335 | + $expected = array( "contacts.id='1'", "contacts.name='test'", "contacts.id !=''" ); |
|
336 | 336 | |
337 | - $actual = $mergeRecord->create_where_statement(); |
|
337 | + $actual = $mergeRecord->create_where_statement(); |
|
338 | 338 | |
339 | - $this->assertSame( $expected, $actual); |
|
339 | + $this->assertSame( $expected, $actual); |
|
340 | 340 | |
341 | 341 | } |
342 | 342 | |
343 | 343 | |
344 | 344 | public function testgenerate_where_statement() { |
345 | 345 | |
346 | - $mergeRecord = new MergeRecord(); |
|
346 | + $mergeRecord = new MergeRecord(); |
|
347 | 347 | |
348 | - $clauses = array( "contacts.id='1'", "contacts.name='test'", "contacts.id !=''" ); |
|
349 | - $expected = "contacts.id='1' AND contacts.name='test' AND contacts.id !=''"; |
|
348 | + $clauses = array( "contacts.id='1'", "contacts.name='test'", "contacts.id !=''" ); |
|
349 | + $expected = "contacts.id='1' AND contacts.name='test' AND contacts.id !=''"; |
|
350 | 350 | |
351 | - $actual = $mergeRecord->generate_where_statement($clauses); |
|
351 | + $actual = $mergeRecord->generate_where_statement($clauses); |
|
352 | 352 | |
353 | - $this->assertSame( $expected, $actual); |
|
353 | + $this->assertSame( $expected, $actual); |
|
354 | 354 | |
355 | - //error_reporting(E_ALL); |
|
356 | - } |
|
355 | + //error_reporting(E_ALL); |
|
356 | + } |
|
357 | 357 | |
358 | 358 | } |
359 | 359 | ?> |
360 | 360 | \ No newline at end of file |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | //execute the contructor and check for the Object type and attributes |
9 | 9 | $mergeRecord = new MergeRecord(); |
10 | 10 | |
11 | - $this->assertInstanceOf('MergeRecord',$mergeRecord); |
|
12 | - $this->assertInstanceOf('SugarBean',$mergeRecord); |
|
11 | + $this->assertInstanceOf('MergeRecord', $mergeRecord); |
|
12 | + $this->assertInstanceOf('SugarBean', $mergeRecord); |
|
13 | 13 | |
14 | 14 | $this->assertAttributeEquals('MergeRecords', 'module_dir', $mergeRecord); |
15 | 15 | $this->assertAttributeEquals('MergeRecord', 'object_name', $mergeRecord); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $this->assertAttributeEquals('User', 'merge_bean_class', $mergeRecord); |
74 | 74 | $this->assertAttributeEquals('modules/Users/User.php', 'merge_bean_file_path', $mergeRecord); |
75 | 75 | |
76 | - $this->assertInstanceOf('User',$mergeRecord->merge_bean); |
|
76 | + $this->assertInstanceOf('User', $mergeRecord->merge_bean); |
|
77 | 77 | |
78 | 78 | |
79 | 79 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $this->assertAttributeEquals('User', 'merge_bean_class2', $mergeRecord); |
104 | 104 | $this->assertAttributeEquals('modules/Users/User.php', 'merge_bean_file_path2', $mergeRecord); |
105 | 105 | |
106 | - $this->assertInstanceOf('User',$mergeRecord->merge_bean2); |
|
106 | + $this->assertInstanceOf('User', $mergeRecord->merge_bean2); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -167,12 +167,12 @@ discard block |
||
167 | 167 | |
168 | 168 | |
169 | 169 | //test without setting name |
170 | - $this->assertEquals(Null,$mergeRecord->get_summary_text()); |
|
170 | + $this->assertEquals(Null, $mergeRecord->get_summary_text()); |
|
171 | 171 | |
172 | 172 | |
173 | 173 | //test with name set |
174 | 174 | $mergeRecord->merge_bean->name = "test"; |
175 | - $this->assertEquals('test',$mergeRecord->get_summary_text()); |
|
175 | + $this->assertEquals('test', $mergeRecord->get_summary_text()); |
|
176 | 176 | |
177 | 177 | } |
178 | 178 | |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | //test with string |
204 | 204 | $expected = "contacts.last_name like 'test%' or contacts.first_name like 'test%' or accounts.name like 'test%' or contacts.assistant like 'test%' or ea.email_address like 'test%'"; |
205 | 205 | $actual = $mergeRecord->build_generic_where_clause('test'); |
206 | - $this->assertSame($expected,$actual); |
|
206 | + $this->assertSame($expected, $actual); |
|
207 | 207 | |
208 | 208 | |
209 | 209 | //test with number |
210 | 210 | $expected = "contacts.last_name like '1%' or contacts.first_name like '1%' or accounts.name like '1%' or contacts.assistant like '1%' or ea.email_address like '1%' or contacts.phone_home like '%1%' or contacts.phone_mobile like '%1%' or contacts.phone_work like '%1%' or contacts.phone_other like '%1%' or contacts.phone_fax like '%1%' or contacts.assistant_phone like '%1%'"; |
211 | 211 | $actual = $mergeRecord->build_generic_where_clause(1); |
212 | - $this->assertSame($expected,$actual); |
|
212 | + $this->assertSame($expected, $actual); |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | } |
226 | 226 | |
227 | - public function testACLAccess(){ |
|
227 | + public function testACLAccess() { |
|
228 | 228 | |
229 | 229 | $mergeRecord = new MergeRecord(); |
230 | 230 | |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | //test with merge bean loaded |
236 | 236 | $mergeRecord->load_merge_bean("Meetings"); |
237 | 237 | |
238 | - $this->assertEquals(true,$mergeRecord->ACLAccess('edit')); |
|
239 | - $this->assertEquals(true,$mergeRecord->ACLAccess('save')); |
|
240 | - $this->assertEquals(true,$mergeRecord->ACLAccess('editview')); |
|
241 | - $this->assertEquals(true,$mergeRecord->ACLAccess('delete')); |
|
238 | + $this->assertEquals(true, $mergeRecord->ACLAccess('edit')); |
|
239 | + $this->assertEquals(true, $mergeRecord->ACLAccess('save')); |
|
240 | + $this->assertEquals(true, $mergeRecord->ACLAccess('editview')); |
|
241 | + $this->assertEquals(true, $mergeRecord->ACLAccess('delete')); |
|
242 | 242 | |
243 | 243 | } |
244 | 244 | |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | |
255 | 255 | $mergeRecord->load_merge_bean("Meetings"); |
256 | 256 | |
257 | - $expected = array ( |
|
258 | - 'id' => array ( 'name' => 'id', 'vname' => 'LBL_ID', 'type' => 'id', 'required' => true, 'reportable' => true, 'comment' => 'Unique identifier', 'inline_edit' => false, 'value' => '1', 'search_type' => 'Exact'), |
|
259 | - 'name' => array ( 'name' => 'name','vname' => 'LBL_SUBJECT','required' => true, 'type' => 'name', 'dbType' => 'varchar', 'unified_search' => true, 'full_text_search' => array ('boost' => 3), 'len' => '50','comment' => 'Meeting name', 'importable' => 'required', 'value' => 'test', 'search_type' => 'Exact' ) |
|
257 | + $expected = array( |
|
258 | + 'id' => array('name' => 'id', 'vname' => 'LBL_ID', 'type' => 'id', 'required' => true, 'reportable' => true, 'comment' => 'Unique identifier', 'inline_edit' => false, 'value' => '1', 'search_type' => 'Exact'), |
|
259 | + 'name' => array('name' => 'name', 'vname' => 'LBL_SUBJECT', 'required' => true, 'type' => 'name', 'dbType' => 'varchar', 'unified_search' => true, 'full_text_search' => array('boost' => 3), 'len' => '50', 'comment' => 'Meeting name', 'importable' => 'required', 'value' => 'test', 'search_type' => 'Exact') |
|
260 | 260 | ); |
261 | 261 | |
262 | - $mergeRecord->populate_search_params(array('nameSearchField'=>'test','idSearchField'=>'1')); |
|
262 | + $mergeRecord->populate_search_params(array('nameSearchField'=>'test', 'idSearchField'=>'1')); |
|
263 | 263 | |
264 | 264 | $this->assertSame($expected, $mergeRecord->field_search_params); |
265 | 265 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | $expected = "<input type='hidden' name='idSearchField' value='1' />\n<input type='hidden' name='idSearchType' value='' />\n<input type='hidden' name='nameSearchField' value='test' />\n<input type='hidden' name='nameSearchType' value='' />\n"; |
284 | 284 | |
285 | - $result = $mergeRecord->get_inputs_for_search_params(array('nameSearchField'=>'test','idSearchField'=>'1')); |
|
285 | + $result = $mergeRecord->get_inputs_for_search_params(array('nameSearchField'=>'test', 'idSearchField'=>'1')); |
|
286 | 286 | |
287 | 287 | $this->assertSame($expected, $result); |
288 | 288 | |
@@ -330,13 +330,13 @@ discard block |
||
330 | 330 | $mergeRecord = new MergeRecord(); |
331 | 331 | |
332 | 332 | $mergeRecord->load_merge_bean("Contacts"); |
333 | - $mergeRecord->populate_search_params(array('nameSearchField'=>'test','idSearchField'=>'1')); |
|
333 | + $mergeRecord->populate_search_params(array('nameSearchField'=>'test', 'idSearchField'=>'1')); |
|
334 | 334 | |
335 | - $expected = array( "contacts.id='1'", "contacts.name='test'", "contacts.id !=''" ); |
|
335 | + $expected = array("contacts.id='1'", "contacts.name='test'", "contacts.id !=''"); |
|
336 | 336 | |
337 | 337 | $actual = $mergeRecord->create_where_statement(); |
338 | 338 | |
339 | - $this->assertSame( $expected, $actual); |
|
339 | + $this->assertSame($expected, $actual); |
|
340 | 340 | |
341 | 341 | } |
342 | 342 | |
@@ -345,12 +345,12 @@ discard block |
||
345 | 345 | |
346 | 346 | $mergeRecord = new MergeRecord(); |
347 | 347 | |
348 | - $clauses = array( "contacts.id='1'", "contacts.name='test'", "contacts.id !=''" ); |
|
348 | + $clauses = array("contacts.id='1'", "contacts.name='test'", "contacts.id !=''"); |
|
349 | 349 | $expected = "contacts.id='1' AND contacts.name='test' AND contacts.id !=''"; |
350 | 350 | |
351 | 351 | $actual = $mergeRecord->generate_where_statement($clauses); |
352 | 352 | |
353 | - $this->assertSame( $expected, $actual); |
|
353 | + $this->assertSame($expected, $actual); |
|
354 | 354 | |
355 | 355 | //error_reporting(E_ALL); |
356 | 356 | } |
@@ -123,8 +123,7 @@ discard block |
||
123 | 123 | try { |
124 | 124 | $mergeRecord->fill_in_additional_list_fields(); |
125 | 125 | $this->assertTrue(true); |
126 | - } |
|
127 | - catch (Exception $e) { |
|
126 | + } catch (Exception $e) { |
|
128 | 127 | $this->fail(); |
129 | 128 | } |
130 | 129 | |
@@ -146,8 +145,7 @@ discard block |
||
146 | 145 | try { |
147 | 146 | $mergeRecord->fill_in_additional_detail_fields(); |
148 | 147 | $this->assertTrue(true); |
149 | - } |
|
150 | - catch (Exception $e) { |
|
148 | + } catch (Exception $e) { |
|
151 | 149 | $this->fail(); |
152 | 150 | } |
153 | 151 |
@@ -6,33 +6,33 @@ discard block |
||
6 | 6 | |
7 | 7 | public function testjjwg_Address_Cache() { |
8 | 8 | |
9 | - error_reporting(E_ERROR | E_PARSE); |
|
9 | + error_reporting(E_ERROR | E_PARSE); |
|
10 | 10 | |
11 | - //execute the contructor and check for the Object type and attributes |
|
12 | - $jjwgAddressCache = new jjwg_Address_Cache(); |
|
13 | - $this->assertInstanceOf('jjwg_Address_Cache',$jjwgAddressCache); |
|
14 | - $this->assertInstanceOf('Basic',$jjwgAddressCache); |
|
15 | - $this->assertInstanceOf('SugarBean',$jjwgAddressCache); |
|
11 | + //execute the contructor and check for the Object type and attributes |
|
12 | + $jjwgAddressCache = new jjwg_Address_Cache(); |
|
13 | + $this->assertInstanceOf('jjwg_Address_Cache',$jjwgAddressCache); |
|
14 | + $this->assertInstanceOf('Basic',$jjwgAddressCache); |
|
15 | + $this->assertInstanceOf('SugarBean',$jjwgAddressCache); |
|
16 | 16 | |
17 | - $this->assertAttributeEquals('jjwg_Address_Cache', 'module_dir', $jjwgAddressCache); |
|
18 | - $this->assertAttributeEquals('jjwg_Address_Cache', 'object_name', $jjwgAddressCache); |
|
19 | - $this->assertAttributeEquals('jjwg_address_cache', 'table_name', $jjwgAddressCache); |
|
17 | + $this->assertAttributeEquals('jjwg_Address_Cache', 'module_dir', $jjwgAddressCache); |
|
18 | + $this->assertAttributeEquals('jjwg_Address_Cache', 'object_name', $jjwgAddressCache); |
|
19 | + $this->assertAttributeEquals('jjwg_address_cache', 'table_name', $jjwgAddressCache); |
|
20 | 20 | |
21 | - $this->assertAttributeEquals(true, 'new_schema', $jjwgAddressCache); |
|
22 | - $this->assertAttributeEquals(true, 'importable', $jjwgAddressCache); |
|
23 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $jjwgAddressCache); |
|
21 | + $this->assertAttributeEquals(true, 'new_schema', $jjwgAddressCache); |
|
22 | + $this->assertAttributeEquals(true, 'importable', $jjwgAddressCache); |
|
23 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $jjwgAddressCache); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
27 | 27 | |
28 | 28 | public function testconfiguration() { |
29 | 29 | |
30 | - $jjwgAddressCache = new jjwg_Address_Cache(); |
|
31 | - $jjwgAddressCache->configuration(); |
|
30 | + $jjwgAddressCache = new jjwg_Address_Cache(); |
|
31 | + $jjwgAddressCache->configuration(); |
|
32 | 32 | |
33 | - $this->assertInstanceOf('jjwg_Maps',$jjwgAddressCache->jjwg_Maps); |
|
34 | - $this->assertTrue(is_array($jjwgAddressCache->settings)); |
|
35 | - $this->assertGreaterThan(0,count($jjwgAddressCache->settings)); |
|
33 | + $this->assertInstanceOf('jjwg_Maps',$jjwgAddressCache->jjwg_Maps); |
|
34 | + $this->assertTrue(is_array($jjwgAddressCache->settings)); |
|
35 | + $this->assertGreaterThan(0,count($jjwgAddressCache->settings)); |
|
36 | 36 | |
37 | 37 | } |
38 | 38 | |
@@ -40,71 +40,71 @@ discard block |
||
40 | 40 | |
41 | 41 | public function testSaveAndGetAddressCacheInfoAndDeleteAllAddressCache() { |
42 | 42 | |
43 | - $jjwgAddressCache = new jjwg_Address_Cache(); |
|
43 | + $jjwgAddressCache = new jjwg_Address_Cache(); |
|
44 | 44 | |
45 | 45 | |
46 | - //test saveAddressCacheInfo() with empty info array |
|
47 | - $ainfo = array(); |
|
48 | - $result = $jjwgAddressCache->saveAddressCacheInfo($ainfo); |
|
49 | - $this->assertEquals(false, $result); |
|
46 | + //test saveAddressCacheInfo() with empty info array |
|
47 | + $ainfo = array(); |
|
48 | + $result = $jjwgAddressCache->saveAddressCacheInfo($ainfo); |
|
49 | + $this->assertEquals(false, $result); |
|
50 | 50 | |
51 | 51 | |
52 | - //test saveAddressCacheInfo() with a valid info array |
|
53 | - $jjwgAddressCache->settings['address_cache_save_enabled'] = 1; |
|
54 | - $ainfo = array( "address"=>"test", "lat"=>"24.861462", "lng"=>"67.009939", "description"=>"test description" ); |
|
55 | - $result = $jjwgAddressCache->saveAddressCacheInfo($ainfo); |
|
56 | - $this->assertEquals(true, $result); |
|
52 | + //test saveAddressCacheInfo() with a valid info array |
|
53 | + $jjwgAddressCache->settings['address_cache_save_enabled'] = 1; |
|
54 | + $ainfo = array( "address"=>"test", "lat"=>"24.861462", "lng"=>"67.009939", "description"=>"test description" ); |
|
55 | + $result = $jjwgAddressCache->saveAddressCacheInfo($ainfo); |
|
56 | + $this->assertEquals(true, $result); |
|
57 | 57 | |
58 | 58 | |
59 | - //test getAddressCacheInfo() with empty info array |
|
60 | - $result = $jjwgAddressCache->getAddressCacheInfo(array()); |
|
61 | - $this->assertEquals(false, $result); |
|
59 | + //test getAddressCacheInfo() with empty info array |
|
60 | + $result = $jjwgAddressCache->getAddressCacheInfo(array()); |
|
61 | + $this->assertEquals(false, $result); |
|
62 | 62 | |
63 | 63 | |
64 | - //test getAddressCacheInfo() with a valid info array |
|
65 | - $jjwgAddressCache->settings['address_cache_get_enabled'] = 1; |
|
66 | - $ainfo = array( "address"=>"test", "lat"=>"24.861462", "lng"=>"67.009939", "description"=>"test description" ); |
|
67 | - $result = $jjwgAddressCache->getAddressCacheInfo($ainfo); |
|
68 | - $this->assertTrue(is_array($result)); |
|
64 | + //test getAddressCacheInfo() with a valid info array |
|
65 | + $jjwgAddressCache->settings['address_cache_get_enabled'] = 1; |
|
66 | + $ainfo = array( "address"=>"test", "lat"=>"24.861462", "lng"=>"67.009939", "description"=>"test description" ); |
|
67 | + $result = $jjwgAddressCache->getAddressCacheInfo($ainfo); |
|
68 | + $this->assertTrue(is_array($result)); |
|
69 | 69 | |
70 | 70 | |
71 | - //test deleteAllAddressCache |
|
72 | - $jjwgAddressCache->deleteAllAddressCache(); |
|
71 | + //test deleteAllAddressCache |
|
72 | + $jjwgAddressCache->deleteAllAddressCache(); |
|
73 | 73 | |
74 | 74 | |
75 | - //verify that record cannot be retrieved anynore |
|
76 | - $result = $jjwgAddressCache->getAddressCacheInfo($ainfo); |
|
77 | - $this->assertEquals(false, $result); |
|
75 | + //verify that record cannot be retrieved anynore |
|
76 | + $result = $jjwgAddressCache->getAddressCacheInfo($ainfo); |
|
77 | + $this->assertEquals(false, $result); |
|
78 | 78 | |
79 | 79 | } |
80 | 80 | |
81 | 81 | public function testis_valid_lng() { |
82 | 82 | |
83 | - $jjwgAddressCache = new jjwg_Address_Cache(); |
|
83 | + $jjwgAddressCache = new jjwg_Address_Cache(); |
|
84 | 84 | |
85 | - //test with invalid values |
|
86 | - $this->assertEquals(false, $jjwgAddressCache->is_valid_lng('') ); |
|
87 | - $this->assertEquals(false, $jjwgAddressCache->is_valid_lng(181) ); |
|
88 | - $this->assertEquals(false, $jjwgAddressCache->is_valid_lng(-181) ); |
|
85 | + //test with invalid values |
|
86 | + $this->assertEquals(false, $jjwgAddressCache->is_valid_lng('') ); |
|
87 | + $this->assertEquals(false, $jjwgAddressCache->is_valid_lng(181) ); |
|
88 | + $this->assertEquals(false, $jjwgAddressCache->is_valid_lng(-181) ); |
|
89 | 89 | |
90 | - //test with valid values |
|
91 | - $this->assertEquals(true, $jjwgAddressCache->is_valid_lng(180) ); |
|
92 | - $this->assertEquals(true, $jjwgAddressCache->is_valid_lng(-180) ); |
|
90 | + //test with valid values |
|
91 | + $this->assertEquals(true, $jjwgAddressCache->is_valid_lng(180) ); |
|
92 | + $this->assertEquals(true, $jjwgAddressCache->is_valid_lng(-180) ); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
96 | 96 | public function testis_valid_lat() { |
97 | 97 | |
98 | - $jjwgAddressCache = new jjwg_Address_Cache(); |
|
98 | + $jjwgAddressCache = new jjwg_Address_Cache(); |
|
99 | 99 | |
100 | - //test with invalid values |
|
101 | - $this->assertEquals(false, $jjwgAddressCache->is_valid_lat('') ); |
|
102 | - $this->assertEquals(false, $jjwgAddressCache->is_valid_lat(91) ); |
|
103 | - $this->assertEquals(false, $jjwgAddressCache->is_valid_lat(-91) ); |
|
104 | - |
|
105 | - //test with valid values |
|
106 | - $this->assertEquals(true, $jjwgAddressCache->is_valid_lat(90) ); |
|
107 | - $this->assertEquals(true, $jjwgAddressCache->is_valid_lat(-90) ); |
|
100 | + //test with invalid values |
|
101 | + $this->assertEquals(false, $jjwgAddressCache->is_valid_lat('') ); |
|
102 | + $this->assertEquals(false, $jjwgAddressCache->is_valid_lat(91) ); |
|
103 | + $this->assertEquals(false, $jjwgAddressCache->is_valid_lat(-91) ); |
|
104 | + |
|
105 | + //test with valid values |
|
106 | + $this->assertEquals(true, $jjwgAddressCache->is_valid_lat(90) ); |
|
107 | + $this->assertEquals(true, $jjwgAddressCache->is_valid_lat(-90) ); |
|
108 | 108 | |
109 | 109 | } |
110 | 110 |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | |
11 | 11 | //execute the contructor and check for the Object type and attributes |
12 | 12 | $jjwgAddressCache = new jjwg_Address_Cache(); |
13 | - $this->assertInstanceOf('jjwg_Address_Cache',$jjwgAddressCache); |
|
14 | - $this->assertInstanceOf('Basic',$jjwgAddressCache); |
|
15 | - $this->assertInstanceOf('SugarBean',$jjwgAddressCache); |
|
13 | + $this->assertInstanceOf('jjwg_Address_Cache', $jjwgAddressCache); |
|
14 | + $this->assertInstanceOf('Basic', $jjwgAddressCache); |
|
15 | + $this->assertInstanceOf('SugarBean', $jjwgAddressCache); |
|
16 | 16 | |
17 | 17 | $this->assertAttributeEquals('jjwg_Address_Cache', 'module_dir', $jjwgAddressCache); |
18 | 18 | $this->assertAttributeEquals('jjwg_Address_Cache', 'object_name', $jjwgAddressCache); |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | $jjwgAddressCache = new jjwg_Address_Cache(); |
31 | 31 | $jjwgAddressCache->configuration(); |
32 | 32 | |
33 | - $this->assertInstanceOf('jjwg_Maps',$jjwgAddressCache->jjwg_Maps); |
|
33 | + $this->assertInstanceOf('jjwg_Maps', $jjwgAddressCache->jjwg_Maps); |
|
34 | 34 | $this->assertTrue(is_array($jjwgAddressCache->settings)); |
35 | - $this->assertGreaterThan(0,count($jjwgAddressCache->settings)); |
|
35 | + $this->assertGreaterThan(0, count($jjwgAddressCache->settings)); |
|
36 | 36 | |
37 | 37 | } |
38 | 38 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | //test saveAddressCacheInfo() with a valid info array |
53 | 53 | $jjwgAddressCache->settings['address_cache_save_enabled'] = 1; |
54 | - $ainfo = array( "address"=>"test", "lat"=>"24.861462", "lng"=>"67.009939", "description"=>"test description" ); |
|
54 | + $ainfo = array("address"=>"test", "lat"=>"24.861462", "lng"=>"67.009939", "description"=>"test description"); |
|
55 | 55 | $result = $jjwgAddressCache->saveAddressCacheInfo($ainfo); |
56 | 56 | $this->assertEquals(true, $result); |
57 | 57 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | //test getAddressCacheInfo() with a valid info array |
65 | 65 | $jjwgAddressCache->settings['address_cache_get_enabled'] = 1; |
66 | - $ainfo = array( "address"=>"test", "lat"=>"24.861462", "lng"=>"67.009939", "description"=>"test description" ); |
|
66 | + $ainfo = array("address"=>"test", "lat"=>"24.861462", "lng"=>"67.009939", "description"=>"test description"); |
|
67 | 67 | $result = $jjwgAddressCache->getAddressCacheInfo($ainfo); |
68 | 68 | $this->assertTrue(is_array($result)); |
69 | 69 | |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | $jjwgAddressCache = new jjwg_Address_Cache(); |
84 | 84 | |
85 | 85 | //test with invalid values |
86 | - $this->assertEquals(false, $jjwgAddressCache->is_valid_lng('') ); |
|
87 | - $this->assertEquals(false, $jjwgAddressCache->is_valid_lng(181) ); |
|
88 | - $this->assertEquals(false, $jjwgAddressCache->is_valid_lng(-181) ); |
|
86 | + $this->assertEquals(false, $jjwgAddressCache->is_valid_lng('')); |
|
87 | + $this->assertEquals(false, $jjwgAddressCache->is_valid_lng(181)); |
|
88 | + $this->assertEquals(false, $jjwgAddressCache->is_valid_lng(-181)); |
|
89 | 89 | |
90 | 90 | //test with valid values |
91 | - $this->assertEquals(true, $jjwgAddressCache->is_valid_lng(180) ); |
|
92 | - $this->assertEquals(true, $jjwgAddressCache->is_valid_lng(-180) ); |
|
91 | + $this->assertEquals(true, $jjwgAddressCache->is_valid_lng(180)); |
|
92 | + $this->assertEquals(true, $jjwgAddressCache->is_valid_lng(-180)); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | $jjwgAddressCache = new jjwg_Address_Cache(); |
99 | 99 | |
100 | 100 | //test with invalid values |
101 | - $this->assertEquals(false, $jjwgAddressCache->is_valid_lat('') ); |
|
102 | - $this->assertEquals(false, $jjwgAddressCache->is_valid_lat(91) ); |
|
103 | - $this->assertEquals(false, $jjwgAddressCache->is_valid_lat(-91) ); |
|
101 | + $this->assertEquals(false, $jjwgAddressCache->is_valid_lat('')); |
|
102 | + $this->assertEquals(false, $jjwgAddressCache->is_valid_lat(91)); |
|
103 | + $this->assertEquals(false, $jjwgAddressCache->is_valid_lat(-91)); |
|
104 | 104 | |
105 | 105 | //test with valid values |
106 | - $this->assertEquals(true, $jjwgAddressCache->is_valid_lat(90) ); |
|
107 | - $this->assertEquals(true, $jjwgAddressCache->is_valid_lat(-90) ); |
|
106 | + $this->assertEquals(true, $jjwgAddressCache->is_valid_lat(90)); |
|
107 | + $this->assertEquals(true, $jjwgAddressCache->is_valid_lat(-90)); |
|
108 | 108 | |
109 | 109 | } |
110 | 110 |
@@ -3,570 +3,570 @@ discard block |
||
3 | 3 | |
4 | 4 | class InboundEmailTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | - public function testthis_callback() { |
|
6 | + public function testthis_callback() { |
|
7 | 7 | |
8 | - //$result = this_callback("%test%"); |
|
9 | - //var_dump($result); |
|
10 | - } |
|
8 | + //$result = this_callback("%test%"); |
|
9 | + //var_dump($result); |
|
10 | + } |
|
11 | 11 | |
12 | - public function testInboundEmail() { |
|
12 | + public function testInboundEmail() { |
|
13 | 13 | |
14 | 14 | |
15 | - //execute the contructor and check for the Object type and attributes |
|
16 | - $inboundEmail = new InboundEmail(); |
|
15 | + //execute the contructor and check for the Object type and attributes |
|
16 | + $inboundEmail = new InboundEmail(); |
|
17 | 17 | |
18 | - $this->assertInstanceOf('InboundEmail',$inboundEmail); |
|
19 | - $this->assertInstanceOf('SugarBean',$inboundEmail); |
|
18 | + $this->assertInstanceOf('InboundEmail',$inboundEmail); |
|
19 | + $this->assertInstanceOf('SugarBean',$inboundEmail); |
|
20 | 20 | |
21 | - $this->assertAttributeEquals('InboundEmail', 'module_dir', $inboundEmail); |
|
22 | - $this->assertAttributeEquals('InboundEmail', 'object_name', $inboundEmail); |
|
23 | - $this->assertAttributeEquals('inbound_email', 'table_name', $inboundEmail); |
|
21 | + $this->assertAttributeEquals('InboundEmail', 'module_dir', $inboundEmail); |
|
22 | + $this->assertAttributeEquals('InboundEmail', 'object_name', $inboundEmail); |
|
23 | + $this->assertAttributeEquals('inbound_email', 'table_name', $inboundEmail); |
|
24 | 24 | |
25 | - $this->assertAttributeEquals(true, 'new_schema', $inboundEmail); |
|
26 | - $this->assertAttributeEquals(true, 'process_save_dates', $inboundEmail); |
|
25 | + $this->assertAttributeEquals(true, 'new_schema', $inboundEmail); |
|
26 | + $this->assertAttributeEquals(true, 'process_save_dates', $inboundEmail); |
|
27 | 27 | |
28 | - $this->assertAttributeEquals('defaultIEAccount', 'keyForUsersDefaultIEAccount', $inboundEmail); |
|
29 | - $this->assertAttributeEquals(10, 'defaultEmailNumAutoreplies24Hours', $inboundEmail); |
|
30 | - $this->assertAttributeEquals(10, 'maxEmailNumAutoreplies24Hours', $inboundEmail); |
|
28 | + $this->assertAttributeEquals('defaultIEAccount', 'keyForUsersDefaultIEAccount', $inboundEmail); |
|
29 | + $this->assertAttributeEquals(10, 'defaultEmailNumAutoreplies24Hours', $inboundEmail); |
|
30 | + $this->assertAttributeEquals(10, 'maxEmailNumAutoreplies24Hours', $inboundEmail); |
|
31 | 31 | |
32 | - $this->assertAttributeEquals('InboundEmail.cache.php', 'InboundEmailCacheFile', $inboundEmail); |
|
32 | + $this->assertAttributeEquals('InboundEmail.cache.php', 'InboundEmailCacheFile', $inboundEmail); |
|
33 | 33 | |
34 | - $this->assertAttributeEquals('date', 'defaultSort', $inboundEmail); |
|
35 | - $this->assertAttributeEquals("DESC", 'defaultDirection', $inboundEmail); |
|
36 | - $this->assertAttributeEquals("F", 'iconFlagged', $inboundEmail); |
|
37 | - $this->assertAttributeEquals("D", 'iconDraft', $inboundEmail); |
|
38 | - $this->assertAttributeEquals("A", 'iconAnswered', $inboundEmail); |
|
39 | - $this->assertAttributeEquals("del", 'iconDeleted', $inboundEmail); |
|
40 | - $this->assertAttributeEquals(false, 'isAutoImport', $inboundEmail); |
|
34 | + $this->assertAttributeEquals('date', 'defaultSort', $inboundEmail); |
|
35 | + $this->assertAttributeEquals("DESC", 'defaultDirection', $inboundEmail); |
|
36 | + $this->assertAttributeEquals("F", 'iconFlagged', $inboundEmail); |
|
37 | + $this->assertAttributeEquals("D", 'iconDraft', $inboundEmail); |
|
38 | + $this->assertAttributeEquals("A", 'iconAnswered', $inboundEmail); |
|
39 | + $this->assertAttributeEquals("del", 'iconDeleted', $inboundEmail); |
|
40 | + $this->assertAttributeEquals(false, 'isAutoImport', $inboundEmail); |
|
41 | 41 | |
42 | - $this->assertAttributeEquals(0, 'attachmentCount', $inboundEmail); |
|
42 | + $this->assertAttributeEquals(0, 'attachmentCount', $inboundEmail); |
|
43 | 43 | |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - public function testsaveAndOthers() { |
|
47 | + public function testsaveAndOthers() { |
|
48 | 48 | |
49 | - error_reporting(E_ERROR | E_PARSE); |
|
49 | + error_reporting(E_ERROR | E_PARSE); |
|
50 | 50 | |
51 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
52 | - global $db; |
|
53 | - unset ($db->database); |
|
54 | - $db->checkConnection(); |
|
51 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
52 | + global $db; |
|
53 | + unset ($db->database); |
|
54 | + $db->checkConnection(); |
|
55 | 55 | |
56 | 56 | |
57 | - $inboundEmail = new InboundEmail(); |
|
57 | + $inboundEmail = new InboundEmail(); |
|
58 | 58 | |
59 | - $inboundEmail->name = "test"; |
|
60 | - $inboundEmail->group_id = 1; |
|
61 | - $inboundEmail->status = "Active"; |
|
62 | - $inboundEmail->email_user = "testuser"; |
|
63 | - $inboundEmail->email_password = "testpass"; |
|
64 | - $inboundEmail->mailbox = "mailbox1,mailbox2,mailbox3"; |
|
59 | + $inboundEmail->name = "test"; |
|
60 | + $inboundEmail->group_id = 1; |
|
61 | + $inboundEmail->status = "Active"; |
|
62 | + $inboundEmail->email_user = "testuser"; |
|
63 | + $inboundEmail->email_password = "testpass"; |
|
64 | + $inboundEmail->mailbox = "mailbox1,mailbox2,mailbox3"; |
|
65 | 65 | |
66 | - $inboundEmail->save(); |
|
66 | + $inboundEmail->save(); |
|
67 | 67 | |
68 | 68 | |
69 | - //test for record ID to verify that record is saved |
|
70 | - $this->assertTrue(isset($inboundEmail->id)); |
|
71 | - $this->assertEquals(36, strlen($inboundEmail->id)); |
|
69 | + //test for record ID to verify that record is saved |
|
70 | + $this->assertTrue(isset($inboundEmail->id)); |
|
71 | + $this->assertEquals(36, strlen($inboundEmail->id)); |
|
72 | 72 | |
73 | 73 | |
74 | - //test getCorrectMessageNoForPop3 method |
|
75 | - $this->getCorrectMessageNoForPop3($inboundEmail->id); |
|
74 | + //test getCorrectMessageNoForPop3 method |
|
75 | + $this->getCorrectMessageNoForPop3($inboundEmail->id); |
|
76 | 76 | |
77 | 77 | |
78 | - //test retrieve method |
|
79 | - $this->retrieve($inboundEmail->id); |
|
78 | + //test retrieve method |
|
79 | + $this->retrieve($inboundEmail->id); |
|
80 | 80 | |
81 | 81 | |
82 | - //test retrieveByGroupId method |
|
83 | - $this->retrieveByGroupId($inboundEmail->group_id); |
|
82 | + //test retrieveByGroupId method |
|
83 | + $this->retrieveByGroupId($inboundEmail->group_id); |
|
84 | 84 | |
85 | 85 | |
86 | - //test retrieveAllByGroupId method |
|
87 | - $this->retrieveAllByGroupId($inboundEmail->group_id); |
|
86 | + //test retrieveAllByGroupId method |
|
87 | + $this->retrieveAllByGroupId($inboundEmail->group_id); |
|
88 | 88 | |
89 | 89 | |
90 | - //test retrieveAllByGroupIdWithGroupAccounts method |
|
91 | - $this->retrieveAllByGroupIdWithGroupAccounts($inboundEmail->group_id); |
|
90 | + //test retrieveAllByGroupIdWithGroupAccounts method |
|
91 | + $this->retrieveAllByGroupIdWithGroupAccounts($inboundEmail->group_id); |
|
92 | 92 | |
93 | 93 | |
94 | - //test getSingularRelatedId method |
|
95 | - $this->getSingularRelatedId(); |
|
94 | + //test getSingularRelatedId method |
|
95 | + $this->getSingularRelatedId(); |
|
96 | 96 | |
97 | 97 | |
98 | - //test renameFolder method |
|
99 | - $this->renameFolder($inboundEmail->id); |
|
98 | + //test renameFolder method |
|
99 | + $this->renameFolder($inboundEmail->id); |
|
100 | 100 | |
101 | 101 | |
102 | - //test search method |
|
103 | - $this->search($inboundEmail->id); |
|
102 | + //test search method |
|
103 | + $this->search($inboundEmail->id); |
|
104 | 104 | |
105 | 105 | |
106 | - //test saveMailBoxFolders method |
|
107 | - $this->saveMailBoxFolders($inboundEmail->id); |
|
106 | + //test saveMailBoxFolders method |
|
107 | + $this->saveMailBoxFolders($inboundEmail->id); |
|
108 | 108 | |
109 | 109 | |
110 | - //test saveMailBoxValueOfInboundEmail method |
|
111 | - $this->saveMailBoxValueOfInboundEmail($inboundEmail->id); |
|
110 | + //test saveMailBoxValueOfInboundEmail method |
|
111 | + $this->saveMailBoxValueOfInboundEmail($inboundEmail->id); |
|
112 | 112 | |
113 | 113 | |
114 | - //test mark_deleted method |
|
115 | - $this->mark_deleted($inboundEmail->id); |
|
114 | + //test mark_deleted method |
|
115 | + $this->mark_deleted($inboundEmail->id); |
|
116 | 116 | |
117 | 117 | |
118 | - //test hardDelete method |
|
119 | - $this->hardDelete($inboundEmail->id); |
|
118 | + //test hardDelete method |
|
119 | + $this->hardDelete($inboundEmail->id); |
|
120 | 120 | |
121 | 121 | |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | 124 | |
125 | - public function getSingularRelatedId() { |
|
125 | + public function getSingularRelatedId() { |
|
126 | 126 | |
127 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
128 | - global $db; |
|
129 | - unset ($db->database); |
|
130 | - $db->checkConnection(); |
|
127 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
128 | + global $db; |
|
129 | + unset ($db->database); |
|
130 | + $db->checkConnection(); |
|
131 | 131 | |
132 | - $inboundEmail = new InboundEmail(); |
|
132 | + $inboundEmail = new InboundEmail(); |
|
133 | 133 | |
134 | 134 | |
135 | - $result = $inboundEmail->getSingularRelatedId("test","inbound_email"); |
|
136 | - $this->assertEquals(false, $result); |
|
135 | + $result = $inboundEmail->getSingularRelatedId("test","inbound_email"); |
|
136 | + $this->assertEquals(false, $result); |
|
137 | 137 | |
138 | 138 | |
139 | - $result = $inboundEmail->getSingularRelatedId("invalid test","inbound_email"); |
|
140 | - $this->assertEquals(null, $result); |
|
139 | + $result = $inboundEmail->getSingularRelatedId("invalid test","inbound_email"); |
|
140 | + $this->assertEquals(null, $result); |
|
141 | 141 | |
142 | 142 | |
143 | - } |
|
143 | + } |
|
144 | 144 | |
145 | - public function getCorrectMessageNoForPop3($id) { |
|
145 | + public function getCorrectMessageNoForPop3($id) { |
|
146 | 146 | |
147 | - $inboundEmail = new InboundEmail(); |
|
147 | + $inboundEmail = new InboundEmail(); |
|
148 | 148 | |
149 | - $inboundEmail->retrieve($id); |
|
149 | + $inboundEmail->retrieve($id); |
|
150 | 150 | |
151 | - $result = $inboundEmail->getCorrectMessageNoForPop3("100"); |
|
152 | - $this->assertEquals(-1, $result); |
|
151 | + $result = $inboundEmail->getCorrectMessageNoForPop3("100"); |
|
152 | + $this->assertEquals(-1, $result); |
|
153 | 153 | |
154 | 154 | |
155 | - $result = $inboundEmail->getCorrectMessageNoForPop3("1"); |
|
156 | - $this->assertEquals(-1, $result); |
|
155 | + $result = $inboundEmail->getCorrectMessageNoForPop3("1"); |
|
156 | + $this->assertEquals(-1, $result); |
|
157 | 157 | |
158 | - } |
|
158 | + } |
|
159 | 159 | |
160 | 160 | |
161 | 161 | |
162 | - public function retrieve($id) { |
|
162 | + public function retrieve($id) { |
|
163 | 163 | |
164 | - $inboundEmail = new InboundEmail(); |
|
164 | + $inboundEmail = new InboundEmail(); |
|
165 | 165 | |
166 | - $inboundEmail->retrieve($id); |
|
166 | + $inboundEmail->retrieve($id); |
|
167 | 167 | |
168 | - $this->assertEquals("test", $inboundEmail->name); |
|
169 | - $this->assertEquals("Active", $inboundEmail->status); |
|
170 | - $this->assertEquals("testuser", $inboundEmail->email_user); |
|
171 | - $this->assertEquals("testpass", $inboundEmail->email_password); |
|
168 | + $this->assertEquals("test", $inboundEmail->name); |
|
169 | + $this->assertEquals("Active", $inboundEmail->status); |
|
170 | + $this->assertEquals("testuser", $inboundEmail->email_user); |
|
171 | + $this->assertEquals("testpass", $inboundEmail->email_password); |
|
172 | 172 | |
173 | - } |
|
173 | + } |
|
174 | 174 | |
175 | 175 | |
176 | - public function retrieveByGroupId($group_id) { |
|
176 | + public function retrieveByGroupId($group_id) { |
|
177 | 177 | |
178 | - $inboundEmail = new InboundEmail(); |
|
178 | + $inboundEmail = new InboundEmail(); |
|
179 | 179 | |
180 | - $result = $inboundEmail->retrieveByGroupId($group_id); |
|
180 | + $result = $inboundEmail->retrieveByGroupId($group_id); |
|
181 | 181 | |
182 | - $this->assertTrue(is_array($result)); |
|
182 | + $this->assertTrue(is_array($result)); |
|
183 | 183 | |
184 | - foreach($result as $ie){ |
|
185 | - $this->assertInstanceOf('InboundEmail',$ie); |
|
186 | - } |
|
184 | + foreach($result as $ie){ |
|
185 | + $this->assertInstanceOf('InboundEmail',$ie); |
|
186 | + } |
|
187 | 187 | |
188 | - } |
|
188 | + } |
|
189 | 189 | |
190 | 190 | |
191 | - public function retrieveAllByGroupId($group_id) { |
|
191 | + public function retrieveAllByGroupId($group_id) { |
|
192 | 192 | |
193 | - $inboundEmail = new InboundEmail(); |
|
193 | + $inboundEmail = new InboundEmail(); |
|
194 | 194 | |
195 | - $result = $inboundEmail->retrieveAllByGroupId($group_id); |
|
195 | + $result = $inboundEmail->retrieveAllByGroupId($group_id); |
|
196 | 196 | |
197 | - $this->assertTrue(is_array($result)); |
|
197 | + $this->assertTrue(is_array($result)); |
|
198 | 198 | |
199 | - foreach($result as $ie){ |
|
200 | - $this->assertInstanceOf('InboundEmail',$ie); |
|
201 | - } |
|
199 | + foreach($result as $ie){ |
|
200 | + $this->assertInstanceOf('InboundEmail',$ie); |
|
201 | + } |
|
202 | 202 | |
203 | - } |
|
203 | + } |
|
204 | 204 | |
205 | 205 | |
206 | - public function retrieveAllByGroupIdWithGroupAccounts($group_id) { |
|
206 | + public function retrieveAllByGroupIdWithGroupAccounts($group_id) { |
|
207 | 207 | |
208 | - $inboundEmail = new InboundEmail(); |
|
208 | + $inboundEmail = new InboundEmail(); |
|
209 | 209 | |
210 | - $result = $inboundEmail->retrieveAllByGroupIdWithGroupAccounts($group_id); |
|
210 | + $result = $inboundEmail->retrieveAllByGroupIdWithGroupAccounts($group_id); |
|
211 | 211 | |
212 | - $this->assertTrue(is_array($result)); |
|
212 | + $this->assertTrue(is_array($result)); |
|
213 | 213 | |
214 | - foreach($result as $ie){ |
|
215 | - $this->assertInstanceOf('InboundEmail',$ie); |
|
216 | - } |
|
214 | + foreach($result as $ie){ |
|
215 | + $this->assertInstanceOf('InboundEmail',$ie); |
|
216 | + } |
|
217 | 217 | |
218 | - } |
|
218 | + } |
|
219 | 219 | |
220 | - public function renameFolder($id) { |
|
220 | + public function renameFolder($id) { |
|
221 | 221 | |
222 | - $inboundEmail = new InboundEmail(); |
|
222 | + $inboundEmail = new InboundEmail(); |
|
223 | 223 | |
224 | - $inboundEmail->retrieve($id); |
|
224 | + $inboundEmail->retrieve($id); |
|
225 | 225 | |
226 | - //execute the method and test if it works and does not throws an exception. |
|
227 | - try { |
|
228 | - $inboundEmail->renameFolder("mailbox1", "new_mailbox"); |
|
229 | - $this->assertTrue(true); |
|
230 | - } |
|
231 | - catch (Exception $e) { |
|
232 | - $this->fail(); |
|
233 | - } |
|
226 | + //execute the method and test if it works and does not throws an exception. |
|
227 | + try { |
|
228 | + $inboundEmail->renameFolder("mailbox1", "new_mailbox"); |
|
229 | + $this->assertTrue(true); |
|
230 | + } |
|
231 | + catch (Exception $e) { |
|
232 | + $this->fail(); |
|
233 | + } |
|
234 | 234 | |
235 | - } |
|
235 | + } |
|
236 | 236 | |
237 | 237 | |
238 | - public function search($id) { |
|
238 | + public function search($id) { |
|
239 | 239 | |
240 | - $inboundEmail = new InboundEmail(); |
|
240 | + $inboundEmail = new InboundEmail(); |
|
241 | 241 | |
242 | - $inboundEmail->retrieve($id); |
|
242 | + $inboundEmail->retrieve($id); |
|
243 | 243 | |
244 | - $result = $inboundEmail->search($id); |
|
244 | + $result = $inboundEmail->search($id); |
|
245 | 245 | |
246 | - $this->assertTrue(is_array($result)); |
|
247 | - $this->assertEquals("Search Results" ,$result["mbox"]); |
|
248 | - $this->assertEquals($id ,$result["ieId"]); |
|
246 | + $this->assertTrue(is_array($result)); |
|
247 | + $this->assertEquals("Search Results" ,$result["mbox"]); |
|
248 | + $this->assertEquals($id ,$result["ieId"]); |
|
249 | 249 | |
250 | - } |
|
250 | + } |
|
251 | 251 | |
252 | 252 | |
253 | 253 | |
254 | - public function saveMailBoxFolders($id) { |
|
254 | + public function saveMailBoxFolders($id) { |
|
255 | 255 | |
256 | - $inboundEmail = new InboundEmail(); |
|
256 | + $inboundEmail = new InboundEmail(); |
|
257 | 257 | |
258 | - $inboundEmail->retrieve($id); |
|
258 | + $inboundEmail->retrieve($id); |
|
259 | 259 | |
260 | - //execute he method and verify attributes |
|
261 | - $inboundEmail->saveMailBoxFolders("INBOX,TRASH"); |
|
262 | - $this->assertEquals(array("INBOX","TRASH") , $inboundEmail->mailboxarray); |
|
260 | + //execute he method and verify attributes |
|
261 | + $inboundEmail->saveMailBoxFolders("INBOX,TRASH"); |
|
262 | + $this->assertEquals(array("INBOX","TRASH") , $inboundEmail->mailboxarray); |
|
263 | 263 | |
264 | - //retrieve it back and verify the updates |
|
265 | - $inboundEmail->retrieve($id); |
|
266 | - $this->assertEquals("INBOX,TRASH" , $inboundEmail->mailbox); |
|
264 | + //retrieve it back and verify the updates |
|
265 | + $inboundEmail->retrieve($id); |
|
266 | + $this->assertEquals("INBOX,TRASH" , $inboundEmail->mailbox); |
|
267 | 267 | |
268 | - } |
|
268 | + } |
|
269 | 269 | |
270 | 270 | |
271 | - public function saveMailBoxValueOfInboundEmail($id) { |
|
271 | + public function saveMailBoxValueOfInboundEmail($id) { |
|
272 | 272 | $this->markTestSkipped("saveMailBoxValueOfInboundEmail skipped - method looks suspect. Should likely be removed."); |
273 | - $inboundEmail = new InboundEmail(); |
|
273 | + $inboundEmail = new InboundEmail(); |
|
274 | 274 | |
275 | - $inboundEmail->email_user = "TEST"; |
|
275 | + $inboundEmail->email_user = "TEST"; |
|
276 | 276 | |
277 | - $inboundEmail->saveMailBoxValueOfInboundEmail(); |
|
277 | + $inboundEmail->saveMailBoxValueOfInboundEmail(); |
|
278 | 278 | |
279 | 279 | |
280 | - //retrieve it back and verify the updates |
|
281 | - $inboundEmail->retrieve($id); |
|
282 | - $this->assertEquals("TEST" , $inboundEmail->mailbox); |
|
280 | + //retrieve it back and verify the updates |
|
281 | + $inboundEmail->retrieve($id); |
|
282 | + $this->assertEquals("TEST" , $inboundEmail->mailbox); |
|
283 | 283 | |
284 | - } |
|
284 | + } |
|
285 | 285 | |
286 | 286 | |
287 | - public function mark_deleted($id) { |
|
287 | + public function mark_deleted($id) { |
|
288 | 288 | |
289 | 289 | |
290 | - $inboundEmail = new InboundEmail(); |
|
290 | + $inboundEmail = new InboundEmail(); |
|
291 | 291 | |
292 | - $inboundEmail->mark_deleted($id); |
|
292 | + $inboundEmail->mark_deleted($id); |
|
293 | 293 | |
294 | - $result = $inboundEmail->retrieve($id); |
|
295 | - $this->assertEquals(null,$result); |
|
294 | + $result = $inboundEmail->retrieve($id); |
|
295 | + $this->assertEquals(null,$result); |
|
296 | 296 | |
297 | - } |
|
297 | + } |
|
298 | 298 | |
299 | 299 | |
300 | - public function hardDelete($id) { |
|
300 | + public function hardDelete($id) { |
|
301 | 301 | |
302 | - $inboundEmail = new InboundEmail(); |
|
302 | + $inboundEmail = new InboundEmail(); |
|
303 | 303 | |
304 | - $inboundEmail->hardDelete($id); |
|
304 | + $inboundEmail->hardDelete($id); |
|
305 | 305 | |
306 | - $result = $inboundEmail->retrieve($id); |
|
307 | - $this->assertEquals(null,$result); |
|
306 | + $result = $inboundEmail->retrieve($id); |
|
307 | + $this->assertEquals(null,$result); |
|
308 | 308 | |
309 | - } |
|
309 | + } |
|
310 | 310 | |
311 | - public function testcustomGetMessageText() { |
|
311 | + public function testcustomGetMessageText() { |
|
312 | 312 | |
313 | - $inboundEmail = new InboundEmail(); |
|
313 | + $inboundEmail = new InboundEmail(); |
|
314 | 314 | |
315 | - $result = $inboundEmail->customGetMessageText("some message"); |
|
316 | - $this->assertEquals("some message", $result); |
|
315 | + $result = $inboundEmail->customGetMessageText("some message"); |
|
316 | + $this->assertEquals("some message", $result); |
|
317 | 317 | |
318 | - } |
|
318 | + } |
|
319 | 319 | |
320 | - public function testgetFormattedRawSource() { |
|
320 | + public function testgetFormattedRawSource() { |
|
321 | 321 | |
322 | - $inboundEmail = new InboundEmail(); |
|
322 | + $inboundEmail = new InboundEmail(); |
|
323 | 323 | |
324 | - //test without ID |
|
325 | - $result = $inboundEmail->getFormattedRawSource("1"); |
|
326 | - $this->assertEquals("This information is not available", $result); |
|
324 | + //test without ID |
|
325 | + $result = $inboundEmail->getFormattedRawSource("1"); |
|
326 | + $this->assertEquals("This information is not available", $result); |
|
327 | 327 | |
328 | 328 | |
329 | - //test with ID |
|
330 | - $inboundEmail->id = 1; |
|
331 | - $result = $inboundEmail->getFormattedRawSource("1"); |
|
332 | - $this->assertEquals("", $result); |
|
329 | + //test with ID |
|
330 | + $inboundEmail->id = 1; |
|
331 | + $result = $inboundEmail->getFormattedRawSource("1"); |
|
332 | + $this->assertEquals("", $result); |
|
333 | 333 | |
334 | - } |
|
334 | + } |
|
335 | 335 | |
336 | 336 | |
337 | - public function testfilterMailBoxFromRaw() { |
|
337 | + public function testfilterMailBoxFromRaw() { |
|
338 | 338 | |
339 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
340 | - global $db; |
|
341 | - unset ($db->database); |
|
342 | - $db->checkConnection(); |
|
339 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
340 | + global $db; |
|
341 | + unset ($db->database); |
|
342 | + $db->checkConnection(); |
|
343 | 343 | |
344 | - $inboundEmail = new InboundEmail(); |
|
344 | + $inboundEmail = new InboundEmail(); |
|
345 | 345 | |
346 | 346 | |
347 | - //test with array having common element |
|
348 | - $result = $inboundEmail->filterMailBoxFromRaw(array("mailbox1", "mailbox2", "mailbox3"), array("mailbox1")); |
|
349 | - $this->assertSame(array("mailbox1"), $result ); |
|
347 | + //test with array having common element |
|
348 | + $result = $inboundEmail->filterMailBoxFromRaw(array("mailbox1", "mailbox2", "mailbox3"), array("mailbox1")); |
|
349 | + $this->assertSame(array("mailbox1"), $result ); |
|
350 | 350 | |
351 | 351 | |
352 | - //test with array having nothing common |
|
353 | - $result = $inboundEmail->filterMailBoxFromRaw( array("mailbox1", "mailbox2"), array("mailbox4")); |
|
354 | - $this->assertSame(array(), $result ); |
|
352 | + //test with array having nothing common |
|
353 | + $result = $inboundEmail->filterMailBoxFromRaw( array("mailbox1", "mailbox2"), array("mailbox4")); |
|
354 | + $this->assertSame(array(), $result ); |
|
355 | 355 | |
356 | - } |
|
356 | + } |
|
357 | 357 | |
358 | 358 | |
359 | 359 | public function testconvertToUtf8() |
360 | 360 | { |
361 | - $inboundEmail = new InboundEmail(); |
|
362 | - $result = $inboundEmail->convertToUtf8("some text with non UTF8 chars"); |
|
363 | - $this->assertSame("some text with non UTF8 chars", $result); |
|
361 | + $inboundEmail = new InboundEmail(); |
|
362 | + $result = $inboundEmail->convertToUtf8("some text with non UTF8 chars"); |
|
363 | + $this->assertSame("some text with non UTF8 chars", $result); |
|
364 | 364 | |
365 | 365 | } |
366 | 366 | |
367 | 367 | |
368 | - public function testgetFormattedHeaders() { |
|
368 | + public function testgetFormattedHeaders() { |
|
369 | 369 | |
370 | - $inboundEmail = new InboundEmail(); |
|
370 | + $inboundEmail = new InboundEmail(); |
|
371 | 371 | |
372 | - //test for default/imap |
|
373 | - $result = $inboundEmail->getFormattedHeaders(1); |
|
374 | - $this->assertSame("<table cellspacing='0' cellpadding='2' border='0' width='100%'></table>", $result); |
|
372 | + //test for default/imap |
|
373 | + $result = $inboundEmail->getFormattedHeaders(1); |
|
374 | + $this->assertSame("<table cellspacing='0' cellpadding='2' border='0' width='100%'></table>", $result); |
|
375 | 375 | |
376 | 376 | |
377 | - //test for pop3 |
|
378 | - $inboundEmail->protocol = 'pop3'; |
|
379 | - $result = $inboundEmail->getFormattedHeaders(1); |
|
380 | - $this->assertSame("<table cellspacing='0' cellpadding='2' border='0' width='100%'></table>", $result); |
|
377 | + //test for pop3 |
|
378 | + $inboundEmail->protocol = 'pop3'; |
|
379 | + $result = $inboundEmail->getFormattedHeaders(1); |
|
380 | + $this->assertSame("<table cellspacing='0' cellpadding='2' border='0' width='100%'></table>", $result); |
|
381 | 381 | |
382 | - } |
|
382 | + } |
|
383 | 383 | |
384 | 384 | |
385 | - public function testsetAndgetCacheTimestamp() { |
|
385 | + public function testsetAndgetCacheTimestamp() { |
|
386 | 386 | |
387 | - $inboundEmail = new InboundEmail(); |
|
387 | + $inboundEmail = new InboundEmail(); |
|
388 | 388 | |
389 | - $inboundEmail->id = 1; |
|
389 | + $inboundEmail->id = 1; |
|
390 | 390 | |
391 | - //test setCacheTimestamp method |
|
392 | - $inboundEmail->setCacheTimestamp("INBOX"); |
|
391 | + //test setCacheTimestamp method |
|
392 | + $inboundEmail->setCacheTimestamp("INBOX"); |
|
393 | 393 | |
394 | 394 | |
395 | - //test getCacheTimestamp method |
|
396 | - $result = $inboundEmail->getCacheTimestamp("INBOX"); |
|
397 | - $this->assertGreaterThan(0, strlen($result)); |
|
395 | + //test getCacheTimestamp method |
|
396 | + $result = $inboundEmail->getCacheTimestamp("INBOX"); |
|
397 | + $this->assertGreaterThan(0, strlen($result)); |
|
398 | 398 | |
399 | 399 | |
400 | - } |
|
400 | + } |
|
401 | 401 | |
402 | 402 | |
403 | - public function testsetCacheValue() { |
|
403 | + public function testsetCacheValue() { |
|
404 | 404 | |
405 | - $inboundEmail = new InboundEmail(); |
|
405 | + $inboundEmail = new InboundEmail(); |
|
406 | 406 | |
407 | - $inboundEmail->id = 1; |
|
407 | + $inboundEmail->id = 1; |
|
408 | 408 | |
409 | - $inserts = array(); |
|
409 | + $inserts = array(); |
|
410 | 410 | |
411 | - $overview = new Overview(); |
|
412 | - $overview->imap_uid = 1; |
|
413 | - $overview->subject = "subject"; |
|
414 | - $overview->from = "from"; |
|
415 | - $overview->fromaddr = "[email protected]"; |
|
416 | - $overview->to = "to"; |
|
417 | - $overview->toaddr = "[email protected]"; |
|
418 | - $overview->size = 0; |
|
419 | - $overview->message_id = 1; |
|
411 | + $overview = new Overview(); |
|
412 | + $overview->imap_uid = 1; |
|
413 | + $overview->subject = "subject"; |
|
414 | + $overview->from = "from"; |
|
415 | + $overview->fromaddr = "[email protected]"; |
|
416 | + $overview->to = "to"; |
|
417 | + $overview->toaddr = "[email protected]"; |
|
418 | + $overview->size = 0; |
|
419 | + $overview->message_id = 1; |
|
420 | 420 | |
421 | - $inserts[] = $overview; |
|
421 | + $inserts[] = $overview; |
|
422 | 422 | |
423 | 423 | |
424 | - //execute the method to populate email cache |
|
425 | - $inboundEmail->setCacheValue("INBOX", $inserts); |
|
426 | - $inboundEmail->setCacheValue("INBOX.Trash", $inserts); |
|
424 | + //execute the method to populate email cache |
|
425 | + $inboundEmail->setCacheValue("INBOX", $inserts); |
|
426 | + $inboundEmail->setCacheValue("INBOX.Trash", $inserts); |
|
427 | 427 | |
428 | - //retrieve back to verify the records created |
|
429 | - $result = $inboundEmail->getCacheValue("INBOX"); |
|
428 | + //retrieve back to verify the records created |
|
429 | + $result = $inboundEmail->getCacheValue("INBOX"); |
|
430 | 430 | |
431 | - $this->assertGreaterThan(0, count($result['retArr'][0])); |
|
432 | - $this->assertEquals(1, $result['retArr'][0]->message_id); |
|
431 | + $this->assertGreaterThan(0, count($result['retArr'][0])); |
|
432 | + $this->assertEquals(1, $result['retArr'][0]->message_id); |
|
433 | 433 | |
434 | - } |
|
434 | + } |
|
435 | 435 | |
436 | - public function testgetCacheValueForUIDs() { |
|
436 | + public function testgetCacheValueForUIDs() { |
|
437 | 437 | |
438 | - $inboundEmail = new InboundEmail(); |
|
438 | + $inboundEmail = new InboundEmail(); |
|
439 | 439 | |
440 | 440 | |
441 | - //test wih default protocol |
|
442 | - $result = $inboundEmail->getCacheValueForUIDs("INBOX", array(1,2,3,4,5)); |
|
441 | + //test wih default protocol |
|
442 | + $result = $inboundEmail->getCacheValueForUIDs("INBOX", array(1,2,3,4,5)); |
|
443 | 443 | |
444 | - $this->assertTrue(is_array($result)); |
|
445 | - $this->assertTrue(is_array($result['uids'])); |
|
446 | - $this->assertTrue(is_array($result['retArr'])); |
|
444 | + $this->assertTrue(is_array($result)); |
|
445 | + $this->assertTrue(is_array($result['uids'])); |
|
446 | + $this->assertTrue(is_array($result['retArr'])); |
|
447 | 447 | |
448 | 448 | |
449 | 449 | |
450 | - //test wih pop3 protocol |
|
451 | - $inboundEmail->protocol = 'pop3'; |
|
452 | - $result = $inboundEmail->getCacheValueForUIDs("INBOX", array(1,2,3,4,5)); |
|
450 | + //test wih pop3 protocol |
|
451 | + $inboundEmail->protocol = 'pop3'; |
|
452 | + $result = $inboundEmail->getCacheValueForUIDs("INBOX", array(1,2,3,4,5)); |
|
453 | 453 | |
454 | - $this->assertTrue(is_array($result)); |
|
455 | - $this->assertTrue(is_array($result['uids'])); |
|
456 | - $this->assertTrue(is_array($result['retArr'])); |
|
454 | + $this->assertTrue(is_array($result)); |
|
455 | + $this->assertTrue(is_array($result['uids'])); |
|
456 | + $this->assertTrue(is_array($result['retArr'])); |
|
457 | 457 | |
458 | - } |
|
458 | + } |
|
459 | 459 | |
460 | 460 | |
461 | - public function testgetCacheValue() { |
|
461 | + public function testgetCacheValue() { |
|
462 | 462 | |
463 | - $inboundEmail = new InboundEmail(); |
|
463 | + $inboundEmail = new InboundEmail(); |
|
464 | 464 | |
465 | 465 | |
466 | - //test wih default protocol |
|
467 | - $result = $inboundEmail->getCacheValue("INBOX"); |
|
466 | + //test wih default protocol |
|
467 | + $result = $inboundEmail->getCacheValue("INBOX"); |
|
468 | 468 | |
469 | - $this->assertTrue(is_array($result)); |
|
470 | - $this->assertTrue(is_array($result['uids'])); |
|
471 | - $this->assertTrue(is_array($result['retArr'])); |
|
469 | + $this->assertTrue(is_array($result)); |
|
470 | + $this->assertTrue(is_array($result['uids'])); |
|
471 | + $this->assertTrue(is_array($result['retArr'])); |
|
472 | 472 | |
473 | 473 | |
474 | - //test wih pop3 protocol |
|
475 | - $inboundEmail->protocol = 'pop3'; |
|
476 | - $result = $inboundEmail->getCacheValue("INBOX"); |
|
474 | + //test wih pop3 protocol |
|
475 | + $inboundEmail->protocol = 'pop3'; |
|
476 | + $result = $inboundEmail->getCacheValue("INBOX"); |
|
477 | 477 | |
478 | - $this->assertTrue(is_array($result)); |
|
479 | - $this->assertTrue(is_array($result['uids'])); |
|
480 | - $this->assertTrue(is_array($result['retArr'])); |
|
478 | + $this->assertTrue(is_array($result)); |
|
479 | + $this->assertTrue(is_array($result['uids'])); |
|
480 | + $this->assertTrue(is_array($result['retArr'])); |
|
481 | 481 | |
482 | 482 | |
483 | - } |
|
483 | + } |
|
484 | 484 | |
485 | - public function testvalidCacheExists() { |
|
485 | + public function testvalidCacheExists() { |
|
486 | 486 | |
487 | - $inboundEmail = new InboundEmail(); |
|
487 | + $inboundEmail = new InboundEmail(); |
|
488 | 488 | |
489 | - //test without a valid id |
|
490 | - $result = $inboundEmail->validCacheExists(""); |
|
491 | - $this->assertEquals(false, $result); |
|
489 | + //test without a valid id |
|
490 | + $result = $inboundEmail->validCacheExists(""); |
|
491 | + $this->assertEquals(false, $result); |
|
492 | 492 | |
493 | 493 | |
494 | - //test with a valid id set |
|
495 | - $inboundEmail->id = 1; |
|
496 | - $result = $inboundEmail->validCacheExists(""); |
|
497 | - $this->assertEquals(true, $result); |
|
494 | + //test with a valid id set |
|
495 | + $inboundEmail->id = 1; |
|
496 | + $result = $inboundEmail->validCacheExists(""); |
|
497 | + $this->assertEquals(true, $result); |
|
498 | 498 | |
499 | - } |
|
499 | + } |
|
500 | 500 | |
501 | 501 | |
502 | - public function testdisplayFetchedSortedListXML() { |
|
502 | + public function testdisplayFetchedSortedListXML() { |
|
503 | 503 | |
504 | - $inboundEmail = new InboundEmail(); |
|
504 | + $inboundEmail = new InboundEmail(); |
|
505 | 505 | |
506 | - //get the cache values array first |
|
507 | - $inboundEmail->id = 1; |
|
508 | - $ret = $inboundEmail->getCacheValue("INBOX"); |
|
506 | + //get the cache values array first |
|
507 | + $inboundEmail->id = 1; |
|
508 | + $ret = $inboundEmail->getCacheValue("INBOX"); |
|
509 | 509 | |
510 | - //use the cache values array as parameter and verify that it returns an array |
|
511 | - $result = $inboundEmail->displayFetchedSortedListXML($ret,"INBOX"); |
|
512 | - $this->assertTrue(is_array($result)); |
|
510 | + //use the cache values array as parameter and verify that it returns an array |
|
511 | + $result = $inboundEmail->displayFetchedSortedListXML($ret,"INBOX"); |
|
512 | + $this->assertTrue(is_array($result)); |
|
513 | 513 | |
514 | 514 | |
515 | - } |
|
515 | + } |
|
516 | 516 | |
517 | 517 | |
518 | - public function testgetCacheUnreadCount() { |
|
518 | + public function testgetCacheUnreadCount() { |
|
519 | 519 | |
520 | - $inboundEmail = new InboundEmail(); |
|
520 | + $inboundEmail = new InboundEmail(); |
|
521 | 521 | |
522 | - $inboundEmail->id = 1; |
|
522 | + $inboundEmail->id = 1; |
|
523 | 523 | |
524 | 524 | |
525 | - //test with invalid mailbox |
|
526 | - $result = $inboundEmail->getCacheUnreadCount("OUTBOX"); |
|
527 | - $this->assertEquals(0, $result); |
|
525 | + //test with invalid mailbox |
|
526 | + $result = $inboundEmail->getCacheUnreadCount("OUTBOX"); |
|
527 | + $this->assertEquals(0, $result); |
|
528 | 528 | |
529 | 529 | |
530 | - //test with valid mailbox |
|
531 | - $result = $inboundEmail->getCacheUnreadCount("INBOX"); |
|
532 | - $this->assertGreaterThanOrEqual(1, $result); |
|
530 | + //test with valid mailbox |
|
531 | + $result = $inboundEmail->getCacheUnreadCount("INBOX"); |
|
532 | + $this->assertGreaterThanOrEqual(1, $result); |
|
533 | 533 | |
534 | - } |
|
534 | + } |
|
535 | 535 | |
536 | 536 | |
537 | - public function testgetCacheCount() { |
|
537 | + public function testgetCacheCount() { |
|
538 | 538 | |
539 | - $inboundEmail = new InboundEmail(); |
|
539 | + $inboundEmail = new InboundEmail(); |
|
540 | 540 | |
541 | - $inboundEmail->id = 1; |
|
541 | + $inboundEmail->id = 1; |
|
542 | 542 | |
543 | 543 | |
544 | - //test with invalid mailbox |
|
545 | - $result = $inboundEmail->getCacheCount("OUTBOX"); |
|
546 | - $this->assertEquals(0, $result); |
|
544 | + //test with invalid mailbox |
|
545 | + $result = $inboundEmail->getCacheCount("OUTBOX"); |
|
546 | + $this->assertEquals(0, $result); |
|
547 | 547 | |
548 | 548 | |
549 | - //test with valid mailbox |
|
550 | - $result = $inboundEmail->getCacheCount("INBOX"); |
|
551 | - $this->assertGreaterThanOrEqual(1, $result); |
|
549 | + //test with valid mailbox |
|
550 | + $result = $inboundEmail->getCacheCount("INBOX"); |
|
551 | + $this->assertGreaterThanOrEqual(1, $result); |
|
552 | 552 | |
553 | - } |
|
553 | + } |
|
554 | 554 | |
555 | 555 | public function testgetCacheUnread() { |
556 | 556 | |
557 | - $inboundEmail = new InboundEmail(); |
|
557 | + $inboundEmail = new InboundEmail(); |
|
558 | 558 | |
559 | - $inboundEmail->id = 1; |
|
559 | + $inboundEmail->id = 1; |
|
560 | 560 | |
561 | 561 | |
562 | - //test with invalid mailbox |
|
563 | - $result = $inboundEmail->getCacheUnread("OUTBOX"); |
|
564 | - $this->assertEquals(0, $result); |
|
562 | + //test with invalid mailbox |
|
563 | + $result = $inboundEmail->getCacheUnread("OUTBOX"); |
|
564 | + $this->assertEquals(0, $result); |
|
565 | 565 | |
566 | 566 | |
567 | - //test with valid mailbox |
|
568 | - $result = $inboundEmail->getCacheUnread("INBOX"); |
|
569 | - $this->assertGreaterThanOrEqual(1, $result); |
|
567 | + //test with valid mailbox |
|
568 | + $result = $inboundEmail->getCacheUnread("INBOX"); |
|
569 | + $this->assertGreaterThanOrEqual(1, $result); |
|
570 | 570 | |
571 | 571 | |
572 | 572 | } |
@@ -575,35 +575,35 @@ discard block |
||
575 | 575 | public function testmark_answered() { |
576 | 576 | |
577 | 577 | |
578 | - $inboundEmail = new InboundEmail(); |
|
578 | + $inboundEmail = new InboundEmail(); |
|
579 | 579 | |
580 | - $inboundEmail->id = 1; |
|
580 | + $inboundEmail->id = 1; |
|
581 | 581 | |
582 | - //execute the method to populate answered field |
|
583 | - $inboundEmail->mark_answered(1,'pop3'); |
|
582 | + //execute the method to populate answered field |
|
583 | + $inboundEmail->mark_answered(1,'pop3'); |
|
584 | 584 | |
585 | - //retrieve back to verify the records updated |
|
586 | - $result = $inboundEmail->getCacheValue("INBOX"); |
|
585 | + //retrieve back to verify the records updated |
|
586 | + $result = $inboundEmail->getCacheValue("INBOX"); |
|
587 | 587 | |
588 | 588 | |
589 | - $this->assertEquals(1, $result['retArr'][0]->answered); |
|
589 | + $this->assertEquals(1, $result['retArr'][0]->answered); |
|
590 | 590 | |
591 | 591 | } |
592 | 592 | |
593 | 593 | |
594 | 594 | public function testpop3_shiftCache() { |
595 | 595 | |
596 | - $inboundEmail = new InboundEmail(); |
|
596 | + $inboundEmail = new InboundEmail(); |
|
597 | 597 | |
598 | - $inboundEmail->id = 1; |
|
598 | + $inboundEmail->id = 1; |
|
599 | 599 | |
600 | - $result = $inboundEmail->pop3_shiftCache(array('1'=>'1'),array('1')); |
|
600 | + $result = $inboundEmail->pop3_shiftCache(array('1'=>'1'),array('1')); |
|
601 | 601 | |
602 | - //retrieve back to verify the records updated |
|
603 | - $result = $inboundEmail->getCacheValue("INBOX"); |
|
602 | + //retrieve back to verify the records updated |
|
603 | + $result = $inboundEmail->getCacheValue("INBOX"); |
|
604 | 604 | |
605 | - $this->assertEquals(1, $result['retArr'][0]->imap_uid); |
|
606 | - $this->assertEquals(1, $result['retArr'][0]->msgno); |
|
605 | + $this->assertEquals(1, $result['retArr'][0]->imap_uid); |
|
606 | + $this->assertEquals(1, $result['retArr'][0]->msgno); |
|
607 | 607 | |
608 | 608 | |
609 | 609 | } |
@@ -612,91 +612,91 @@ discard block |
||
612 | 612 | |
613 | 613 | public function testgetUIDLForMessage() { |
614 | 614 | |
615 | - $inboundEmail = new InboundEmail(); |
|
615 | + $inboundEmail = new InboundEmail(); |
|
616 | 616 | |
617 | - $inboundEmail->id = 1; |
|
617 | + $inboundEmail->id = 1; |
|
618 | 618 | |
619 | 619 | |
620 | - //test with invalid msgNo |
|
621 | - $result = $inboundEmail->getUIDLForMessage("2"); |
|
622 | - $this->assertEquals("", $result); |
|
620 | + //test with invalid msgNo |
|
621 | + $result = $inboundEmail->getUIDLForMessage("2"); |
|
622 | + $this->assertEquals("", $result); |
|
623 | 623 | |
624 | 624 | |
625 | - //test with valid msgNo |
|
626 | - $result = $inboundEmail->getUIDLForMessage("1"); |
|
627 | - $this->assertEquals("1", $result); |
|
625 | + //test with valid msgNo |
|
626 | + $result = $inboundEmail->getUIDLForMessage("1"); |
|
627 | + $this->assertEquals("1", $result); |
|
628 | 628 | |
629 | 629 | } |
630 | 630 | |
631 | 631 | |
632 | 632 | public function testgetMsgnoForMessageID() { |
633 | 633 | |
634 | - $inboundEmail = new InboundEmail(); |
|
634 | + $inboundEmail = new InboundEmail(); |
|
635 | 635 | |
636 | - $inboundEmail->id = 1; |
|
636 | + $inboundEmail->id = 1; |
|
637 | 637 | |
638 | 638 | |
639 | - //test with invalid msgNo |
|
640 | - $result = $inboundEmail->getMsgnoForMessageID("2"); |
|
641 | - $this->assertEquals("", $result); |
|
639 | + //test with invalid msgNo |
|
640 | + $result = $inboundEmail->getMsgnoForMessageID("2"); |
|
641 | + $this->assertEquals("", $result); |
|
642 | 642 | |
643 | 643 | |
644 | - //test with valid msgNo but most probably it will never work because of wrong column name in return statement |
|
645 | - $result = $inboundEmail->getMsgnoForMessageID("1"); |
|
646 | - $this->assertEquals("", $result); |
|
644 | + //test with valid msgNo but most probably it will never work because of wrong column name in return statement |
|
645 | + $result = $inboundEmail->getMsgnoForMessageID("1"); |
|
646 | + $this->assertEquals("", $result); |
|
647 | 647 | |
648 | 648 | |
649 | 649 | } |
650 | 650 | |
651 | 651 | public function testpop3_getCacheUidls() { |
652 | 652 | |
653 | - $inboundEmail = new InboundEmail(); |
|
653 | + $inboundEmail = new InboundEmail(); |
|
654 | 654 | |
655 | - $inboundEmail->id = 1; |
|
655 | + $inboundEmail->id = 1; |
|
656 | 656 | |
657 | - $result = $inboundEmail->pop3_getCacheUidls(); |
|
657 | + $result = $inboundEmail->pop3_getCacheUidls(); |
|
658 | 658 | |
659 | - $this->assertEquals(array('1'=>'1'), $result); |
|
659 | + $this->assertEquals(array('1'=>'1'), $result); |
|
660 | 660 | |
661 | 661 | } |
662 | 662 | |
663 | 663 | |
664 | 664 | public function testsetStatuses() { |
665 | 665 | |
666 | - $inboundEmail = new InboundEmail(); |
|
666 | + $inboundEmail = new InboundEmail(); |
|
667 | 667 | |
668 | - $inboundEmail->id = 1; |
|
669 | - $inboundEmail->mailbox = "INBOX"; |
|
668 | + $inboundEmail->id = 1; |
|
669 | + $inboundEmail->mailbox = "INBOX"; |
|
670 | 670 | |
671 | 671 | |
672 | - //execute the method |
|
673 | - $inboundEmail->setStatuses("1", "message_id", "123"); |
|
672 | + //execute the method |
|
673 | + $inboundEmail->setStatuses("1", "message_id", "123"); |
|
674 | 674 | |
675 | 675 | |
676 | - //retrieve back to verify the records created |
|
677 | - $result = $inboundEmail->getCacheValueForUIDs("INBOX", array(1)); |
|
676 | + //retrieve back to verify the records created |
|
677 | + $result = $inboundEmail->getCacheValueForUIDs("INBOX", array(1)); |
|
678 | 678 | |
679 | - $this->assertTrue(is_array($result)); |
|
680 | - $this->assertEquals("123", $result['retArr'][0]->message_id); |
|
679 | + $this->assertTrue(is_array($result)); |
|
680 | + $this->assertEquals("123", $result['retArr'][0]->message_id); |
|
681 | 681 | |
682 | 682 | } |
683 | 683 | |
684 | 684 | |
685 | 685 | public function testdeleteMessageFromCache() { |
686 | 686 | |
687 | - $inboundEmail = new InboundEmail(); |
|
687 | + $inboundEmail = new InboundEmail(); |
|
688 | 688 | |
689 | - $inboundEmail->id = 1; |
|
690 | - $inboundEmail->mailbox = "INBOX"; |
|
691 | - $inboundEmail->protocol = 'pop3'; |
|
689 | + $inboundEmail->id = 1; |
|
690 | + $inboundEmail->mailbox = "INBOX"; |
|
691 | + $inboundEmail->protocol = 'pop3'; |
|
692 | 692 | |
693 | - $inboundEmail->deleteMessageFromCache("123"); |
|
693 | + $inboundEmail->deleteMessageFromCache("123"); |
|
694 | 694 | |
695 | - //retrieve back to verify the records deleted |
|
696 | - $result = $inboundEmail->getCacheValueForUIDs("INBOX", array(1)); |
|
695 | + //retrieve back to verify the records deleted |
|
696 | + $result = $inboundEmail->getCacheValueForUIDs("INBOX", array(1)); |
|
697 | 697 | |
698 | - $this->assertTrue(is_array($result)); |
|
699 | - $this->assertEquals(0, count($result['retArr'])); |
|
698 | + $this->assertTrue(is_array($result)); |
|
699 | + $this->assertEquals(0, count($result['retArr'])); |
|
700 | 700 | |
701 | 701 | |
702 | 702 | } |
@@ -704,1423 +704,1423 @@ discard block |
||
704 | 704 | |
705 | 705 | public function testemptyTrash() { |
706 | 706 | |
707 | - $inboundEmail = new InboundEmail(); |
|
707 | + $inboundEmail = new InboundEmail(); |
|
708 | 708 | |
709 | - $inboundEmail->id = 1; |
|
709 | + $inboundEmail->id = 1; |
|
710 | 710 | |
711 | - $inboundEmail->emptyTrash(); |
|
711 | + $inboundEmail->emptyTrash(); |
|
712 | 712 | |
713 | - $result = $inboundEmail->getCacheValue("INBOX.Trash"); |
|
714 | - $this->assertEquals(0, count($result['retArr'])); |
|
713 | + $result = $inboundEmail->getCacheValue("INBOX.Trash"); |
|
714 | + $this->assertEquals(0, count($result['retArr'])); |
|
715 | 715 | |
716 | 716 | } |
717 | 717 | |
718 | - public function testdeleteCache() { |
|
718 | + public function testdeleteCache() { |
|
719 | 719 | |
720 | - $inboundEmail = new InboundEmail(); |
|
720 | + $inboundEmail = new InboundEmail(); |
|
721 | 721 | |
722 | - $inboundEmail->id = 1; |
|
722 | + $inboundEmail->id = 1; |
|
723 | 723 | |
724 | - $inboundEmail->deleteCache(); |
|
724 | + $inboundEmail->deleteCache(); |
|
725 | 725 | |
726 | - $result = $inboundEmail->getCacheValue("INBOX"); |
|
727 | - $this->assertEquals(0, count($result['retArr'])); |
|
726 | + $result = $inboundEmail->getCacheValue("INBOX"); |
|
727 | + $this->assertEquals(0, count($result['retArr'])); |
|
728 | 728 | |
729 | - } |
|
729 | + } |
|
730 | 730 | |
731 | 731 | |
732 | - public function testdeletePop3Cache() { |
|
732 | + public function testdeletePop3Cache() { |
|
733 | 733 | |
734 | - $inboundEmail = new InboundEmail(); |
|
734 | + $inboundEmail = new InboundEmail(); |
|
735 | 735 | |
736 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
736 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
737 | 737 | |
738 | - //execute the method and test if it works and does not throws an exception. |
|
739 | - try { |
|
740 | - $inboundEmail->deletePop3Cache(); |
|
741 | - $this->assertTrue(true); |
|
742 | - } |
|
743 | - catch (Exception $e) { |
|
744 | - $this->fail(); |
|
745 | - } |
|
738 | + //execute the method and test if it works and does not throws an exception. |
|
739 | + try { |
|
740 | + $inboundEmail->deletePop3Cache(); |
|
741 | + $this->assertTrue(true); |
|
742 | + } |
|
743 | + catch (Exception $e) { |
|
744 | + $this->fail(); |
|
745 | + } |
|
746 | 746 | |
747 | 747 | |
748 | - } |
|
748 | + } |
|
749 | 749 | |
750 | - public function testpop3_open() { |
|
750 | + public function testpop3_open() { |
|
751 | 751 | |
752 | - $inboundEmail = new InboundEmail(); |
|
752 | + $inboundEmail = new InboundEmail(); |
|
753 | 753 | |
754 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
754 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
755 | 755 | |
756 | - $result = $inboundEmail->pop3_open(); |
|
756 | + $result = $inboundEmail->pop3_open(); |
|
757 | 757 | |
758 | - $this->assertEquals(false, $result); |
|
758 | + $this->assertEquals(false, $result); |
|
759 | 759 | |
760 | - } |
|
760 | + } |
|
761 | 761 | |
762 | 762 | |
763 | - public function testpop3_cleanUp() { |
|
763 | + public function testpop3_cleanUp() { |
|
764 | 764 | |
765 | - $inboundEmail = new InboundEmail(); |
|
765 | + $inboundEmail = new InboundEmail(); |
|
766 | 766 | |
767 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
767 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
768 | 768 | |
769 | - //execute the method and test if it works and does not throws an exception. |
|
770 | - try { |
|
771 | - $inboundEmail->pop3_cleanUp(); |
|
772 | - $this->assertTrue(true); |
|
773 | - } |
|
774 | - catch (Exception $e) { |
|
775 | - $this->fail(); |
|
776 | - } |
|
769 | + //execute the method and test if it works and does not throws an exception. |
|
770 | + try { |
|
771 | + $inboundEmail->pop3_cleanUp(); |
|
772 | + $this->assertTrue(true); |
|
773 | + } |
|
774 | + catch (Exception $e) { |
|
775 | + $this->fail(); |
|
776 | + } |
|
777 | 777 | |
778 | - } |
|
778 | + } |
|
779 | 779 | |
780 | 780 | |
781 | - public function testpop3_sendCommand() { |
|
781 | + public function testpop3_sendCommand() { |
|
782 | 782 | |
783 | - $inboundEmail = new InboundEmail(); |
|
783 | + $inboundEmail = new InboundEmail(); |
|
784 | 784 | |
785 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
785 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
786 | 786 | |
787 | - $result = $inboundEmail->pop3_sendCommand("get"); |
|
787 | + $result = $inboundEmail->pop3_sendCommand("get"); |
|
788 | 788 | |
789 | - $this->assertEquals("", $result); |
|
789 | + $this->assertEquals("", $result); |
|
790 | 790 | |
791 | - } |
|
791 | + } |
|
792 | 792 | |
793 | - public function testgetPop3NewMessagesToDownload() { |
|
793 | + public function testgetPop3NewMessagesToDownload() { |
|
794 | 794 | |
795 | - $inboundEmail = new InboundEmail(); |
|
795 | + $inboundEmail = new InboundEmail(); |
|
796 | 796 | |
797 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
797 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
798 | 798 | |
799 | - $result = $inboundEmail->getPop3NewMessagesToDownload(); |
|
799 | + $result = $inboundEmail->getPop3NewMessagesToDownload(); |
|
800 | 800 | |
801 | - $this->assertTrue(is_array($result)); |
|
801 | + $this->assertTrue(is_array($result)); |
|
802 | 802 | |
803 | 803 | |
804 | - } |
|
804 | + } |
|
805 | 805 | |
806 | - public function testgetPop3NewMessagesToDownloadForCron() { |
|
806 | + public function testgetPop3NewMessagesToDownloadForCron() { |
|
807 | 807 | |
808 | - $inboundEmail = new InboundEmail(); |
|
808 | + $inboundEmail = new InboundEmail(); |
|
809 | 809 | |
810 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
810 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
811 | 811 | |
812 | - $result = $inboundEmail->getPop3NewMessagesToDownloadForCron(); |
|
812 | + $result = $inboundEmail->getPop3NewMessagesToDownloadForCron(); |
|
813 | 813 | |
814 | - $this->assertTrue(is_array($result)); |
|
814 | + $this->assertTrue(is_array($result)); |
|
815 | 815 | |
816 | - } |
|
816 | + } |
|
817 | 817 | |
818 | 818 | |
819 | - public function testpop3_getUIDL() { |
|
819 | + public function testpop3_getUIDL() { |
|
820 | 820 | |
821 | - $inboundEmail = new InboundEmail(); |
|
821 | + $inboundEmail = new InboundEmail(); |
|
822 | 822 | |
823 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
824 | - $inboundEmail->protocol = 'pop3'; |
|
823 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
824 | + $inboundEmail->protocol = 'pop3'; |
|
825 | 825 | |
826 | - $result = $inboundEmail->getPop3NewMessagesToDownloadForCron(); |
|
826 | + $result = $inboundEmail->getPop3NewMessagesToDownloadForCron(); |
|
827 | 827 | |
828 | - $this->assertTrue(is_array($result)); |
|
828 | + $this->assertTrue(is_array($result)); |
|
829 | 829 | |
830 | - } |
|
830 | + } |
|
831 | 831 | |
832 | 832 | |
833 | - public function testpop3_checkPartialEmail() { |
|
833 | + public function testpop3_checkPartialEmail() { |
|
834 | 834 | |
835 | - $inboundEmail = new InboundEmail(); |
|
835 | + $inboundEmail = new InboundEmail(); |
|
836 | 836 | |
837 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
838 | - $inboundEmail->protocol = 'pop3'; |
|
837 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
838 | + $inboundEmail->protocol = 'pop3'; |
|
839 | 839 | |
840 | - //execute the method and test if it works and does not throws an exception. |
|
841 | - try { |
|
840 | + //execute the method and test if it works and does not throws an exception. |
|
841 | + try { |
|
842 | 842 | |
843 | - $result = $inboundEmail->pop3_checkPartialEmail(); |
|
844 | - $this->assertEquals("could not open socket connection to POP3 server", $result); |
|
843 | + $result = $inboundEmail->pop3_checkPartialEmail(); |
|
844 | + $this->assertEquals("could not open socket connection to POP3 server", $result); |
|
845 | 845 | |
846 | - $this->assertTrue(true); |
|
847 | - } |
|
848 | - catch (Exception $e) { |
|
849 | - $this->fail(); |
|
850 | - } |
|
846 | + $this->assertTrue(true); |
|
847 | + } |
|
848 | + catch (Exception $e) { |
|
849 | + $this->fail(); |
|
850 | + } |
|
851 | 851 | |
852 | - } |
|
852 | + } |
|
853 | 853 | |
854 | 854 | |
855 | 855 | |
856 | - public function testpop3_checkEmail() { |
|
856 | + public function testpop3_checkEmail() { |
|
857 | 857 | |
858 | - $inboundEmail = new InboundEmail(); |
|
858 | + $inboundEmail = new InboundEmail(); |
|
859 | 859 | |
860 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
861 | - $inboundEmail->protocol = 'pop3'; |
|
860 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
861 | + $inboundEmail->protocol = 'pop3'; |
|
862 | 862 | |
863 | - //execute the method and test if it works and does not throws an exception. |
|
864 | - try { |
|
863 | + //execute the method and test if it works and does not throws an exception. |
|
864 | + try { |
|
865 | 865 | |
866 | - $result = $inboundEmail->pop3_checkEmail(); |
|
867 | - $this->assertEquals(false, $result); |
|
866 | + $result = $inboundEmail->pop3_checkEmail(); |
|
867 | + $this->assertEquals(false, $result); |
|
868 | 868 | |
869 | - $this->assertTrue(true); |
|
870 | - } |
|
871 | - catch (Exception $e) { |
|
872 | - $this->fail(); |
|
873 | - } |
|
869 | + $this->assertTrue(true); |
|
870 | + } |
|
871 | + catch (Exception $e) { |
|
872 | + $this->fail(); |
|
873 | + } |
|
874 | 874 | |
875 | 875 | |
876 | - } |
|
876 | + } |
|
877 | 877 | |
878 | - public function testgetMessagesInEmailCache() { |
|
878 | + public function testgetMessagesInEmailCache() { |
|
879 | 879 | |
880 | 880 | |
881 | - $inboundEmail = new InboundEmail(); |
|
881 | + $inboundEmail = new InboundEmail(); |
|
882 | 882 | |
883 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
884 | - |
|
885 | - //test for IMAP |
|
886 | - //execute the method and test if it works and does not throws an exception. |
|
887 | - try { |
|
888 | - |
|
889 | - $result = $inboundEmail->getMessagesInEmailCache(0, 1); |
|
890 | - $this->assertTrue(true); |
|
891 | - } |
|
892 | - catch (Exception $e) { |
|
893 | - $this->fail(); |
|
894 | - } |
|
895 | - |
|
896 | - |
|
897 | - //test for pop3 |
|
898 | - $inboundEmail->protocol = 'pop3'; |
|
899 | - //execute the method and test if it works and does not throws an exception. |
|
900 | - try { |
|
901 | - $result = $inboundEmail->getMessagesInEmailCache(1, 0); |
|
902 | - $this->assertTrue(true); |
|
903 | - } |
|
904 | - catch (Exception $e) { |
|
905 | - $this->fail(); |
|
906 | - } |
|
883 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
884 | + |
|
885 | + //test for IMAP |
|
886 | + //execute the method and test if it works and does not throws an exception. |
|
887 | + try { |
|
888 | + |
|
889 | + $result = $inboundEmail->getMessagesInEmailCache(0, 1); |
|
890 | + $this->assertTrue(true); |
|
891 | + } |
|
892 | + catch (Exception $e) { |
|
893 | + $this->fail(); |
|
894 | + } |
|
895 | + |
|
896 | + |
|
897 | + //test for pop3 |
|
898 | + $inboundEmail->protocol = 'pop3'; |
|
899 | + //execute the method and test if it works and does not throws an exception. |
|
900 | + try { |
|
901 | + $result = $inboundEmail->getMessagesInEmailCache(1, 0); |
|
902 | + $this->assertTrue(true); |
|
903 | + } |
|
904 | + catch (Exception $e) { |
|
905 | + $this->fail(); |
|
906 | + } |
|
907 | 907 | |
908 | - } |
|
908 | + } |
|
909 | 909 | |
910 | 910 | |
911 | - public function testcheckEmailOneMailbox() { |
|
911 | + public function testcheckEmailOneMailbox() { |
|
912 | 912 | |
913 | - $inboundEmail = new InboundEmail(); |
|
913 | + $inboundEmail = new InboundEmail(); |
|
914 | 914 | |
915 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
915 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
916 | 916 | |
917 | - $result = $inboundEmail->checkEmailOneMailbox("INBOX"); |
|
918 | - $this->assertEquals(1,$result); |
|
917 | + $result = $inboundEmail->checkEmailOneMailbox("INBOX"); |
|
918 | + $this->assertEquals(1,$result); |
|
919 | 919 | |
920 | - } |
|
920 | + } |
|
921 | 921 | |
922 | 922 | |
923 | 923 | public function testcheckEmailOneMailboxPartial() { |
924 | 924 | |
925 | - $inboundEmail = new InboundEmail(); |
|
925 | + $inboundEmail = new InboundEmail(); |
|
926 | 926 | |
927 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
927 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
928 | 928 | |
929 | - $result = $inboundEmail->checkEmailOneMailboxPartial("INBOX"); |
|
929 | + $result = $inboundEmail->checkEmailOneMailboxPartial("INBOX"); |
|
930 | 930 | |
931 | - $this->assertEquals(array("status"=> "done"), $result); |
|
931 | + $this->assertEquals(array("status"=> "done"), $result); |
|
932 | 932 | |
933 | 933 | } |
934 | 934 | |
935 | 935 | public function testgetCachedIMAPSearch() { |
936 | 936 | |
937 | - $inboundEmail = new InboundEmail(); |
|
937 | + $inboundEmail = new InboundEmail(); |
|
938 | 938 | |
939 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
939 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
940 | 940 | |
941 | - $result = $inboundEmail->getCachedIMAPSearch("test"); |
|
941 | + $result = $inboundEmail->getCachedIMAPSearch("test"); |
|
942 | 942 | |
943 | - $this->assertTrue(is_array($result)); |
|
943 | + $this->assertTrue(is_array($result)); |
|
944 | 944 | |
945 | 945 | } |
946 | 946 | |
947 | 947 | public function testcheckEmailIMAPPartial() { |
948 | 948 | |
949 | - $inboundEmail = new InboundEmail(); |
|
949 | + $inboundEmail = new InboundEmail(); |
|
950 | 950 | |
951 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
951 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
952 | 952 | |
953 | - $result = $inboundEmail->checkEmailIMAPPartial(); |
|
953 | + $result = $inboundEmail->checkEmailIMAPPartial(); |
|
954 | 954 | |
955 | - $this->assertTrue(is_array($result)); |
|
955 | + $this->assertTrue(is_array($result)); |
|
956 | 956 | |
957 | - } |
|
957 | + } |
|
958 | 958 | |
959 | - public function testcheckEmail2_meta() { |
|
959 | + public function testcheckEmail2_meta() { |
|
960 | 960 | |
961 | - $inboundEmail = new InboundEmail(); |
|
961 | + $inboundEmail = new InboundEmail(); |
|
962 | 962 | |
963 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
963 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
964 | 964 | |
965 | - $result = $inboundEmail->checkEmail2_meta(); |
|
965 | + $result = $inboundEmail->checkEmail2_meta(); |
|
966 | 966 | |
967 | - $this->assertTrue(is_array($result)); |
|
968 | - $this->assertEquals(array("mailboxes"=>array("INBOX" => 0), "processCount" => 0), $result); |
|
967 | + $this->assertTrue(is_array($result)); |
|
968 | + $this->assertEquals(array("mailboxes"=>array("INBOX" => 0), "processCount" => 0), $result); |
|
969 | 969 | |
970 | - } |
|
970 | + } |
|
971 | 971 | |
972 | - public function testgetMailboxProcessCount() { |
|
972 | + public function testgetMailboxProcessCount() { |
|
973 | 973 | |
974 | - $inboundEmail = new InboundEmail(); |
|
974 | + $inboundEmail = new InboundEmail(); |
|
975 | 975 | |
976 | - $result = $inboundEmail->getMailboxProcessCount("INBOX"); |
|
976 | + $result = $inboundEmail->getMailboxProcessCount("INBOX"); |
|
977 | 977 | |
978 | - $this->assertEquals(0, $result); |
|
978 | + $this->assertEquals(0, $result); |
|
979 | 979 | |
980 | - } |
|
980 | + } |
|
981 | 981 | |
982 | - public function testcheckEmail() { |
|
982 | + public function testcheckEmail() { |
|
983 | 983 | |
984 | - $inboundEmail = new InboundEmail(); |
|
984 | + $inboundEmail = new InboundEmail(); |
|
985 | 985 | |
986 | - //test for IMAP |
|
987 | - //execute the method and test if it works and does not throws an exception. |
|
988 | - try { |
|
989 | - $inboundEmail->checkEmail("INBOX"); |
|
990 | - $this->assertTrue(true); |
|
991 | - } |
|
992 | - catch (Exception $e) { |
|
993 | - $this->fail(); |
|
994 | - } |
|
995 | - |
|
996 | - |
|
997 | - //test for pop3 |
|
998 | - $inboundEmail->protocol = 'pop3'; |
|
999 | - |
|
1000 | - //execute the method and test if it works and does not throws an exception. |
|
1001 | - try { |
|
1002 | - $inboundEmail->checkEmail("INBOX"); |
|
1003 | - $this->assertTrue(true); |
|
1004 | - } |
|
1005 | - catch (Exception $e) { |
|
1006 | - $this->fail(); |
|
1007 | - } |
|
986 | + //test for IMAP |
|
987 | + //execute the method and test if it works and does not throws an exception. |
|
988 | + try { |
|
989 | + $inboundEmail->checkEmail("INBOX"); |
|
990 | + $this->assertTrue(true); |
|
991 | + } |
|
992 | + catch (Exception $e) { |
|
993 | + $this->fail(); |
|
994 | + } |
|
995 | + |
|
996 | + |
|
997 | + //test for pop3 |
|
998 | + $inboundEmail->protocol = 'pop3'; |
|
999 | + |
|
1000 | + //execute the method and test if it works and does not throws an exception. |
|
1001 | + try { |
|
1002 | + $inboundEmail->checkEmail("INBOX"); |
|
1003 | + $this->assertTrue(true); |
|
1004 | + } |
|
1005 | + catch (Exception $e) { |
|
1006 | + $this->fail(); |
|
1007 | + } |
|
1008 | 1008 | |
1009 | - } |
|
1009 | + } |
|
1010 | 1010 | |
1011 | 1011 | |
1012 | - public function testsyncEmail() { |
|
1012 | + public function testsyncEmail() { |
|
1013 | 1013 | |
1014 | - global $current_user; |
|
1015 | - $current_user = new User("1"); |
|
1014 | + global $current_user; |
|
1015 | + $current_user = new User("1"); |
|
1016 | 1016 | |
1017 | - $inboundEmail = new InboundEmail(); |
|
1017 | + $inboundEmail = new InboundEmail(); |
|
1018 | 1018 | |
1019 | - //execute the method and test if it works and does not throws an exception. |
|
1020 | - try { |
|
1021 | - $inboundEmail->syncEmail(); |
|
1022 | - $this->assertTrue(true); |
|
1023 | - } |
|
1024 | - catch (Exception $e) { |
|
1025 | - $this->fail(); |
|
1026 | - } |
|
1019 | + //execute the method and test if it works and does not throws an exception. |
|
1020 | + try { |
|
1021 | + $inboundEmail->syncEmail(); |
|
1022 | + $this->assertTrue(true); |
|
1023 | + } |
|
1024 | + catch (Exception $e) { |
|
1025 | + $this->fail(); |
|
1026 | + } |
|
1027 | 1027 | |
1028 | - } |
|
1028 | + } |
|
1029 | 1029 | |
1030 | 1030 | |
1031 | 1031 | |
1032 | - public function testdeleteCachedMessages() { |
|
1032 | + public function testdeleteCachedMessages() { |
|
1033 | 1033 | |
1034 | - $inboundEmail = new InboundEmail(); |
|
1034 | + $inboundEmail = new InboundEmail(); |
|
1035 | 1035 | |
1036 | - $inboundEmail->id = 1; |
|
1036 | + $inboundEmail->id = 1; |
|
1037 | 1037 | |
1038 | - //execute the method and test if it works and does not throws an exception. |
|
1039 | - try { |
|
1040 | - $inboundEmail->deleteCachedMessages("1,2", "test"); |
|
1041 | - $this->assertTrue(true); |
|
1042 | - } |
|
1043 | - catch (Exception $e) { |
|
1044 | - $this->fail(); |
|
1045 | - } |
|
1038 | + //execute the method and test if it works and does not throws an exception. |
|
1039 | + try { |
|
1040 | + $inboundEmail->deleteCachedMessages("1,2", "test"); |
|
1041 | + $this->assertTrue(true); |
|
1042 | + } |
|
1043 | + catch (Exception $e) { |
|
1044 | + $this->fail(); |
|
1045 | + } |
|
1046 | 1046 | |
1047 | - } |
|
1047 | + } |
|
1048 | 1048 | |
1049 | 1049 | |
1050 | - public function testgetOverviewsFromCacheFile() { |
|
1050 | + public function testgetOverviewsFromCacheFile() { |
|
1051 | 1051 | |
1052 | - $inboundEmail = new InboundEmail(); |
|
1052 | + $inboundEmail = new InboundEmail(); |
|
1053 | 1053 | |
1054 | - $result = $inboundEmail->getOverviewsFromCacheFile("1,2", "INBOX"); |
|
1054 | + $result = $inboundEmail->getOverviewsFromCacheFile("1,2", "INBOX"); |
|
1055 | 1055 | |
1056 | - $this->assertTrue(is_array($result)); |
|
1056 | + $this->assertTrue(is_array($result)); |
|
1057 | 1057 | |
1058 | - } |
|
1058 | + } |
|
1059 | 1059 | |
1060 | 1060 | |
1061 | - public function testupdateOverviewCacheFile() { |
|
1061 | + public function testupdateOverviewCacheFile() { |
|
1062 | 1062 | |
1063 | - $inboundEmail = new InboundEmail(); |
|
1063 | + $inboundEmail = new InboundEmail(); |
|
1064 | 1064 | |
1065 | - $inboundEmail->id = 1; |
|
1066 | - $inboundEmail->mailbox = "INBOX"; |
|
1065 | + $inboundEmail->id = 1; |
|
1066 | + $inboundEmail->mailbox = "INBOX"; |
|
1067 | 1067 | |
1068 | - $overview = new Overview(); |
|
1069 | - $overview->subject = "subject 1"; |
|
1070 | - $overview->size = "10001"; |
|
1071 | - $overview->uid = "1"; |
|
1068 | + $overview = new Overview(); |
|
1069 | + $overview->subject = "subject 1"; |
|
1070 | + $overview->size = "10001"; |
|
1071 | + $overview->uid = "1"; |
|
1072 | 1072 | |
1073 | - $overviews = array($overview); |
|
1073 | + $overviews = array($overview); |
|
1074 | 1074 | |
1075 | - $inboundEmail->updateOverviewCacheFile($overviews); |
|
1075 | + $inboundEmail->updateOverviewCacheFile($overviews); |
|
1076 | 1076 | |
1077 | 1077 | |
1078 | - //retrieve back to verify the records created |
|
1079 | - $result = $inboundEmail->getCacheValue("INBOX"); |
|
1080 | - $this->assertGreaterThan(0, count($result['retArr'][0])); |
|
1081 | - $this->assertEquals("subject 1", $result['retArr'][0]->subject); |
|
1078 | + //retrieve back to verify the records created |
|
1079 | + $result = $inboundEmail->getCacheValue("INBOX"); |
|
1080 | + $this->assertGreaterThan(0, count($result['retArr'][0])); |
|
1081 | + $this->assertEquals("subject 1", $result['retArr'][0]->subject); |
|
1082 | 1082 | |
1083 | - } |
|
1083 | + } |
|
1084 | 1084 | |
1085 | 1085 | |
1086 | - public function testsetReadFlagOnFolderCache() { |
|
1086 | + public function testsetReadFlagOnFolderCache() { |
|
1087 | 1087 | |
1088 | - $inboundEmail = new InboundEmail(); |
|
1088 | + $inboundEmail = new InboundEmail(); |
|
1089 | 1089 | |
1090 | - $inboundEmail->id = 1; |
|
1090 | + $inboundEmail->id = 1; |
|
1091 | 1091 | |
1092 | - $inboundEmail->setReadFlagOnFolderCache("INBOX", "1"); |
|
1092 | + $inboundEmail->setReadFlagOnFolderCache("INBOX", "1"); |
|
1093 | 1093 | |
1094 | - //retrieve back to verify the records updated |
|
1095 | - $result = $inboundEmail->getCacheValue("INBOX"); |
|
1096 | - $this->assertEquals(0, $result['retArr'][0]->seen); |
|
1094 | + //retrieve back to verify the records updated |
|
1095 | + $result = $inboundEmail->getCacheValue("INBOX"); |
|
1096 | + $this->assertEquals(0, $result['retArr'][0]->seen); |
|
1097 | 1097 | |
1098 | - } |
|
1098 | + } |
|
1099 | 1099 | |
1100 | - public function testfetchCheckedEmails() { |
|
1100 | + public function testfetchCheckedEmails() { |
|
1101 | 1101 | |
1102 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1103 | - global $db; |
|
1104 | - unset ($db->database); |
|
1105 | - $db->checkConnection(); |
|
1102 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1103 | + global $db; |
|
1104 | + unset ($db->database); |
|
1105 | + $db->checkConnection(); |
|
1106 | 1106 | |
1107 | 1107 | |
1108 | - $inboundEmail = new InboundEmail(); |
|
1108 | + $inboundEmail = new InboundEmail(); |
|
1109 | 1109 | |
1110 | - $inboundEmail->id = 1; |
|
1111 | - $inboundEmail->mailbox = "INBOX"; |
|
1110 | + $inboundEmail->id = 1; |
|
1111 | + $inboundEmail->mailbox = "INBOX"; |
|
1112 | 1112 | |
1113 | 1113 | |
1114 | - //test with size over 1000 and no imap_uid |
|
1115 | - $overview1 = new Overview(); |
|
1116 | - $overview1->subject = "subject 1"; |
|
1117 | - $overview1->size = "10001"; |
|
1114 | + //test with size over 1000 and no imap_uid |
|
1115 | + $overview1 = new Overview(); |
|
1116 | + $overview1->subject = "subject 1"; |
|
1117 | + $overview1->size = "10001"; |
|
1118 | 1118 | |
1119 | - $fetchedOverviews = array($overview1); |
|
1120 | - $result = $inboundEmail->fetchCheckedEmails($fetchedOverviews); |
|
1119 | + $fetchedOverviews = array($overview1); |
|
1120 | + $result = $inboundEmail->fetchCheckedEmails($fetchedOverviews); |
|
1121 | 1121 | |
1122 | - $this->assertEquals(false, $result); |
|
1122 | + $this->assertEquals(false, $result); |
|
1123 | 1123 | |
1124 | 1124 | |
1125 | 1125 | |
1126 | - //test with size less than 1000 and imap_uid set |
|
1127 | - $overview2 = new Overview(); |
|
1128 | - $overview2->subject = "subject 2"; |
|
1129 | - $overview2->size = "100"; |
|
1130 | - //$overview2->imap_uid = 1; //dies if imap_uid is set |
|
1126 | + //test with size less than 1000 and imap_uid set |
|
1127 | + $overview2 = new Overview(); |
|
1128 | + $overview2->subject = "subject 2"; |
|
1129 | + $overview2->size = "100"; |
|
1130 | + //$overview2->imap_uid = 1; //dies if imap_uid is set |
|
1131 | 1131 | |
1132 | - $fetchedOverviews = array($overview2); |
|
1133 | - $result = $inboundEmail->fetchCheckedEmails($fetchedOverviews); |
|
1132 | + $fetchedOverviews = array($overview2); |
|
1133 | + $result = $inboundEmail->fetchCheckedEmails($fetchedOverviews); |
|
1134 | 1134 | |
1135 | - $this->assertEquals(true, $result); |
|
1135 | + $this->assertEquals(true, $result); |
|
1136 | 1136 | |
1137 | - } |
|
1137 | + } |
|
1138 | 1138 | |
1139 | 1139 | |
1140 | - public function testmarkEmails() { |
|
1140 | + public function testmarkEmails() { |
|
1141 | 1141 | |
1142 | - $inboundEmail = new InboundEmail(); |
|
1142 | + $inboundEmail = new InboundEmail(); |
|
1143 | 1143 | |
1144 | - //execute the method and test if it works and does not throws an exception. |
|
1145 | - try { |
|
1144 | + //execute the method and test if it works and does not throws an exception. |
|
1145 | + try { |
|
1146 | 1146 | |
1147 | - $inboundEmail->markEmails('1','unread'); |
|
1148 | - $inboundEmail->markEmails('1','read'); |
|
1149 | - $inboundEmail->markEmails('1','flagged'); |
|
1150 | - $inboundEmail->markEmails('1','unflagged'); |
|
1151 | - $inboundEmail->markEmails('1','answered'); |
|
1147 | + $inboundEmail->markEmails('1','unread'); |
|
1148 | + $inboundEmail->markEmails('1','read'); |
|
1149 | + $inboundEmail->markEmails('1','flagged'); |
|
1150 | + $inboundEmail->markEmails('1','unflagged'); |
|
1151 | + $inboundEmail->markEmails('1','answered'); |
|
1152 | 1152 | |
1153 | - $this->assertTrue(true); |
|
1154 | - } |
|
1155 | - catch (Exception $e) { |
|
1156 | - $this->fail(); |
|
1157 | - } |
|
1153 | + $this->assertTrue(true); |
|
1154 | + } |
|
1155 | + catch (Exception $e) { |
|
1156 | + $this->fail(); |
|
1157 | + } |
|
1158 | 1158 | |
1159 | - } |
|
1159 | + } |
|
1160 | 1160 | |
1161 | - public function testdeleteFolder() { |
|
1161 | + public function testdeleteFolder() { |
|
1162 | 1162 | |
1163 | - $inboundEmail = new InboundEmail(); |
|
1163 | + $inboundEmail = new InboundEmail(); |
|
1164 | 1164 | |
1165 | - $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
1165 | + $inboundEmail->mailbox = "INBOX,OUTBOX"; |
|
1166 | 1166 | |
1167 | - $result = $inboundEmail->deleteFolder("INBOX"); |
|
1167 | + $result = $inboundEmail->deleteFolder("INBOX"); |
|
1168 | 1168 | |
1169 | - $this->assertTrue(is_array($result)); |
|
1169 | + $this->assertTrue(is_array($result)); |
|
1170 | 1170 | |
1171 | - } |
|
1171 | + } |
|
1172 | 1172 | |
1173 | 1173 | |
1174 | - public function testsaveNewFolder() { |
|
1174 | + public function testsaveNewFolder() { |
|
1175 | 1175 | |
1176 | - $inboundEmail = new InboundEmail(); |
|
1176 | + $inboundEmail = new InboundEmail(); |
|
1177 | 1177 | |
1178 | - $result = $inboundEmail->saveNewFolder("TEST","INBOX"); |
|
1178 | + $result = $inboundEmail->saveNewFolder("TEST","INBOX"); |
|
1179 | 1179 | |
1180 | - $this->assertEquals(false, $result); |
|
1181 | - } |
|
1180 | + $this->assertEquals(false, $result); |
|
1181 | + } |
|
1182 | 1182 | |
1183 | 1183 | |
1184 | - public function testgetImapMboxFromSugarProprietary() { |
|
1184 | + public function testgetImapMboxFromSugarProprietary() { |
|
1185 | 1185 | |
1186 | - $inboundEmail = new InboundEmail(); |
|
1186 | + $inboundEmail = new InboundEmail(); |
|
1187 | 1187 | |
1188 | - //test with invalid format string |
|
1189 | - $result = $inboundEmail->getImapMboxFromSugarProprietary("INBOX.TRASH"); |
|
1190 | - $this->assertEquals("", $result); |
|
1188 | + //test with invalid format string |
|
1189 | + $result = $inboundEmail->getImapMboxFromSugarProprietary("INBOX.TRASH"); |
|
1190 | + $this->assertEquals("", $result); |
|
1191 | 1191 | |
1192 | 1192 | |
1193 | - //test with valid format but shorter string |
|
1194 | - $result = $inboundEmail->getImapMboxFromSugarProprietary("INBOX::TRASH"); |
|
1195 | - $this->assertEquals("", $result); |
|
1193 | + //test with valid format but shorter string |
|
1194 | + $result = $inboundEmail->getImapMboxFromSugarProprietary("INBOX::TRASH"); |
|
1195 | + $this->assertEquals("", $result); |
|
1196 | 1196 | |
1197 | 1197 | |
1198 | - //test with valid format longer string |
|
1199 | - $result = $inboundEmail->getImapMboxFromSugarProprietary("INBOX::TRASH::TEST"); |
|
1200 | - $this->assertEquals("TEST", $result); |
|
1201 | - } |
|
1198 | + //test with valid format longer string |
|
1199 | + $result = $inboundEmail->getImapMboxFromSugarProprietary("INBOX::TRASH::TEST"); |
|
1200 | + $this->assertEquals("TEST", $result); |
|
1201 | + } |
|
1202 | 1202 | |
1203 | 1203 | |
1204 | - public function testrepairAccount() { |
|
1204 | + public function testrepairAccount() { |
|
1205 | 1205 | |
1206 | - $inboundEmail = new InboundEmail(); |
|
1206 | + $inboundEmail = new InboundEmail(); |
|
1207 | 1207 | |
1208 | - $inboundEmail->email_password = "test_pass"; |
|
1208 | + $inboundEmail->email_password = "test_pass"; |
|
1209 | 1209 | |
1210 | - $result = $inboundEmail->repairAccount(); |
|
1210 | + $result = $inboundEmail->repairAccount(); |
|
1211 | 1211 | |
1212 | - $this->assertEquals(false, $result); |
|
1212 | + $this->assertEquals(false, $result); |
|
1213 | 1213 | |
1214 | - } |
|
1214 | + } |
|
1215 | 1215 | |
1216 | 1216 | |
1217 | - public function testgetTeamSetIdForTeams() { |
|
1217 | + public function testgetTeamSetIdForTeams() { |
|
1218 | 1218 | |
1219 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1220 | - global $db; |
|
1221 | - unset ($db->database); |
|
1222 | - $db->checkConnection(); |
|
1219 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1220 | + global $db; |
|
1221 | + unset ($db->database); |
|
1222 | + $db->checkConnection(); |
|
1223 | 1223 | |
1224 | - $inboundEmail = new InboundEmail(); |
|
1224 | + $inboundEmail = new InboundEmail(); |
|
1225 | 1225 | |
1226 | - //$result = $inboundEmail->getTeamSetIdForTeams("1"); |
|
1226 | + //$result = $inboundEmail->getTeamSetIdForTeams("1"); |
|
1227 | 1227 | |
1228 | - //test for record ID to verify that record is saved |
|
1229 | - //$this->assertTrue(isset($result)); |
|
1230 | - //$this->assertEquals(36, strlen($result)); |
|
1228 | + //test for record ID to verify that record is saved |
|
1229 | + //$this->assertTrue(isset($result)); |
|
1230 | + //$this->assertEquals(36, strlen($result)); |
|
1231 | 1231 | |
1232 | - $this->markTestIncomplete("Fatal error: Class 'Team' not found"); |
|
1233 | - } |
|
1232 | + $this->markTestIncomplete("Fatal error: Class 'Team' not found"); |
|
1233 | + } |
|
1234 | 1234 | |
1235 | 1235 | |
1236 | - public function testsavePersonalEmailAccountAndOthers() { |
|
1236 | + public function testsavePersonalEmailAccountAndOthers() { |
|
1237 | 1237 | |
1238 | - $inboundEmail = new InboundEmail(); |
|
1238 | + $inboundEmail = new InboundEmail(); |
|
1239 | 1239 | |
1240 | - $_REQUEST['ie_name'] = "test"; |
|
1241 | - $_REQUEST['ie_status'] = "Active"; |
|
1242 | - $_REQUEST['server_url'] =""; |
|
1243 | - $_REQUEST['email_user'] = "test"; |
|
1244 | - $_REQUEST['email_password'] = "test_pass"; |
|
1245 | - $_REQUEST['mailbox'] = "INBOX"; |
|
1240 | + $_REQUEST['ie_name'] = "test"; |
|
1241 | + $_REQUEST['ie_status'] = "Active"; |
|
1242 | + $_REQUEST['server_url'] =""; |
|
1243 | + $_REQUEST['email_user'] = "test"; |
|
1244 | + $_REQUEST['email_password'] = "test_pass"; |
|
1245 | + $_REQUEST['mailbox'] = "INBOX"; |
|
1246 | 1246 | |
1247 | 1247 | |
1248 | - $result = $inboundEmail->savePersonalEmailAccount(1, 'admin', true); |
|
1248 | + $result = $inboundEmail->savePersonalEmailAccount(1, 'admin', true); |
|
1249 | 1249 | |
1250 | 1250 | |
1251 | - $this->assertTrue(isset($inboundEmail->id)); |
|
1252 | - $this->assertEquals(36, strlen($inboundEmail->id)); |
|
1251 | + $this->assertTrue(isset($inboundEmail->id)); |
|
1252 | + $this->assertEquals(36, strlen($inboundEmail->id)); |
|
1253 | 1253 | |
1254 | 1254 | |
1255 | - //test handleIsPersonal method |
|
1256 | - $this->handleIsPersonal($inboundEmail->id); |
|
1255 | + //test handleIsPersonal method |
|
1256 | + $this->handleIsPersonal($inboundEmail->id); |
|
1257 | 1257 | |
1258 | 1258 | |
1259 | - //test getUserPersonalAccountCount method |
|
1260 | - $this->getUserPersonalAccountCount(); |
|
1259 | + //test getUserPersonalAccountCount method |
|
1260 | + $this->getUserPersonalAccountCount(); |
|
1261 | 1261 | |
1262 | 1262 | |
1263 | - //test retrieveByGroupFolderId method |
|
1264 | - $this->retrieveByGroupFolderId(); |
|
1263 | + //test retrieveByGroupFolderId method |
|
1264 | + $this->retrieveByGroupFolderId(); |
|
1265 | 1265 | |
1266 | 1266 | |
1267 | 1267 | |
1268 | - //test getUserNameFromGroupId method |
|
1269 | - $this->getUserNameFromGroupId($inboundEmail->id); |
|
1268 | + //test getUserNameFromGroupId method |
|
1269 | + $this->getUserNameFromGroupId($inboundEmail->id); |
|
1270 | 1270 | |
1271 | 1271 | |
1272 | - //test deletePersonalEmailAccount method |
|
1273 | - $this->deletePersonalEmailAccount($inboundEmail->id); |
|
1272 | + //test deletePersonalEmailAccount method |
|
1273 | + $this->deletePersonalEmailAccount($inboundEmail->id); |
|
1274 | 1274 | |
1275 | - } |
|
1275 | + } |
|
1276 | 1276 | |
1277 | 1277 | |
1278 | 1278 | |
1279 | - public function handleIsPersonal($id) { |
|
1279 | + public function handleIsPersonal($id) { |
|
1280 | 1280 | |
1281 | - $inboundEmail = new InboundEmail(); |
|
1281 | + $inboundEmail = new InboundEmail(); |
|
1282 | 1282 | |
1283 | 1283 | |
1284 | - //test with a invalid group_id |
|
1285 | - $inboundEmail->group_id = 2; |
|
1286 | - $result = $inboundEmail->handleIsPersonal(); |
|
1287 | - $this->assertEquals(false, $result); |
|
1284 | + //test with a invalid group_id |
|
1285 | + $inboundEmail->group_id = 2; |
|
1286 | + $result = $inboundEmail->handleIsPersonal(); |
|
1287 | + $this->assertEquals(false, $result); |
|
1288 | 1288 | |
1289 | 1289 | |
1290 | - //test with a valid group_id |
|
1291 | - $inboundEmail->retrieve($id); |
|
1292 | - $result = $inboundEmail->handleIsPersonal(); |
|
1293 | - $this->assertEquals(true, $result); |
|
1290 | + //test with a valid group_id |
|
1291 | + $inboundEmail->retrieve($id); |
|
1292 | + $result = $inboundEmail->handleIsPersonal(); |
|
1293 | + $this->assertEquals(true, $result); |
|
1294 | 1294 | |
1295 | - } |
|
1295 | + } |
|
1296 | 1296 | |
1297 | 1297 | |
1298 | - public function getUserPersonalAccountCount() |
|
1299 | - { |
|
1300 | - $inboundEmail = new InboundEmail(); |
|
1298 | + public function getUserPersonalAccountCount() |
|
1299 | + { |
|
1300 | + $inboundEmail = new InboundEmail(); |
|
1301 | 1301 | |
1302 | 1302 | |
1303 | - //test with invalid user id |
|
1304 | - $user = new User(); |
|
1305 | - $result = $inboundEmail->getUserPersonalAccountCount($user); |
|
1306 | - $this->assertEquals(0, $result); |
|
1303 | + //test with invalid user id |
|
1304 | + $user = new User(); |
|
1305 | + $result = $inboundEmail->getUserPersonalAccountCount($user); |
|
1306 | + $this->assertEquals(0, $result); |
|
1307 | 1307 | |
1308 | 1308 | |
1309 | - //test with valid user id |
|
1310 | - $user->id= 1; |
|
1311 | - $result = $inboundEmail->getUserPersonalAccountCount($user); |
|
1312 | - $this->assertGreaterThan(0, $result); |
|
1309 | + //test with valid user id |
|
1310 | + $user->id= 1; |
|
1311 | + $result = $inboundEmail->getUserPersonalAccountCount($user); |
|
1312 | + $this->assertGreaterThan(0, $result); |
|
1313 | 1313 | |
1314 | - } |
|
1314 | + } |
|
1315 | 1315 | |
1316 | - public function retrieveByGroupFolderId() { |
|
1316 | + public function retrieveByGroupFolderId() { |
|
1317 | 1317 | |
1318 | - $inboundEmail = new InboundEmail(); |
|
1318 | + $inboundEmail = new InboundEmail(); |
|
1319 | 1319 | |
1320 | 1320 | |
1321 | - //test with invalid groupfolder id |
|
1322 | - $result = $inboundEmail->retrieveByGroupFolderId("1"); |
|
1321 | + //test with invalid groupfolder id |
|
1322 | + $result = $inboundEmail->retrieveByGroupFolderId("1"); |
|
1323 | 1323 | |
1324 | - $this->assertTrue(is_array($result)); |
|
1325 | - $this->assertEquals(0, count($result)); |
|
1324 | + $this->assertTrue(is_array($result)); |
|
1325 | + $this->assertEquals(0, count($result)); |
|
1326 | 1326 | |
1327 | 1327 | |
1328 | - //test with valid groupfolder id |
|
1329 | - $result = $inboundEmail->retrieveByGroupFolderId(""); |
|
1328 | + //test with valid groupfolder id |
|
1329 | + $result = $inboundEmail->retrieveByGroupFolderId(""); |
|
1330 | 1330 | |
1331 | - $this->assertTrue(is_array($result)); |
|
1332 | - foreach($result as $ie){ |
|
1333 | - $this->assertInstanceOf('InboundEmail',$ie); |
|
1334 | - } |
|
1331 | + $this->assertTrue(is_array($result)); |
|
1332 | + foreach($result as $ie){ |
|
1333 | + $this->assertInstanceOf('InboundEmail',$ie); |
|
1334 | + } |
|
1335 | 1335 | |
1336 | 1336 | |
1337 | - } |
|
1337 | + } |
|
1338 | 1338 | |
1339 | - public function getUserNameFromGroupId($id) { |
|
1339 | + public function getUserNameFromGroupId($id) { |
|
1340 | 1340 | |
1341 | - $inboundEmail = new InboundEmail(); |
|
1341 | + $inboundEmail = new InboundEmail(); |
|
1342 | 1342 | |
1343 | 1343 | |
1344 | - //test with a invalid group_id |
|
1345 | - $inboundEmail->group_id = 2; |
|
1346 | - $result = $inboundEmail->getUserNameFromGroupId(); |
|
1347 | - $this->assertEquals("", $result); |
|
1344 | + //test with a invalid group_id |
|
1345 | + $inboundEmail->group_id = 2; |
|
1346 | + $result = $inboundEmail->getUserNameFromGroupId(); |
|
1347 | + $this->assertEquals("", $result); |
|
1348 | 1348 | |
1349 | 1349 | |
1350 | - //test with a valid group_id |
|
1351 | - $inboundEmail->retrieve($id); |
|
1352 | - $result = $inboundEmail->getUserNameFromGroupId(); |
|
1353 | - $this->assertEquals("admin", $result); |
|
1350 | + //test with a valid group_id |
|
1351 | + $inboundEmail->retrieve($id); |
|
1352 | + $result = $inboundEmail->getUserNameFromGroupId(); |
|
1353 | + $this->assertEquals("admin", $result); |
|
1354 | 1354 | |
1355 | - } |
|
1355 | + } |
|
1356 | 1356 | |
1357 | 1357 | |
1358 | - public function deletePersonalEmailAccount($id) { |
|
1358 | + public function deletePersonalEmailAccount($id) { |
|
1359 | 1359 | |
1360 | - $inboundEmail = new InboundEmail(); |
|
1360 | + $inboundEmail = new InboundEmail(); |
|
1361 | 1361 | |
1362 | - //test with invalid username |
|
1363 | - $result = $inboundEmail->deletePersonalEmailAccount($id, "test"); |
|
1364 | - $this->assertEquals(false, $result); |
|
1362 | + //test with invalid username |
|
1363 | + $result = $inboundEmail->deletePersonalEmailAccount($id, "test"); |
|
1364 | + $this->assertEquals(false, $result); |
|
1365 | 1365 | |
1366 | - //test with valid username |
|
1367 | - $result = $inboundEmail->deletePersonalEmailAccount($id, "admin"); |
|
1368 | - $this->assertEquals(true, $result); |
|
1366 | + //test with valid username |
|
1367 | + $result = $inboundEmail->deletePersonalEmailAccount($id, "admin"); |
|
1368 | + $this->assertEquals(true, $result); |
|
1369 | 1369 | |
1370 | - } |
|
1370 | + } |
|
1371 | 1371 | |
1372 | - public function testgetFoldersListForMailBox() { |
|
1372 | + public function testgetFoldersListForMailBox() { |
|
1373 | 1373 | |
1374 | - $inboundEmail = new InboundEmail(); |
|
1374 | + $inboundEmail = new InboundEmail(); |
|
1375 | 1375 | |
1376 | - $result = $inboundEmail->getFoldersListForMailBox(); |
|
1377 | - $this->assertTrue(is_array($result)); |
|
1376 | + $result = $inboundEmail->getFoldersListForMailBox(); |
|
1377 | + $this->assertTrue(is_array($result)); |
|
1378 | 1378 | |
1379 | - } |
|
1379 | + } |
|
1380 | 1380 | |
1381 | - public function testfindOptimumSettings() { |
|
1381 | + public function testfindOptimumSettings() { |
|
1382 | 1382 | |
1383 | 1383 | |
1384 | - $inboundEmail = new InboundEmail(); |
|
1384 | + $inboundEmail = new InboundEmail(); |
|
1385 | 1385 | |
1386 | - //test with different parameters, it will always return false because we do not have a mail server to connect. |
|
1386 | + //test with different parameters, it will always return false because we do not have a mail server to connect. |
|
1387 | 1387 | |
1388 | - $this->assertEquals(false, $inboundEmail->findOptimumSettings()); |
|
1388 | + $this->assertEquals(false, $inboundEmail->findOptimumSettings()); |
|
1389 | 1389 | |
1390 | - $this->assertEquals(false, $inboundEmail->findOptimumSettings(true)); |
|
1390 | + $this->assertEquals(false, $inboundEmail->findOptimumSettings(true)); |
|
1391 | 1391 | |
1392 | - $this->assertEquals(false, $inboundEmail->findOptimumSettings(false,'test','test','','','INBOX')); |
|
1392 | + $this->assertEquals(false, $inboundEmail->findOptimumSettings(false,'test','test','','','INBOX')); |
|
1393 | 1393 | |
1394 | 1394 | |
1395 | 1395 | |
1396 | - } |
|
1396 | + } |
|
1397 | 1397 | |
1398 | - public function testgetSessionConnectionString() { |
|
1398 | + public function testgetSessionConnectionString() { |
|
1399 | 1399 | |
1400 | - $inboundEmail = new InboundEmail(); |
|
1400 | + $inboundEmail = new InboundEmail(); |
|
1401 | 1401 | |
1402 | - //test without setting session key |
|
1403 | - $result = $inboundEmail->getSessionConnectionString("mail.google.com", "test", 22, "IMAP"); |
|
1404 | - $this->assertEquals("",$result); |
|
1402 | + //test without setting session key |
|
1403 | + $result = $inboundEmail->getSessionConnectionString("mail.google.com", "test", 22, "IMAP"); |
|
1404 | + $this->assertEquals("",$result); |
|
1405 | 1405 | |
1406 | - //test with session key set |
|
1407 | - $_SESSION["mail.google.comtest22IMAP"] = "test connection string"; |
|
1408 | - $result = $inboundEmail->getSessionConnectionString("mail.google.com", "test", 22, "IMAP"); |
|
1409 | - $this->assertEquals("test connection string",$result); |
|
1406 | + //test with session key set |
|
1407 | + $_SESSION["mail.google.comtest22IMAP"] = "test connection string"; |
|
1408 | + $result = $inboundEmail->getSessionConnectionString("mail.google.com", "test", 22, "IMAP"); |
|
1409 | + $this->assertEquals("test connection string",$result); |
|
1410 | 1410 | |
1411 | - } |
|
1411 | + } |
|
1412 | 1412 | |
1413 | - public function testsetSessionConnectionString() { |
|
1413 | + public function testsetSessionConnectionString() { |
|
1414 | 1414 | |
1415 | - $inboundEmail = new InboundEmail(); |
|
1415 | + $inboundEmail = new InboundEmail(); |
|
1416 | 1416 | |
1417 | - $result = $inboundEmail->setSessionConnectionString("mail.google.com", "test", 22, "IMAP", "test connection"); |
|
1418 | - $this->assertEquals("test connection", $_SESSION["mail.google.comtest22IMAP"]); |
|
1417 | + $result = $inboundEmail->setSessionConnectionString("mail.google.com", "test", 22, "IMAP", "test connection"); |
|
1418 | + $this->assertEquals("test connection", $_SESSION["mail.google.comtest22IMAP"]); |
|
1419 | 1419 | |
1420 | - } |
|
1420 | + } |
|
1421 | 1421 | |
1422 | - public function testgetSessionInboundDelimiterString() { |
|
1422 | + public function testgetSessionInboundDelimiterString() { |
|
1423 | 1423 | |
1424 | - $inboundEmail = new InboundEmail(); |
|
1424 | + $inboundEmail = new InboundEmail(); |
|
1425 | 1425 | |
1426 | - //test without setting session key |
|
1427 | - $result = $inboundEmail->getSessionInboundDelimiterString("mail.google.com", "test", 22, "IMAP"); |
|
1428 | - $this->assertEquals("",$result); |
|
1426 | + //test without setting session key |
|
1427 | + $result = $inboundEmail->getSessionInboundDelimiterString("mail.google.com", "test", 22, "IMAP"); |
|
1428 | + $this->assertEquals("",$result); |
|
1429 | 1429 | |
1430 | 1430 | |
1431 | - //test with session key set |
|
1432 | - $_SESSION["mail.google.comtest22IMAPdelimiter"] = "delimit string"; |
|
1433 | - $result = $inboundEmail->getSessionInboundDelimiterString("mail.google.com", "test", 22, "IMAP"); |
|
1434 | - $this->assertEquals("delimit string",$result); |
|
1431 | + //test with session key set |
|
1432 | + $_SESSION["mail.google.comtest22IMAPdelimiter"] = "delimit string"; |
|
1433 | + $result = $inboundEmail->getSessionInboundDelimiterString("mail.google.com", "test", 22, "IMAP"); |
|
1434 | + $this->assertEquals("delimit string",$result); |
|
1435 | 1435 | |
1436 | - } |
|
1436 | + } |
|
1437 | 1437 | |
1438 | - public function testsetSessionInboundDelimiterString() { |
|
1438 | + public function testsetSessionInboundDelimiterString() { |
|
1439 | 1439 | |
1440 | - $inboundEmail = new InboundEmail(); |
|
1440 | + $inboundEmail = new InboundEmail(); |
|
1441 | 1441 | |
1442 | - $result = $inboundEmail->setSessionInboundDelimiterString("mail.google.com", "test", 22, "IMAP", "test string"); |
|
1443 | - $this->assertEquals("test string", $_SESSION["mail.google.comtest22IMAPdelimiter"]); |
|
1442 | + $result = $inboundEmail->setSessionInboundDelimiterString("mail.google.com", "test", 22, "IMAP", "test string"); |
|
1443 | + $this->assertEquals("test string", $_SESSION["mail.google.comtest22IMAPdelimiter"]); |
|
1444 | 1444 | |
1445 | - } |
|
1445 | + } |
|
1446 | 1446 | |
1447 | - public function testgetSessionInboundFoldersString() { |
|
1447 | + public function testgetSessionInboundFoldersString() { |
|
1448 | 1448 | |
1449 | 1449 | |
1450 | - $inboundEmail = new InboundEmail(); |
|
1450 | + $inboundEmail = new InboundEmail(); |
|
1451 | 1451 | |
1452 | - //test without setting session key |
|
1453 | - $result = $inboundEmail->getSessionInboundFoldersString("mail.google.com", "test", 22, "IMAP"); |
|
1454 | - $this->assertEquals("",$result); |
|
1452 | + //test without setting session key |
|
1453 | + $result = $inboundEmail->getSessionInboundFoldersString("mail.google.com", "test", 22, "IMAP"); |
|
1454 | + $this->assertEquals("",$result); |
|
1455 | 1455 | |
1456 | 1456 | |
1457 | - //test with session key set |
|
1458 | - $_SESSION["mail.google.comtest22IMAPfoldersList"] = "foldersList string"; |
|
1459 | - $result = $inboundEmail->getSessionInboundFoldersString("mail.google.com", "test", 22, "IMAP"); |
|
1460 | - $this->assertEquals("foldersList string",$result); |
|
1457 | + //test with session key set |
|
1458 | + $_SESSION["mail.google.comtest22IMAPfoldersList"] = "foldersList string"; |
|
1459 | + $result = $inboundEmail->getSessionInboundFoldersString("mail.google.com", "test", 22, "IMAP"); |
|
1460 | + $this->assertEquals("foldersList string",$result); |
|
1461 | 1461 | |
1462 | - } |
|
1462 | + } |
|
1463 | 1463 | |
1464 | - public function testsetSessionInboundFoldersString() { |
|
1464 | + public function testsetSessionInboundFoldersString() { |
|
1465 | 1465 | |
1466 | - $inboundEmail = new InboundEmail(); |
|
1466 | + $inboundEmail = new InboundEmail(); |
|
1467 | 1467 | |
1468 | - $result = $inboundEmail->setSessionInboundFoldersString("mail.google.com", "test", 22, "IMAP", "foldersList string"); |
|
1469 | - $this->assertEquals("foldersList string", $_SESSION["mail.google.comtest22IMAPfoldersList"]); |
|
1468 | + $result = $inboundEmail->setSessionInboundFoldersString("mail.google.com", "test", 22, "IMAP", "foldersList string"); |
|
1469 | + $this->assertEquals("foldersList string", $_SESSION["mail.google.comtest22IMAPfoldersList"]); |
|
1470 | 1470 | |
1471 | - } |
|
1471 | + } |
|
1472 | 1472 | |
1473 | 1473 | |
1474 | - public function testgroupUserDupeCheck() { |
|
1474 | + public function testgroupUserDupeCheck() { |
|
1475 | 1475 | |
1476 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1477 | - global $db; |
|
1478 | - unset ($db->database); |
|
1479 | - $db->checkConnection(); |
|
1476 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1477 | + global $db; |
|
1478 | + unset ($db->database); |
|
1479 | + $db->checkConnection(); |
|
1480 | 1480 | |
1481 | - $inboundEmail = new InboundEmail(); |
|
1481 | + $inboundEmail = new InboundEmail(); |
|
1482 | 1482 | |
1483 | - //test without name i-e user_name in query |
|
1484 | - $result = $inboundEmail->groupUserDupeCheck(); |
|
1485 | - $this->assertEquals(false, $result); |
|
1483 | + //test without name i-e user_name in query |
|
1484 | + $result = $inboundEmail->groupUserDupeCheck(); |
|
1485 | + $this->assertEquals(false, $result); |
|
1486 | 1486 | |
1487 | - //test with name i-e user_name in query |
|
1488 | - $inboundEmail->name = "admin"; |
|
1489 | - $result = $inboundEmail->groupUserDupeCheck(); |
|
1490 | - $this->assertEquals(false, $result); |
|
1487 | + //test with name i-e user_name in query |
|
1488 | + $inboundEmail->name = "admin"; |
|
1489 | + $result = $inboundEmail->groupUserDupeCheck(); |
|
1490 | + $this->assertEquals(false, $result); |
|
1491 | 1491 | |
1492 | - } |
|
1492 | + } |
|
1493 | 1493 | |
1494 | 1494 | |
1495 | - public function testgetGroupsWithSelectOptions() { |
|
1495 | + public function testgetGroupsWithSelectOptions() { |
|
1496 | 1496 | |
1497 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1498 | - global $db; |
|
1499 | - unset ($db->database); |
|
1500 | - $db->checkConnection(); |
|
1497 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1498 | + global $db; |
|
1499 | + unset ($db->database); |
|
1500 | + $db->checkConnection(); |
|
1501 | 1501 | |
1502 | 1502 | |
1503 | - $inboundEmail = new InboundEmail(); |
|
1503 | + $inboundEmail = new InboundEmail(); |
|
1504 | 1504 | |
1505 | - $inboundEmail->group_id =1; |
|
1505 | + $inboundEmail->group_id =1; |
|
1506 | 1506 | |
1507 | - $result = $inboundEmail->getGroupsWithSelectOptions(); |
|
1508 | - $this->assertEquals("", $result); |
|
1507 | + $result = $inboundEmail->getGroupsWithSelectOptions(); |
|
1508 | + $this->assertEquals("", $result); |
|
1509 | 1509 | |
1510 | - $expected = "\n<OPTION value='0'>1</OPTION>\n<OPTION selected value='1'>2</OPTION>\n<OPTION value='2'>3</OPTION>"; |
|
1511 | - $result = $inboundEmail->getGroupsWithSelectOptions(array(1,2,3)); |
|
1512 | - $this->assertEquals($expected, $result); |
|
1513 | - //var_dump($result); |
|
1510 | + $expected = "\n<OPTION value='0'>1</OPTION>\n<OPTION selected value='1'>2</OPTION>\n<OPTION value='2'>3</OPTION>"; |
|
1511 | + $result = $inboundEmail->getGroupsWithSelectOptions(array(1,2,3)); |
|
1512 | + $this->assertEquals($expected, $result); |
|
1513 | + //var_dump($result); |
|
1514 | 1514 | |
1515 | - } |
|
1515 | + } |
|
1516 | 1516 | |
1517 | 1517 | |
1518 | - public function testhandleAutoresponse() { |
|
1518 | + public function testhandleAutoresponse() { |
|
1519 | 1519 | |
1520 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1521 | - global $db; |
|
1522 | - unset ($db->database); |
|
1523 | - $db->checkConnection(); |
|
1520 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1521 | + global $db; |
|
1522 | + unset ($db->database); |
|
1523 | + $db->checkConnection(); |
|
1524 | 1524 | |
1525 | 1525 | |
1526 | - $inboundEmail = new InboundEmail(); |
|
1526 | + $inboundEmail = new InboundEmail(); |
|
1527 | 1527 | |
1528 | - $inboundEmail->template_id = 1; |
|
1529 | - $email = new Email(); |
|
1530 | - $email->name = "test"; |
|
1528 | + $inboundEmail->template_id = 1; |
|
1529 | + $email = new Email(); |
|
1530 | + $email->name = "test"; |
|
1531 | 1531 | |
1532 | - $contactAddr = "[email protected]"; |
|
1532 | + $contactAddr = "[email protected]"; |
|
1533 | 1533 | |
1534 | - //execute the method and test if it works and does not throws an exception. |
|
1535 | - try { |
|
1536 | - $result = $inboundEmail->handleAutoresponse($email,$contactAddr); |
|
1537 | - $this->assertTrue(true); |
|
1538 | - } |
|
1539 | - catch (Exception $e) { |
|
1540 | - $this->fail(); |
|
1541 | - } |
|
1534 | + //execute the method and test if it works and does not throws an exception. |
|
1535 | + try { |
|
1536 | + $result = $inboundEmail->handleAutoresponse($email,$contactAddr); |
|
1537 | + $this->assertTrue(true); |
|
1538 | + } |
|
1539 | + catch (Exception $e) { |
|
1540 | + $this->fail(); |
|
1541 | + } |
|
1542 | 1542 | |
1543 | 1543 | |
1544 | - } |
|
1544 | + } |
|
1545 | 1545 | |
1546 | - public function testhandleCaseAssignment() { |
|
1546 | + public function testhandleCaseAssignment() { |
|
1547 | 1547 | |
1548 | 1548 | |
1549 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1550 | - global $db; |
|
1551 | - unset ($db->database); |
|
1552 | - $db->checkConnection(); |
|
1549 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1550 | + global $db; |
|
1551 | + unset ($db->database); |
|
1552 | + $db->checkConnection(); |
|
1553 | 1553 | |
1554 | - $inboundEmail = new InboundEmail(); |
|
1554 | + $inboundEmail = new InboundEmail(); |
|
1555 | 1555 | |
1556 | - $email = new Email(); |
|
1557 | - $email->name = "test"; |
|
1556 | + $email = new Email(); |
|
1557 | + $email->name = "test"; |
|
1558 | 1558 | |
1559 | - $result = $inboundEmail->handleCaseAssignment($email); |
|
1560 | - $this->assertEquals(false, $result); |
|
1559 | + $result = $inboundEmail->handleCaseAssignment($email); |
|
1560 | + $this->assertEquals(false, $result); |
|
1561 | 1561 | |
1562 | - } |
|
1562 | + } |
|
1563 | 1563 | |
1564 | - public function testhandleMailboxType() { |
|
1564 | + public function testhandleMailboxType() { |
|
1565 | 1565 | |
1566 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1567 | - global $db; |
|
1568 | - unset ($db->database); |
|
1569 | - $db->checkConnection(); |
|
1566 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1567 | + global $db; |
|
1568 | + unset ($db->database); |
|
1569 | + $db->checkConnection(); |
|
1570 | 1570 | |
1571 | - $inboundEmail = new InboundEmail(); |
|
1571 | + $inboundEmail = new InboundEmail(); |
|
1572 | 1572 | |
1573 | - $email = new Email(); |
|
1574 | - $email->name = "test"; |
|
1573 | + $email = new Email(); |
|
1574 | + $email->name = "test"; |
|
1575 | 1575 | |
1576 | - $inboundEmail->mailbox_type = "support"; |
|
1576 | + $inboundEmail->mailbox_type = "support"; |
|
1577 | 1577 | |
1578 | - //execute the method and test if it works and does not throws an exception. |
|
1579 | - try { |
|
1580 | - $inboundEmail->handleMailboxType($email, $header); |
|
1581 | - $this->assertTrue(true); |
|
1582 | - } |
|
1583 | - catch (Exception $e) { |
|
1584 | - $this->fail(); |
|
1585 | - } |
|
1578 | + //execute the method and test if it works and does not throws an exception. |
|
1579 | + try { |
|
1580 | + $inboundEmail->handleMailboxType($email, $header); |
|
1581 | + $this->assertTrue(true); |
|
1582 | + } |
|
1583 | + catch (Exception $e) { |
|
1584 | + $this->fail(); |
|
1585 | + } |
|
1586 | 1586 | |
1587 | 1587 | |
1588 | - } |
|
1588 | + } |
|
1589 | 1589 | |
1590 | - public function testisMailBoxTypeCreateCase() { |
|
1590 | + public function testisMailBoxTypeCreateCase() { |
|
1591 | 1591 | |
1592 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1593 | - global $db; |
|
1594 | - unset ($db->database); |
|
1595 | - $db->checkConnection(); |
|
1592 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1593 | + global $db; |
|
1594 | + unset ($db->database); |
|
1595 | + $db->checkConnection(); |
|
1596 | 1596 | |
1597 | 1597 | |
1598 | - $inboundEmail = new InboundEmail(); |
|
1598 | + $inboundEmail = new InboundEmail(); |
|
1599 | 1599 | |
1600 | 1600 | |
1601 | - //test without setting attributes |
|
1602 | - $result = $inboundEmail->isMailBoxTypeCreateCase(); |
|
1603 | - $this->assertEquals(false, $result); |
|
1601 | + //test without setting attributes |
|
1602 | + $result = $inboundEmail->isMailBoxTypeCreateCase(); |
|
1603 | + $this->assertEquals(false, $result); |
|
1604 | 1604 | |
1605 | - //test with attributes set |
|
1606 | - $inboundEmail->mailbox_type = 'createcase' ; |
|
1607 | - $inboundEmail->groupfolder_id =1; |
|
1605 | + //test with attributes set |
|
1606 | + $inboundEmail->mailbox_type = 'createcase' ; |
|
1607 | + $inboundEmail->groupfolder_id =1; |
|
1608 | 1608 | |
1609 | - $result = $inboundEmail->isMailBoxTypeCreateCase(); |
|
1610 | - $this->assertEquals(true, $result); |
|
1609 | + $result = $inboundEmail->isMailBoxTypeCreateCase(); |
|
1610 | + $this->assertEquals(true, $result); |
|
1611 | 1611 | |
1612 | - } |
|
1612 | + } |
|
1613 | 1613 | |
1614 | 1614 | |
1615 | - public function testhandleCreateCase() { |
|
1615 | + public function testhandleCreateCase() { |
|
1616 | 1616 | |
1617 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1618 | - global $db; |
|
1619 | - unset ($db->database); |
|
1620 | - $db->checkConnection(); |
|
1617 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1618 | + global $db; |
|
1619 | + unset ($db->database); |
|
1620 | + $db->checkConnection(); |
|
1621 | 1621 | |
1622 | 1622 | |
1623 | - $inboundEmail = new InboundEmail(); |
|
1623 | + $inboundEmail = new InboundEmail(); |
|
1624 | 1624 | |
1625 | - $email = new Email(); |
|
1626 | - $email->name = "test"; |
|
1625 | + $email = new Email(); |
|
1626 | + $email->name = "test"; |
|
1627 | 1627 | |
1628 | - //execute the method and test if it works and does not throws an exception. |
|
1629 | - try { |
|
1630 | - $inboundEmail->handleCreateCase($email, 1); |
|
1631 | - $this->assertTrue(true); |
|
1632 | - } |
|
1633 | - catch (Exception $e) { |
|
1634 | - $this->fail(); |
|
1635 | - } |
|
1628 | + //execute the method and test if it works and does not throws an exception. |
|
1629 | + try { |
|
1630 | + $inboundEmail->handleCreateCase($email, 1); |
|
1631 | + $this->assertTrue(true); |
|
1632 | + } |
|
1633 | + catch (Exception $e) { |
|
1634 | + $this->fail(); |
|
1635 | + } |
|
1636 | 1636 | |
1637 | - } |
|
1637 | + } |
|
1638 | 1638 | |
1639 | 1639 | |
1640 | - public function testhandleLinking() { |
|
1640 | + public function testhandleLinking() { |
|
1641 | 1641 | |
1642 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1643 | - global $db; |
|
1644 | - unset ($db->database); |
|
1645 | - $db->checkConnection(); |
|
1642 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1643 | + global $db; |
|
1644 | + unset ($db->database); |
|
1645 | + $db->checkConnection(); |
|
1646 | 1646 | |
1647 | - $inboundEmail = new InboundEmail(); |
|
1647 | + $inboundEmail = new InboundEmail(); |
|
1648 | 1648 | |
1649 | - $email = new Email(); |
|
1650 | - $email->from_addr = "[email protected]"; |
|
1649 | + $email = new Email(); |
|
1650 | + $email->from_addr = "[email protected]"; |
|
1651 | 1651 | |
1652 | - $result = $inboundEmail->handleLinking($email); |
|
1653 | - $this->assertEquals($email->from_addr, $result); |
|
1652 | + $result = $inboundEmail->handleLinking($email); |
|
1653 | + $this->assertEquals($email->from_addr, $result); |
|
1654 | 1654 | |
1655 | - } |
|
1655 | + } |
|
1656 | 1656 | |
1657 | 1657 | |
1658 | 1658 | |
1659 | - public function testgetEncodingFromBreadCrumb() { |
|
1659 | + public function testgetEncodingFromBreadCrumb() { |
|
1660 | 1660 | |
1661 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1662 | - global $db; |
|
1663 | - unset ($db->database); |
|
1664 | - $db->checkConnection(); |
|
1661 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1662 | + global $db; |
|
1663 | + unset ($db->database); |
|
1664 | + $db->checkConnection(); |
|
1665 | 1665 | |
1666 | - $inboundEmail = new InboundEmail(); |
|
1666 | + $inboundEmail = new InboundEmail(); |
|
1667 | 1667 | |
1668 | - $parts = array( |
|
1669 | - (Object) array('encoding'=>'utf-8','parts'=> array( (Object) array('encoding'=>'utf-8','parts'=>array((Object) array('encoding'=>'utf-8','parts'=>'dummy parts 2'))))) |
|
1670 | - ); |
|
1668 | + $parts = array( |
|
1669 | + (Object) array('encoding'=>'utf-8','parts'=> array( (Object) array('encoding'=>'utf-8','parts'=>array((Object) array('encoding'=>'utf-8','parts'=>'dummy parts 2'))))) |
|
1670 | + ); |
|
1671 | 1671 | |
1672 | - //$result = $inboundEmail->getEncodingFromBreadCrumb("1.2.3", $parts); |
|
1672 | + //$result = $inboundEmail->getEncodingFromBreadCrumb("1.2.3", $parts); |
|
1673 | 1673 | |
1674 | - //$this->assertEqilas('utf-8', $result); |
|
1674 | + //$this->assertEqilas('utf-8', $result); |
|
1675 | 1675 | |
1676 | - $this->markTestIncomplete('errors in method'); |
|
1676 | + $this->markTestIncomplete('errors in method'); |
|
1677 | 1677 | |
1678 | - } |
|
1678 | + } |
|
1679 | 1679 | |
1680 | 1680 | |
1681 | - public function testgetCharsetFromBreadCrumb() |
|
1682 | - { |
|
1683 | - $inboundEmail = new InboundEmail(); |
|
1681 | + public function testgetCharsetFromBreadCrumb() |
|
1682 | + { |
|
1683 | + $inboundEmail = new InboundEmail(); |
|
1684 | 1684 | |
1685 | - $parts = array( |
|
1686 | - (Object) array('ifparameters'=>1, 'attribute'=>'charset', 'value'=>'test','parts'=> array( (Object) array('ifparameters'=>1, 'attribute'=>'charset','value'=>'test' ,'parts'=>array((Object) array('ifparameters'=>1, 'attribute'=>'charset', 'value'=>'test','parts'=>'dummy parts 2'))))) |
|
1687 | - ); |
|
1685 | + $parts = array( |
|
1686 | + (Object) array('ifparameters'=>1, 'attribute'=>'charset', 'value'=>'test','parts'=> array( (Object) array('ifparameters'=>1, 'attribute'=>'charset','value'=>'test' ,'parts'=>array((Object) array('ifparameters'=>1, 'attribute'=>'charset', 'value'=>'test','parts'=>'dummy parts 2'))))) |
|
1687 | + ); |
|
1688 | 1688 | |
1689 | - $result = $inboundEmail->getCharsetFromBreadCrumb("1.2.3", $parts); |
|
1689 | + $result = $inboundEmail->getCharsetFromBreadCrumb("1.2.3", $parts); |
|
1690 | 1690 | |
1691 | - $this->assertEquals('default', $result); |
|
1691 | + $this->assertEquals('default', $result); |
|
1692 | 1692 | |
1693 | - } |
|
1693 | + } |
|
1694 | 1694 | |
1695 | 1695 | |
1696 | - public function testgetMessageTextFromSingleMimePart() |
|
1697 | - { |
|
1698 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1699 | - global $db; |
|
1700 | - unset ($db->database); |
|
1701 | - $db->checkConnection(); |
|
1696 | + public function testgetMessageTextFromSingleMimePart() |
|
1697 | + { |
|
1698 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1699 | + global $db; |
|
1700 | + unset ($db->database); |
|
1701 | + $db->checkConnection(); |
|
1702 | 1702 | |
1703 | 1703 | |
1704 | - $inboundEmail = new InboundEmail(); |
|
1704 | + $inboundEmail = new InboundEmail(); |
|
1705 | 1705 | |
1706 | - //execute the method and test if it works and does not throws an exception. |
|
1707 | - try { |
|
1708 | - $result = $inboundEmail->getMessageTextFromSingleMimePart(1,1,$structure); |
|
1709 | - $this->assertTrue(true); |
|
1710 | - } |
|
1711 | - catch (Exception $e) { |
|
1712 | - $this->fail(); |
|
1713 | - } |
|
1706 | + //execute the method and test if it works and does not throws an exception. |
|
1707 | + try { |
|
1708 | + $result = $inboundEmail->getMessageTextFromSingleMimePart(1,1,$structure); |
|
1709 | + $this->assertTrue(true); |
|
1710 | + } |
|
1711 | + catch (Exception $e) { |
|
1712 | + $this->fail(); |
|
1713 | + } |
|
1714 | 1714 | |
1715 | 1715 | |
1716 | - } |
|
1716 | + } |
|
1717 | 1717 | |
1718 | 1718 | |
1719 | - public function testaddBreadCrumbOffset() |
|
1720 | - { |
|
1721 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1722 | - global $db; |
|
1723 | - unset ($db->database); |
|
1724 | - $db->checkConnection(); |
|
1719 | + public function testaddBreadCrumbOffset() |
|
1720 | + { |
|
1721 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1722 | + global $db; |
|
1723 | + unset ($db->database); |
|
1724 | + $db->checkConnection(); |
|
1725 | 1725 | |
1726 | 1726 | |
1727 | - $inboundEmail = new InboundEmail(); |
|
1727 | + $inboundEmail = new InboundEmail(); |
|
1728 | 1728 | |
1729 | - //test with empty offset string |
|
1730 | - $result = $inboundEmail->addBreadCrumbOffset("1.1.1", ""); |
|
1731 | - $this->assertEquals("1.1.1", $result); |
|
1729 | + //test with empty offset string |
|
1730 | + $result = $inboundEmail->addBreadCrumbOffset("1.1.1", ""); |
|
1731 | + $this->assertEquals("1.1.1", $result); |
|
1732 | 1732 | |
1733 | - //test with empty bread crumb string |
|
1734 | - $result = $inboundEmail->addBreadCrumbOffset("", "1.1.1"); |
|
1735 | - $this->assertEquals("1.1.1", $result); |
|
1733 | + //test with empty bread crumb string |
|
1734 | + $result = $inboundEmail->addBreadCrumbOffset("", "1.1.1"); |
|
1735 | + $this->assertEquals("1.1.1", $result); |
|
1736 | 1736 | |
1737 | - //test with shorter bread crumb string |
|
1738 | - $result = $inboundEmail->addBreadCrumbOffset("1.1.1", "2.2.2.2"); |
|
1739 | - $this->assertEquals("3.3.3.2", $result); |
|
1737 | + //test with shorter bread crumb string |
|
1738 | + $result = $inboundEmail->addBreadCrumbOffset("1.1.1", "2.2.2.2"); |
|
1739 | + $this->assertEquals("3.3.3.2", $result); |
|
1740 | 1740 | |
1741 | - } |
|
1741 | + } |
|
1742 | 1742 | |
1743 | 1743 | |
1744 | - public function testgetMessageText() { |
|
1744 | + public function testgetMessageText() { |
|
1745 | 1745 | |
1746 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1747 | - global $db; |
|
1748 | - unset ($db->database); |
|
1749 | - $db->checkConnection(); |
|
1746 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1747 | + global $db; |
|
1748 | + unset ($db->database); |
|
1749 | + $db->checkConnection(); |
|
1750 | 1750 | |
1751 | - $inboundEmail = new InboundEmail(); |
|
1751 | + $inboundEmail = new InboundEmail(); |
|
1752 | 1752 | |
1753 | - //execute the method and test if it works and does not throws an exception. |
|
1754 | - try { |
|
1755 | - $result = $inboundEmail->getMessageText(1, "PLAIN", $structure, $fullHeader); |
|
1756 | - $this->assertTrue(true); |
|
1757 | - } |
|
1758 | - catch (Exception $e) { |
|
1759 | - $this->fail(); |
|
1760 | - } |
|
1753 | + //execute the method and test if it works and does not throws an exception. |
|
1754 | + try { |
|
1755 | + $result = $inboundEmail->getMessageText(1, "PLAIN", $structure, $fullHeader); |
|
1756 | + $this->assertTrue(true); |
|
1757 | + } |
|
1758 | + catch (Exception $e) { |
|
1759 | + $this->fail(); |
|
1760 | + } |
|
1761 | 1761 | |
1762 | 1762 | |
1763 | - } |
|
1763 | + } |
|
1764 | 1764 | |
1765 | 1765 | |
1766 | - public function testdecodeHeader() { |
|
1766 | + public function testdecodeHeader() { |
|
1767 | 1767 | |
1768 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1769 | - global $db; |
|
1770 | - unset ($db->database); |
|
1771 | - $db->checkConnection(); |
|
1768 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1769 | + global $db; |
|
1770 | + unset ($db->database); |
|
1771 | + $db->checkConnection(); |
|
1772 | 1772 | |
1773 | 1773 | |
1774 | - $inboundEmail = new InboundEmail(); |
|
1774 | + $inboundEmail = new InboundEmail(); |
|
1775 | 1775 | |
1776 | 1776 | |
1777 | - $expected = array ( |
|
1778 | - 'From' => 'Media Temple user ([email protected])', |
|
1779 | - 'Subject' => 'article: How to Trace a Email', |
|
1780 | - 'Date' => 'January 25, 2011 3:30:58 PM PDT', |
|
1781 | - 'To' => '[email protected]', |
|
1782 | - 'Return-Path' => '<[email protected]>', |
|
1783 | - 'Envelope-To' => '[email protected]', |
|
1784 | - 'Delivery-Date' => 'Tue, 25 Jan 2011 15:31:01 -0700' |
|
1785 | - ); |
|
1786 | - $header = "From: Media Temple user ([email protected])\r\nSubject: article: How to Trace a Email\r\nDate: January 25, 2011 3:30:58 PM PDT\r\nTo: [email protected]\r\nReturn-Path: <[email protected]>\r\nEnvelope-To: [email protected]\r\nDelivery-Date: Tue, 25 Jan 2011 15:31:01 -0700"; |
|
1777 | + $expected = array ( |
|
1778 | + 'From' => 'Media Temple user ([email protected])', |
|
1779 | + 'Subject' => 'article: How to Trace a Email', |
|
1780 | + 'Date' => 'January 25, 2011 3:30:58 PM PDT', |
|
1781 | + 'To' => '[email protected]', |
|
1782 | + 'Return-Path' => '<[email protected]>', |
|
1783 | + 'Envelope-To' => '[email protected]', |
|
1784 | + 'Delivery-Date' => 'Tue, 25 Jan 2011 15:31:01 -0700' |
|
1785 | + ); |
|
1786 | + $header = "From: Media Temple user ([email protected])\r\nSubject: article: How to Trace a Email\r\nDate: January 25, 2011 3:30:58 PM PDT\r\nTo: [email protected]\r\nReturn-Path: <[email protected]>\r\nEnvelope-To: [email protected]\r\nDelivery-Date: Tue, 25 Jan 2011 15:31:01 -0700"; |
|
1787 | 1787 | |
1788 | - $result = $inboundEmail->decodeHeader($header); |
|
1789 | - $this->assertEquals($expected, $result); |
|
1788 | + $result = $inboundEmail->decodeHeader($header); |
|
1789 | + $this->assertEquals($expected, $result); |
|
1790 | 1790 | |
1791 | - } |
|
1791 | + } |
|
1792 | 1792 | |
1793 | 1793 | |
1794 | - public function testhandleCharsetTranslation() { |
|
1794 | + public function testhandleCharsetTranslation() { |
|
1795 | 1795 | |
1796 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1797 | - global $db; |
|
1798 | - unset ($db->database); |
|
1799 | - $db->checkConnection(); |
|
1796 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1797 | + global $db; |
|
1798 | + unset ($db->database); |
|
1799 | + $db->checkConnection(); |
|
1800 | 1800 | |
1801 | - $inboundEmail = new InboundEmail(); |
|
1801 | + $inboundEmail = new InboundEmail(); |
|
1802 | 1802 | |
1803 | - //test with default |
|
1804 | - $result = $inboundEmail->handleCharsetTranslation("sample text",'default'); |
|
1805 | - $this->assertEquals("sample text", $result); |
|
1803 | + //test with default |
|
1804 | + $result = $inboundEmail->handleCharsetTranslation("sample text",'default'); |
|
1805 | + $this->assertEquals("sample text", $result); |
|
1806 | 1806 | |
1807 | 1807 | |
1808 | - //test with ISO-8859-8 |
|
1809 | - $result = $inboundEmail->handleCharsetTranslation("sample text",'ISO-8859-8'); |
|
1810 | - $this->assertEquals("sample text", $result); |
|
1808 | + //test with ISO-8859-8 |
|
1809 | + $result = $inboundEmail->handleCharsetTranslation("sample text",'ISO-8859-8'); |
|
1810 | + $this->assertEquals("sample text", $result); |
|
1811 | 1811 | |
1812 | - } |
|
1812 | + } |
|
1813 | 1813 | |
1814 | 1814 | |
1815 | - public function testbuildBreadCrumbs() { |
|
1815 | + public function testbuildBreadCrumbs() { |
|
1816 | 1816 | |
1817 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1818 | - global $db; |
|
1819 | - unset ($db->database); |
|
1820 | - $db->checkConnection(); |
|
1817 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1818 | + global $db; |
|
1819 | + unset ($db->database); |
|
1820 | + $db->checkConnection(); |
|
1821 | 1821 | |
1822 | - $inboundEmail = new InboundEmail(); |
|
1822 | + $inboundEmail = new InboundEmail(); |
|
1823 | 1823 | |
1824 | - //execute the method and test if it works and does not throws an exception. |
|
1825 | - try { |
|
1826 | - $result = $inboundEmail->buildBreadCrumbs(array(), "ALTERNATIVE", '1'); |
|
1827 | - $this->assertTrue(true); |
|
1828 | - } |
|
1829 | - catch (Exception $e) { |
|
1830 | - $this->fail(); |
|
1831 | - } |
|
1824 | + //execute the method and test if it works and does not throws an exception. |
|
1825 | + try { |
|
1826 | + $result = $inboundEmail->buildBreadCrumbs(array(), "ALTERNATIVE", '1'); |
|
1827 | + $this->assertTrue(true); |
|
1828 | + } |
|
1829 | + catch (Exception $e) { |
|
1830 | + $this->fail(); |
|
1831 | + } |
|
1832 | 1832 | |
1833 | - } |
|
1833 | + } |
|
1834 | 1834 | |
1835 | 1835 | |
1836 | - public function testbuildBreadCrumbsHTML() { |
|
1836 | + public function testbuildBreadCrumbsHTML() { |
|
1837 | 1837 | |
1838 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1839 | - global $db; |
|
1840 | - unset ($db->database); |
|
1841 | - $db->checkConnection(); |
|
1838 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1839 | + global $db; |
|
1840 | + unset ($db->database); |
|
1841 | + $db->checkConnection(); |
|
1842 | 1842 | |
1843 | - $inboundEmail = new InboundEmail(); |
|
1843 | + $inboundEmail = new InboundEmail(); |
|
1844 | 1844 | |
1845 | - //execute the method and test if it works and does not throws an exception. |
|
1846 | - try { |
|
1847 | - $inboundEmail->buildBreadCrumbsHTML(array()); |
|
1848 | - $this->assertTrue(true); |
|
1849 | - } |
|
1850 | - catch (Exception $e) { |
|
1851 | - $this->fail(); |
|
1852 | - } |
|
1845 | + //execute the method and test if it works and does not throws an exception. |
|
1846 | + try { |
|
1847 | + $inboundEmail->buildBreadCrumbsHTML(array()); |
|
1848 | + $this->assertTrue(true); |
|
1849 | + } |
|
1850 | + catch (Exception $e) { |
|
1851 | + $this->fail(); |
|
1852 | + } |
|
1853 | 1853 | |
1854 | 1854 | |
1855 | - } |
|
1855 | + } |
|
1856 | 1856 | |
1857 | 1857 | |
1858 | - public function testconvertImapToSugarEmailAddress() { |
|
1858 | + public function testconvertImapToSugarEmailAddress() { |
|
1859 | 1859 | |
1860 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1861 | - global $db; |
|
1862 | - unset ($db->database); |
|
1863 | - $db->checkConnection(); |
|
1860 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1861 | + global $db; |
|
1862 | + unset ($db->database); |
|
1863 | + $db->checkConnection(); |
|
1864 | 1864 | |
1865 | - $inboundEmail = new InboundEmail(); |
|
1865 | + $inboundEmail = new InboundEmail(); |
|
1866 | 1866 | |
1867 | - $inboundEmail->mailbox = "INBOX"; |
|
1868 | - $inboundEmail->host = "mail.google.com"; |
|
1867 | + $inboundEmail->mailbox = "INBOX"; |
|
1868 | + $inboundEmail->host = "mail.google.com"; |
|
1869 | 1869 | |
1870 | - $result = $inboundEmail->convertImapToSugarEmailAddress(array($inboundEmail)); |
|
1871 | - $this->assertEquals("[email protected]", $result); |
|
1870 | + $result = $inboundEmail->convertImapToSugarEmailAddress(array($inboundEmail)); |
|
1871 | + $this->assertEquals("[email protected]", $result); |
|
1872 | 1872 | |
1873 | - } |
|
1873 | + } |
|
1874 | 1874 | |
1875 | 1875 | |
1876 | - public function testhandleEncodedFilename() { |
|
1876 | + public function testhandleEncodedFilename() { |
|
1877 | 1877 | |
1878 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1879 | - global $db; |
|
1880 | - unset ($db->database); |
|
1881 | - $db->checkConnection(); |
|
1878 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1879 | + global $db; |
|
1880 | + unset ($db->database); |
|
1881 | + $db->checkConnection(); |
|
1882 | 1882 | |
1883 | - $inboundEmail = new InboundEmail(); |
|
1883 | + $inboundEmail = new InboundEmail(); |
|
1884 | 1884 | |
1885 | - $result = $inboundEmail->handleEncodedFilename("attachment1.pdf"); |
|
1886 | - $this->assertEquals("attachment1.pdf", $result); |
|
1885 | + $result = $inboundEmail->handleEncodedFilename("attachment1.pdf"); |
|
1886 | + $this->assertEquals("attachment1.pdf", $result); |
|
1887 | 1887 | |
1888 | - } |
|
1888 | + } |
|
1889 | 1889 | |
1890 | 1890 | |
1891 | 1891 | |
1892 | - public function testgetMimeType() |
|
1893 | - { |
|
1894 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1895 | - global $db; |
|
1896 | - unset ($db->database); |
|
1897 | - $db->checkConnection(); |
|
1892 | + public function testgetMimeType() |
|
1893 | + { |
|
1894 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1895 | + global $db; |
|
1896 | + unset ($db->database); |
|
1897 | + $db->checkConnection(); |
|
1898 | 1898 | |
1899 | - $inboundEmail = new InboundEmail(); |
|
1899 | + $inboundEmail = new InboundEmail(); |
|
1900 | 1900 | |
1901 | - $this->assertEquals("text/plain", $inboundEmail->getMimeType(0, "plain")); |
|
1902 | - $this->assertEquals("multipart/binary", $inboundEmail->getMimeType(1, "binary")); |
|
1903 | - $this->assertEquals("other/subtype", $inboundEmail->getMimeType("test", "subtype")); |
|
1901 | + $this->assertEquals("text/plain", $inboundEmail->getMimeType(0, "plain")); |
|
1902 | + $this->assertEquals("multipart/binary", $inboundEmail->getMimeType(1, "binary")); |
|
1903 | + $this->assertEquals("other/subtype", $inboundEmail->getMimeType("test", "subtype")); |
|
1904 | 1904 | |
1905 | - } |
|
1905 | + } |
|
1906 | 1906 | |
1907 | 1907 | |
1908 | - public function testsaveAttachments() { |
|
1908 | + public function testsaveAttachments() { |
|
1909 | 1909 | |
1910 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1911 | - global $db; |
|
1912 | - unset ($db->database); |
|
1913 | - $db->checkConnection(); |
|
1910 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1911 | + global $db; |
|
1912 | + unset ($db->database); |
|
1913 | + $db->checkConnection(); |
|
1914 | 1914 | |
1915 | - $inboundEmail = new InboundEmail(); |
|
1915 | + $inboundEmail = new InboundEmail(); |
|
1916 | 1916 | |
1917 | - //execute the method and test if it works and does not throws an exception. |
|
1918 | - try { |
|
1919 | - $inboundEmail->saveAttachments("1", array(), "1", '0', true); |
|
1920 | - $this->assertTrue(true); |
|
1921 | - } |
|
1922 | - catch (Exception $e) { |
|
1923 | - $this->fail(); |
|
1924 | - } |
|
1917 | + //execute the method and test if it works and does not throws an exception. |
|
1918 | + try { |
|
1919 | + $inboundEmail->saveAttachments("1", array(), "1", '0', true); |
|
1920 | + $this->assertTrue(true); |
|
1921 | + } |
|
1922 | + catch (Exception $e) { |
|
1923 | + $this->fail(); |
|
1924 | + } |
|
1925 | 1925 | |
1926 | - } |
|
1926 | + } |
|
1927 | 1927 | |
1928 | 1928 | |
1929 | - public function testgetNoteBeanForAttachment() |
|
1930 | - { |
|
1929 | + public function testgetNoteBeanForAttachment() |
|
1930 | + { |
|
1931 | 1931 | |
1932 | - $inboundEmail = new InboundEmail(); |
|
1932 | + $inboundEmail = new InboundEmail(); |
|
1933 | 1933 | |
1934 | - $result = $inboundEmail->getNoteBeanForAttachment("1"); |
|
1934 | + $result = $inboundEmail->getNoteBeanForAttachment("1"); |
|
1935 | 1935 | |
1936 | - $this->assertInstanceOf('Note',$result); |
|
1937 | - $this->assertAttributeEquals('1', 'parent_id', $result); |
|
1938 | - $this->assertAttributeEquals('Emails', 'parent_type', $result); |
|
1936 | + $this->assertInstanceOf('Note',$result); |
|
1937 | + $this->assertAttributeEquals('1', 'parent_id', $result); |
|
1938 | + $this->assertAttributeEquals('Emails', 'parent_type', $result); |
|
1939 | 1939 | |
1940 | - } |
|
1940 | + } |
|
1941 | 1941 | |
1942 | 1942 | |
1943 | - public function testretrieveAttachmentNameFromStructure() |
|
1944 | - { |
|
1943 | + public function testretrieveAttachmentNameFromStructure() |
|
1944 | + { |
|
1945 | 1945 | |
1946 | - $inboundEmail = new InboundEmail(); |
|
1946 | + $inboundEmail = new InboundEmail(); |
|
1947 | 1947 | |
1948 | - //test with filename attribute |
|
1949 | - $part = (Object) array('dparameters'=> array((Object) array('attribute'=>'filename','value'=>'test1.txt'),(Object) array('attribute'=>'filename','value'=>'test2.txt')), |
|
1950 | - 'parameters'=> array((Object) array('attribute'=>'name','value'=>'test1'),(Object) array('attribute'=>'name','value'=>'test2')) |
|
1951 | - ); |
|
1948 | + //test with filename attribute |
|
1949 | + $part = (Object) array('dparameters'=> array((Object) array('attribute'=>'filename','value'=>'test1.txt'),(Object) array('attribute'=>'filename','value'=>'test2.txt')), |
|
1950 | + 'parameters'=> array((Object) array('attribute'=>'name','value'=>'test1'),(Object) array('attribute'=>'name','value'=>'test2')) |
|
1951 | + ); |
|
1952 | 1952 | |
1953 | - $result = $inboundEmail->retrieveAttachmentNameFromStructure($part); |
|
1954 | - $this->assertEquals('test1.txt', $result); |
|
1953 | + $result = $inboundEmail->retrieveAttachmentNameFromStructure($part); |
|
1954 | + $this->assertEquals('test1.txt', $result); |
|
1955 | 1955 | |
1956 | 1956 | |
1957 | 1957 | |
1958 | - //test with no filename attribute |
|
1959 | - $part = (Object) array('dparameters'=> array((Object) array('attribute'=>'name','value'=>'test1.txt')), |
|
1960 | - 'parameters'=> array((Object) array('attribute'=>'name','value'=>'test1'),(Object) array('attribute'=>'name','value'=>'test2')) |
|
1958 | + //test with no filename attribute |
|
1959 | + $part = (Object) array('dparameters'=> array((Object) array('attribute'=>'name','value'=>'test1.txt')), |
|
1960 | + 'parameters'=> array((Object) array('attribute'=>'name','value'=>'test1'),(Object) array('attribute'=>'name','value'=>'test2')) |
|
1961 | 1961 | |
1962 | - ); |
|
1962 | + ); |
|
1963 | 1963 | |
1964 | - $result = $inboundEmail->retrieveAttachmentNameFromStructure($part); |
|
1965 | - $this->assertEquals('test1', $result); |
|
1964 | + $result = $inboundEmail->retrieveAttachmentNameFromStructure($part); |
|
1965 | + $this->assertEquals('test1', $result); |
|
1966 | 1966 | |
1967 | 1967 | |
1968 | 1968 | |
1969 | - } |
|
1969 | + } |
|
1970 | 1970 | |
1971 | - public function testsaveAttachmentBinaries() { |
|
1971 | + public function testsaveAttachmentBinaries() { |
|
1972 | 1972 | |
1973 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
1974 | - global $db; |
|
1975 | - unset ($db->database); |
|
1976 | - $db->checkConnection(); |
|
1973 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
1974 | + global $db; |
|
1975 | + unset ($db->database); |
|
1976 | + $db->checkConnection(); |
|
1977 | 1977 | |
1978 | - $inboundEmail = new InboundEmail(); |
|
1978 | + $inboundEmail = new InboundEmail(); |
|
1979 | 1979 | |
1980 | - $part = (Object) array("disposition" => "multipart", "subtype" => 10); |
|
1980 | + $part = (Object) array("disposition" => "multipart", "subtype" => 10); |
|
1981 | 1981 | |
1982 | - //execute the method and test if it works and does not throws an exception. |
|
1983 | - try { |
|
1984 | - $inboundEmail->saveAttachmentBinaries(new Note(), "1", "1.1", $part, 1); |
|
1985 | - $this->assertTrue(true); |
|
1986 | - } |
|
1987 | - catch (Exception $e) { |
|
1988 | - $this->fail(); |
|
1989 | - } |
|
1982 | + //execute the method and test if it works and does not throws an exception. |
|
1983 | + try { |
|
1984 | + $inboundEmail->saveAttachmentBinaries(new Note(), "1", "1.1", $part, 1); |
|
1985 | + $this->assertTrue(true); |
|
1986 | + } |
|
1987 | + catch (Exception $e) { |
|
1988 | + $this->fail(); |
|
1989 | + } |
|
1990 | 1990 | |
1991 | - } |
|
1991 | + } |
|
1992 | 1992 | |
1993 | 1993 | |
1994 | - public function testhandleTranserEncoding() { |
|
1994 | + public function testhandleTranserEncoding() { |
|
1995 | 1995 | |
1996 | - $inboundEmail = new InboundEmail(); |
|
1996 | + $inboundEmail = new InboundEmail(); |
|
1997 | 1997 | |
1998 | - $this->assertEquals("test", $inboundEmail->handleTranserEncoding("test")); |
|
1999 | - $this->assertEquals("test", $inboundEmail->handleTranserEncoding("dGVzdA==",3)); |
|
2000 | - $this->assertEquals("test", $inboundEmail->handleTranserEncoding("test",4)); |
|
1998 | + $this->assertEquals("test", $inboundEmail->handleTranserEncoding("test")); |
|
1999 | + $this->assertEquals("test", $inboundEmail->handleTranserEncoding("dGVzdA==",3)); |
|
2000 | + $this->assertEquals("test", $inboundEmail->handleTranserEncoding("test",4)); |
|
2001 | 2001 | |
2002 | - } |
|
2002 | + } |
|
2003 | 2003 | |
2004 | 2004 | |
2005 | 2005 | |
2006 | - public function testgetMessageId() { |
|
2006 | + public function testgetMessageId() { |
|
2007 | 2007 | |
2008 | - $inboundEmail = new InboundEmail(); |
|
2008 | + $inboundEmail = new InboundEmail(); |
|
2009 | 2009 | |
2010 | - $header = "From: Media Temple user ([email protected])\r\nSubject: article: How to Trace a Email\r\nDate: January 25, 2011 3:30:58 PM PDT\r\nTo: [email protected]\r\nReturn-Path: <[email protected]>\r\nEnvelope-To: [email protected]\r\nDelivery-Date: Tue, 25 Jan 2011 15:31:01 -0700"; |
|
2010 | + $header = "From: Media Temple user ([email protected])\r\nSubject: article: How to Trace a Email\r\nDate: January 25, 2011 3:30:58 PM PDT\r\nTo: [email protected]\r\nReturn-Path: <[email protected]>\r\nEnvelope-To: [email protected]\r\nDelivery-Date: Tue, 25 Jan 2011 15:31:01 -0700"; |
|
2011 | 2011 | |
2012 | - $result = $inboundEmail->getMessageId($header); |
|
2012 | + $result = $inboundEmail->getMessageId($header); |
|
2013 | 2013 | |
2014 | - $this->assertEquals("21c65f7db176f0bd93768214b00ae397", $result); |
|
2014 | + $this->assertEquals("21c65f7db176f0bd93768214b00ae397", $result); |
|
2015 | 2015 | |
2016 | 2016 | |
2017 | - } |
|
2017 | + } |
|
2018 | 2018 | |
2019 | 2019 | |
2020 | - public function testimportDupeCheck() { |
|
2020 | + public function testimportDupeCheck() { |
|
2021 | 2021 | |
2022 | - $inboundEmail = new InboundEmail(); |
|
2022 | + $inboundEmail = new InboundEmail(); |
|
2023 | 2023 | |
2024 | - $textHeader = "From: Media Temple user ([email protected])\r\nSubject: article: How to Trace a Email\r\nDate: January 25, 2011 3:30:58 PM PDT\r\nTo: [email protected]\r\nReturn-Path: <[email protected]>\r\nEnvelope-To: [email protected]\r\nDelivery-Date: Tue, 25 Jan 2011 15:31:01 -0700"; |
|
2024 | + $textHeader = "From: Media Temple user ([email protected])\r\nSubject: article: How to Trace a Email\r\nDate: January 25, 2011 3:30:58 PM PDT\r\nTo: [email protected]\r\nReturn-Path: <[email protected]>\r\nEnvelope-To: [email protected]\r\nDelivery-Date: Tue, 25 Jan 2011 15:31:01 -0700"; |
|
2025 | 2025 | |
2026 | - $result = $inboundEmail->importDupeCheck("1", $textHeader, $textHeader); |
|
2027 | - $this->assertEquals(true ,$result); |
|
2026 | + $result = $inboundEmail->importDupeCheck("1", $textHeader, $textHeader); |
|
2027 | + $this->assertEquals(true ,$result); |
|
2028 | 2028 | |
2029 | - } |
|
2029 | + } |
|
2030 | 2030 | |
2031 | 2031 | |
2032 | - public function testhandleMimeHeaderDecode() { |
|
2032 | + public function testhandleMimeHeaderDecode() { |
|
2033 | 2033 | |
2034 | - $inboundEmail = new InboundEmail(); |
|
2034 | + $inboundEmail = new InboundEmail(); |
|
2035 | 2035 | |
2036 | - $result = $inboundEmail->handleMimeHeaderDecode("Subject: article: How to Trace a Email"); |
|
2036 | + $result = $inboundEmail->handleMimeHeaderDecode("Subject: article: How to Trace a Email"); |
|
2037 | 2037 | |
2038 | - $this->assertEquals("Subject: article: How to Trace a Email" ,$result); |
|
2038 | + $this->assertEquals("Subject: article: How to Trace a Email" ,$result); |
|
2039 | 2039 | |
2040 | - } |
|
2040 | + } |
|
2041 | 2041 | |
2042 | 2042 | |
2043 | - public function testgetUnixHeaderDate() { |
|
2043 | + public function testgetUnixHeaderDate() { |
|
2044 | 2044 | |
2045 | - $inboundEmail = new InboundEmail(); |
|
2045 | + $inboundEmail = new InboundEmail(); |
|
2046 | 2046 | |
2047 | - $result = $inboundEmail->handleMimeHeaderDecode("Date: January 25, 2011 3:30:58 PM PDT"); |
|
2047 | + $result = $inboundEmail->handleMimeHeaderDecode("Date: January 25, 2011 3:30:58 PM PDT"); |
|
2048 | 2048 | |
2049 | - $this->assertEquals("Date: January 25, 2011 3:30:58 PM PDT" ,$result); |
|
2049 | + $this->assertEquals("Date: January 25, 2011 3:30:58 PM PDT" ,$result); |
|
2050 | 2050 | |
2051 | - } |
|
2051 | + } |
|
2052 | 2052 | |
2053 | 2053 | |
2054 | - public function testgetDuplicateEmailId() { |
|
2054 | + public function testgetDuplicateEmailId() { |
|
2055 | 2055 | |
2056 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
2057 | - global $db; |
|
2058 | - unset ($db->database); |
|
2059 | - $db->checkConnection(); |
|
2056 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
2057 | + global $db; |
|
2058 | + unset ($db->database); |
|
2059 | + $db->checkConnection(); |
|
2060 | 2060 | |
2061 | - $inboundEmail = new InboundEmail(); |
|
2061 | + $inboundEmail = new InboundEmail(); |
|
2062 | 2062 | |
2063 | - //execute the method and test if it works and does not throws an exception. |
|
2064 | - try { |
|
2065 | - $result = $inboundEmail->getDuplicateEmailId("1", "1"); |
|
2066 | - $this->assertTrue(true); |
|
2067 | - } |
|
2068 | - catch (Exception $e) { |
|
2069 | - $this->fail(); |
|
2070 | - } |
|
2063 | + //execute the method and test if it works and does not throws an exception. |
|
2064 | + try { |
|
2065 | + $result = $inboundEmail->getDuplicateEmailId("1", "1"); |
|
2066 | + $this->assertTrue(true); |
|
2067 | + } |
|
2068 | + catch (Exception $e) { |
|
2069 | + $this->fail(); |
|
2070 | + } |
|
2071 | 2071 | |
2072 | - } |
|
2072 | + } |
|
2073 | 2073 | |
2074 | 2074 | |
2075 | 2075 | |
2076 | - public function testimportOneEmail() { |
|
2076 | + public function testimportOneEmail() { |
|
2077 | 2077 | |
2078 | 2078 | |
2079 | - $inboundEmail = new InboundEmail(); |
|
2079 | + $inboundEmail = new InboundEmail(); |
|
2080 | 2080 | |
2081 | - $inboundEmail->mailbox = "INBOX"; |
|
2082 | - $inboundEmail->id = 1; |
|
2081 | + $inboundEmail->mailbox = "INBOX"; |
|
2082 | + $inboundEmail->id = 1; |
|
2083 | 2083 | |
2084 | - //execute the method and test if it works and does not throws an exception. |
|
2085 | - try { |
|
2086 | - $result = $inboundEmail->importOneEmail("1", "1"); |
|
2087 | - $this->assertEquals(false,$result); |
|
2088 | - } |
|
2089 | - catch (Exception $e) { |
|
2090 | - $this->fail(); |
|
2091 | - } |
|
2084 | + //execute the method and test if it works and does not throws an exception. |
|
2085 | + try { |
|
2086 | + $result = $inboundEmail->importOneEmail("1", "1"); |
|
2087 | + $this->assertEquals(false,$result); |
|
2088 | + } |
|
2089 | + catch (Exception $e) { |
|
2090 | + $this->fail(); |
|
2091 | + } |
|
2092 | 2092 | |
2093 | - } |
|
2093 | + } |
|
2094 | 2094 | |
2095 | 2095 | |
2096 | - public function testisUuencode() { |
|
2096 | + public function testisUuencode() { |
|
2097 | 2097 | |
2098 | - $inboundEmail = new InboundEmail(); |
|
2098 | + $inboundEmail = new InboundEmail(); |
|
2099 | 2099 | |
2100 | - $this->assertEquals(false, $inboundEmail->isUuencode("test")); |
|
2100 | + $this->assertEquals(false, $inboundEmail->isUuencode("test")); |
|
2101 | 2101 | |
2102 | - $this->assertEquals(false, $inboundEmail->isUuencode("begin 0744 odt_uuencoding_file.dat\r+=&5S=\"!S=')I;F<`\r`\rend")); |
|
2102 | + $this->assertEquals(false, $inboundEmail->isUuencode("begin 0744 odt_uuencoding_file.dat\r+=&5S=\"!S=')I;F<`\r`\rend")); |
|
2103 | 2103 | |
2104 | - } |
|
2104 | + } |
|
2105 | 2105 | |
2106 | 2106 | |
2107 | - public function testhandleUUEncodedEmailBody() { |
|
2107 | + public function testhandleUUEncodedEmailBody() { |
|
2108 | 2108 | |
2109 | - $inboundEmail = new InboundEmail(); |
|
2109 | + $inboundEmail = new InboundEmail(); |
|
2110 | 2110 | |
2111 | - $raw = "Message Body: This is a KnowledgeBase article that provides information on how to find email headers and use the data to trace a email."; |
|
2111 | + $raw = "Message Body: This is a KnowledgeBase article that provides information on how to find email headers and use the data to trace a email."; |
|
2112 | 2112 | |
2113 | - $result = $inboundEmail->handleUUEncodedEmailBody($raw, 1); |
|
2113 | + $result = $inboundEmail->handleUUEncodedEmailBody($raw, 1); |
|
2114 | 2114 | |
2115 | - $this->assertEquals("\n" . $raw ,$result); |
|
2115 | + $this->assertEquals("\n" . $raw ,$result); |
|
2116 | 2116 | |
2117 | 2117 | |
2118 | - } |
|
2118 | + } |
|
2119 | 2119 | |
2120 | 2120 | |
2121 | - public function testhandleUUDecode() { |
|
2121 | + public function testhandleUUDecode() { |
|
2122 | 2122 | |
2123 | - /* |
|
2123 | + /* |
|
2124 | 2124 | //unset and reconnect Db to resolve mysqli fetch exeception |
2125 | 2125 | global $db; |
2126 | 2126 | unset ($db->database); |
@@ -2134,795 +2134,795 @@ discard block |
||
2134 | 2134 | $inboundEmail->handleUUDecode("1", "handleUUDecode_test", $raw); |
2135 | 2135 | |
2136 | 2136 | */ |
2137 | - $this->markTestIncomplete('Uncaught require_once(include/PHP_Compat/convert_uudecode.php)'); |
|
2137 | + $this->markTestIncomplete('Uncaught require_once(include/PHP_Compat/convert_uudecode.php)'); |
|
2138 | 2138 | |
2139 | - } |
|
2139 | + } |
|
2140 | 2140 | |
2141 | 2141 | |
2142 | - public function testcheckFilterDomain() { |
|
2142 | + public function testcheckFilterDomain() { |
|
2143 | 2143 | |
2144 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
2145 | - global $db; |
|
2146 | - unset ($db->database); |
|
2147 | - $db->checkConnection(); |
|
2144 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
2145 | + global $db; |
|
2146 | + unset ($db->database); |
|
2147 | + $db->checkConnection(); |
|
2148 | 2148 | |
2149 | - $inboundEmail = new InboundEmail(); |
|
2149 | + $inboundEmail = new InboundEmail(); |
|
2150 | 2150 | |
2151 | - $email = new Email(); |
|
2152 | - $email->reply_to_email = "[email protected]"; |
|
2153 | - $email->from_addr = "[email protected]"; |
|
2151 | + $email = new Email(); |
|
2152 | + $email->reply_to_email = "[email protected]"; |
|
2153 | + $email->from_addr = "[email protected]"; |
|
2154 | 2154 | |
2155 | - $result = $inboundEmail->checkFilterDomain($email); |
|
2156 | - $this->assertEquals(true, $result); |
|
2155 | + $result = $inboundEmail->checkFilterDomain($email); |
|
2156 | + $this->assertEquals(true, $result); |
|
2157 | 2157 | |
2158 | - } |
|
2158 | + } |
|
2159 | 2159 | |
2160 | 2160 | |
2161 | - public function testcheckOutOfOffice() { |
|
2161 | + public function testcheckOutOfOffice() { |
|
2162 | 2162 | |
2163 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
2164 | - global $db; |
|
2165 | - unset ($db->database); |
|
2166 | - $db->checkConnection(); |
|
2163 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
2164 | + global $db; |
|
2165 | + unset ($db->database); |
|
2166 | + $db->checkConnection(); |
|
2167 | 2167 | |
2168 | - $inboundEmail = new InboundEmail(); |
|
2168 | + $inboundEmail = new InboundEmail(); |
|
2169 | 2169 | |
2170 | - $this->assertEquals(false, $inboundEmail->checkOutOfOffice("currently Out of Office, will reply later") ); |
|
2171 | - $this->assertEquals(true, $inboundEmail->checkOutOfOffice("test subject") ); |
|
2170 | + $this->assertEquals(false, $inboundEmail->checkOutOfOffice("currently Out of Office, will reply later") ); |
|
2171 | + $this->assertEquals(true, $inboundEmail->checkOutOfOffice("test subject") ); |
|
2172 | 2172 | |
2173 | - } |
|
2173 | + } |
|
2174 | 2174 | |
2175 | 2175 | |
2176 | 2176 | |
2177 | - public function testsetAndgetAutoreplyStatus() { |
|
2177 | + public function testsetAndgetAutoreplyStatus() { |
|
2178 | 2178 | |
2179 | 2179 | |
2180 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
2181 | - global $db; |
|
2182 | - unset ($db->database); |
|
2183 | - $db->checkConnection(); |
|
2180 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
2181 | + global $db; |
|
2182 | + unset ($db->database); |
|
2183 | + $db->checkConnection(); |
|
2184 | 2184 | |
2185 | - $inboundEmail = new InboundEmail(); |
|
2185 | + $inboundEmail = new InboundEmail(); |
|
2186 | 2186 | |
2187 | - $inboundEmail->id =1; |
|
2187 | + $inboundEmail->id =1; |
|
2188 | 2188 | |
2189 | 2189 | |
2190 | - //execute the setAutoreplyStatus method to set an auto reply status for email |
|
2191 | - $inboundEmail->setAutoreplyStatus("[email protected]"); |
|
2190 | + //execute the setAutoreplyStatus method to set an auto reply status for email |
|
2191 | + $inboundEmail->setAutoreplyStatus("[email protected]"); |
|
2192 | 2192 | |
2193 | 2193 | |
2194 | - //test with and invalid email. it will return true as well because it's stil under max limit. |
|
2195 | - $result = $inboundEmail->getAutoreplyStatus("[email protected]"); |
|
2196 | - $this->assertEquals(true ,$result); |
|
2194 | + //test with and invalid email. it will return true as well because it's stil under max limit. |
|
2195 | + $result = $inboundEmail->getAutoreplyStatus("[email protected]"); |
|
2196 | + $this->assertEquals(true ,$result); |
|
2197 | 2197 | |
2198 | - } |
|
2198 | + } |
|
2199 | 2199 | |
2200 | 2200 | |
2201 | - public function testsaveInboundEmailSystemSettings() { |
|
2201 | + public function testsaveInboundEmailSystemSettings() { |
|
2202 | 2202 | |
2203 | - global $sugar_config, $db; |
|
2203 | + global $sugar_config, $db; |
|
2204 | 2204 | |
2205 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
2206 | - unset ($db->database); |
|
2207 | - $db->checkConnection(); |
|
2205 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
2206 | + unset ($db->database); |
|
2207 | + $db->checkConnection(); |
|
2208 | 2208 | |
2209 | - $inboundEmail = new InboundEmail(); |
|
2209 | + $inboundEmail = new InboundEmail(); |
|
2210 | 2210 | |
2211 | 2211 | |
2212 | - //execute the method to save the setting |
|
2213 | - $inboundEmail->saveInboundEmailSystemSettings("test", "test_macro"); |
|
2212 | + //execute the method to save the setting |
|
2213 | + $inboundEmail->saveInboundEmailSystemSettings("test", "test_macro"); |
|
2214 | 2214 | |
2215 | 2215 | |
2216 | - //verify the key created |
|
2217 | - $this->assertEquals("test_macro", $sugar_config["inbound_email_test_subject_macro"]); |
|
2216 | + //verify the key created |
|
2217 | + $this->assertEquals("test_macro", $sugar_config["inbound_email_test_subject_macro"]); |
|
2218 | 2218 | |
2219 | - } |
|
2219 | + } |
|
2220 | 2220 | |
2221 | 2221 | |
2222 | - public function testgetSystemSettingsForm() { |
|
2222 | + public function testgetSystemSettingsForm() { |
|
2223 | 2223 | |
2224 | 2224 | |
2225 | - $inboundEmail = new InboundEmail(); |
|
2225 | + $inboundEmail = new InboundEmail(); |
|
2226 | 2226 | |
2227 | - $expected = " <form action=\"index.php\" method=\"post\" name=\"Macro\" id=\"form\">\n <input type=\"hidden\" name=\"module\" value=\"InboundEmail\">\n <input type=\"hidden\" name=\"action\" value=\"ListView\">\n <input type=\"hidden\" name=\"save\" value=\"true\">\n\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td>\n <input title=\"Save\"\n accessKey=\"a\"\n class=\"button\"\n onclick=\"this.form.return_module.value='InboundEmail'; this.form.return_action.value='ListView';\"\n type=\"submit\" name=\"Edit\" value=\" Save \">\n </td>\n </tr>\n </table>\n\n <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"detail view\">\n <tr>\n <td valign=\"top\" width='10%' NOWRAP scope=\"row\">\n <slot>\n <b>:</b>\n </slot>\n </td>\n <td valign=\"top\" width='20%'>\n <slot>\n <input name=\"inbound_email_case_macro\" type=\"text\" value=\"[CASE:%1]\">\n </slot>\n </td>\n <td valign=\"top\" width='70%'>\n <slot>\n \n <br />\n <i></i>\n </slot>\n </td>\n </tr>\n </table>\n </form>"; |
|
2228 | - $result = $inboundEmail->getSystemSettingsForm(); |
|
2227 | + $expected = " <form action=\"index.php\" method=\"post\" name=\"Macro\" id=\"form\">\n <input type=\"hidden\" name=\"module\" value=\"InboundEmail\">\n <input type=\"hidden\" name=\"action\" value=\"ListView\">\n <input type=\"hidden\" name=\"save\" value=\"true\">\n\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td>\n <input title=\"Save\"\n accessKey=\"a\"\n class=\"button\"\n onclick=\"this.form.return_module.value='InboundEmail'; this.form.return_action.value='ListView';\"\n type=\"submit\" name=\"Edit\" value=\" Save \">\n </td>\n </tr>\n </table>\n\n <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"detail view\">\n <tr>\n <td valign=\"top\" width='10%' NOWRAP scope=\"row\">\n <slot>\n <b>:</b>\n </slot>\n </td>\n <td valign=\"top\" width='20%'>\n <slot>\n <input name=\"inbound_email_case_macro\" type=\"text\" value=\"[CASE:%1]\">\n </slot>\n </td>\n <td valign=\"top\" width='70%'>\n <slot>\n \n <br />\n <i></i>\n </slot>\n </td>\n </tr>\n </table>\n </form>"; |
|
2228 | + $result = $inboundEmail->getSystemSettingsForm(); |
|
2229 | 2229 | |
2230 | - $this->assertSame($expected,$result); |
|
2230 | + $this->assertSame($expected,$result); |
|
2231 | 2231 | |
2232 | - } |
|
2232 | + } |
|
2233 | 2233 | |
2234 | 2234 | |
2235 | - public function testgetCaseIdFromCaseNumber() { |
|
2235 | + public function testgetCaseIdFromCaseNumber() { |
|
2236 | 2236 | |
2237 | - $inboundEmail = new InboundEmail(); |
|
2237 | + $inboundEmail = new InboundEmail(); |
|
2238 | 2238 | |
2239 | - $result = $inboundEmail->getCaseIdFromCaseNumber("test", new aCase()); |
|
2240 | - $this->assertEquals(false, $result); |
|
2239 | + $result = $inboundEmail->getCaseIdFromCaseNumber("test", new aCase()); |
|
2240 | + $this->assertEquals(false, $result); |
|
2241 | 2241 | |
2242 | 2242 | } |
2243 | 2243 | |
2244 | - public function testget_stored_options() { |
|
2244 | + public function testget_stored_options() { |
|
2245 | 2245 | |
2246 | - $inboundEmail = new InboundEmail(); |
|
2246 | + $inboundEmail = new InboundEmail(); |
|
2247 | 2247 | |
2248 | - $result = $inboundEmail->get_stored_options("test",""); |
|
2249 | - $this->assertEquals("", $result); |
|
2248 | + $result = $inboundEmail->get_stored_options("test",""); |
|
2249 | + $this->assertEquals("", $result); |
|
2250 | 2250 | |
2251 | 2251 | |
2252 | - $result = $inboundEmail->get_stored_options("test","default_option"); |
|
2253 | - $this->assertEquals("default_option", $result); |
|
2252 | + $result = $inboundEmail->get_stored_options("test","default_option"); |
|
2253 | + $this->assertEquals("default_option", $result); |
|
2254 | 2254 | |
2255 | - } |
|
2255 | + } |
|
2256 | 2256 | |
2257 | 2257 | |
2258 | 2258 | |
2259 | - public function testgetRelatedId() { |
|
2259 | + public function testgetRelatedId() { |
|
2260 | 2260 | |
2261 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
2262 | - global $db; |
|
2263 | - unset ($db->database); |
|
2264 | - $db->checkConnection(); |
|
2261 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
2262 | + global $db; |
|
2263 | + unset ($db->database); |
|
2264 | + $db->checkConnection(); |
|
2265 | 2265 | |
2266 | - $inboundEmail = new InboundEmail(); |
|
2266 | + $inboundEmail = new InboundEmail(); |
|
2267 | 2267 | |
2268 | 2268 | |
2269 | - //test with Users module |
|
2270 | - $inboundEmail->getRelatedId("[email protected]", "Users"); |
|
2271 | - $this->assertEquals(false, $result); |
|
2269 | + //test with Users module |
|
2270 | + $inboundEmail->getRelatedId("[email protected]", "Users"); |
|
2271 | + $this->assertEquals(false, $result); |
|
2272 | 2272 | |
2273 | 2273 | |
2274 | - //test with Contacts module |
|
2275 | - $inboundEmail->getRelatedId("[email protected]", "Contacts"); |
|
2276 | - $this->assertEquals(false, $result); |
|
2274 | + //test with Contacts module |
|
2275 | + $inboundEmail->getRelatedId("[email protected]", "Contacts"); |
|
2276 | + $this->assertEquals(false, $result); |
|
2277 | 2277 | |
2278 | - } |
|
2278 | + } |
|
2279 | 2279 | |
2280 | 2280 | |
2281 | - public function testgetNewMessageIds() { |
|
2281 | + public function testgetNewMessageIds() { |
|
2282 | 2282 | |
2283 | - $inboundEmail = new InboundEmail(); |
|
2283 | + $inboundEmail = new InboundEmail(); |
|
2284 | 2284 | |
2285 | - $result = $inboundEmail->getNewMessageIds(); |
|
2285 | + $result = $inboundEmail->getNewMessageIds(); |
|
2286 | 2286 | |
2287 | - $this->assertEquals(null, $result); |
|
2287 | + $this->assertEquals(null, $result); |
|
2288 | 2288 | |
2289 | - } |
|
2289 | + } |
|
2290 | 2290 | |
2291 | 2291 | |
2292 | - public function testgetConnectString() { |
|
2292 | + public function testgetConnectString() { |
|
2293 | 2293 | |
2294 | - $inboundEmail = new InboundEmail(); |
|
2294 | + $inboundEmail = new InboundEmail(); |
|
2295 | 2295 | |
2296 | - $this->assertEquals("{:/service=}", $inboundEmail->getConnectString()); //test with default options |
|
2297 | - $this->assertEquals("{:/service=mail.google.com}INBOX", $inboundEmail->getConnectString("mail.google.com","INBOX"));//test with includeMbox true |
|
2298 | - $this->assertEquals("{:/service=mail.google.com}", $inboundEmail->getConnectString("mail.google.com","INBOX",false));//test with includeMbox false |
|
2296 | + $this->assertEquals("{:/service=}", $inboundEmail->getConnectString()); //test with default options |
|
2297 | + $this->assertEquals("{:/service=mail.google.com}INBOX", $inboundEmail->getConnectString("mail.google.com","INBOX"));//test with includeMbox true |
|
2298 | + $this->assertEquals("{:/service=mail.google.com}", $inboundEmail->getConnectString("mail.google.com","INBOX",false));//test with includeMbox false |
|
2299 | 2299 | |
2300 | - } |
|
2300 | + } |
|
2301 | 2301 | |
2302 | - public function testdisconnectMailserver() { |
|
2302 | + public function testdisconnectMailserver() { |
|
2303 | 2303 | |
2304 | - $inboundEmail = new InboundEmail(); |
|
2304 | + $inboundEmail = new InboundEmail(); |
|
2305 | 2305 | |
2306 | - //execute the method and test if it works and does not throws an exception. |
|
2307 | - try { |
|
2308 | - $inboundEmail->disconnectMailserver(); |
|
2309 | - $this->assertTrue(true); |
|
2310 | - } |
|
2311 | - catch (Exception $e) { |
|
2312 | - $this->fail(); |
|
2313 | - } |
|
2306 | + //execute the method and test if it works and does not throws an exception. |
|
2307 | + try { |
|
2308 | + $inboundEmail->disconnectMailserver(); |
|
2309 | + $this->assertTrue(true); |
|
2310 | + } |
|
2311 | + catch (Exception $e) { |
|
2312 | + $this->fail(); |
|
2313 | + } |
|
2314 | 2314 | |
2315 | - } |
|
2315 | + } |
|
2316 | 2316 | |
2317 | 2317 | |
2318 | - public function testconnectMailserver() { |
|
2318 | + public function testconnectMailserver() { |
|
2319 | 2319 | |
2320 | - $inboundEmail = new InboundEmail(); |
|
2320 | + $inboundEmail = new InboundEmail(); |
|
2321 | 2321 | |
2322 | - //test with default parameters |
|
2323 | - $result = $inboundEmail->connectMailserver(); |
|
2324 | - $this->assertEquals("false", $result); |
|
2322 | + //test with default parameters |
|
2323 | + $result = $inboundEmail->connectMailserver(); |
|
2324 | + $this->assertEquals("false", $result); |
|
2325 | 2325 | |
2326 | - //test with test and force true |
|
2327 | - $result = $inboundEmail->connectMailserver(true, true); |
|
2328 | - $this->assertEquals("Can't open mailbox {:/service=}: invalid remote specification<p><p><p>", $result); |
|
2326 | + //test with test and force true |
|
2327 | + $result = $inboundEmail->connectMailserver(true, true); |
|
2328 | + $this->assertEquals("Can't open mailbox {:/service=}: invalid remote specification<p><p><p>", $result); |
|
2329 | 2329 | |
2330 | - } |
|
2330 | + } |
|
2331 | 2331 | |
2332 | 2332 | |
2333 | - public function testcheckImap() { |
|
2333 | + public function testcheckImap() { |
|
2334 | 2334 | |
2335 | - $inboundEmail = new InboundEmail(); |
|
2335 | + $inboundEmail = new InboundEmail(); |
|
2336 | 2336 | |
2337 | - //execute the method and test if it works and does not throws an exception. |
|
2338 | - try { |
|
2339 | - $inboundEmail->checkImap(); |
|
2340 | - $this->assertTrue(true); |
|
2341 | - } |
|
2342 | - catch (Exception $e) { |
|
2343 | - $this->fail(); |
|
2344 | - } |
|
2337 | + //execute the method and test if it works and does not throws an exception. |
|
2338 | + try { |
|
2339 | + $inboundEmail->checkImap(); |
|
2340 | + $this->assertTrue(true); |
|
2341 | + } |
|
2342 | + catch (Exception $e) { |
|
2343 | + $this->fail(); |
|
2344 | + } |
|
2345 | 2345 | |
2346 | - } |
|
2346 | + } |
|
2347 | 2347 | |
2348 | 2348 | |
2349 | - public function testget_summary_text() { |
|
2349 | + public function testget_summary_text() { |
|
2350 | 2350 | |
2351 | - $inboundEmail = new InboundEmail(); |
|
2351 | + $inboundEmail = new InboundEmail(); |
|
2352 | 2352 | |
2353 | - //test without setting name |
|
2354 | - $this->assertEquals(Null,$inboundEmail->get_summary_text()); |
|
2353 | + //test without setting name |
|
2354 | + $this->assertEquals(Null,$inboundEmail->get_summary_text()); |
|
2355 | 2355 | |
2356 | - //test with name set |
|
2357 | - $inboundEmail->name = "test"; |
|
2358 | - $this->assertEquals('test',$inboundEmail->get_summary_text()); |
|
2356 | + //test with name set |
|
2357 | + $inboundEmail->name = "test"; |
|
2358 | + $this->assertEquals('test',$inboundEmail->get_summary_text()); |
|
2359 | 2359 | |
2360 | - } |
|
2360 | + } |
|
2361 | 2361 | |
2362 | 2362 | |
2363 | - public function testcreate_export_query() { |
|
2363 | + public function testcreate_export_query() { |
|
2364 | 2364 | |
2365 | - $inboundEmail = new InboundEmail(); |
|
2365 | + $inboundEmail = new InboundEmail(); |
|
2366 | 2366 | |
2367 | - //test with empty string params |
|
2368 | - $expected = " SELECT inbound_email.* , jt0.user_name created_by_name , jt0.created_by created_by_name_owner , 'Users' created_by_name_mod FROM inbound_email LEFT JOIN users jt0 ON jt0.id=inbound_email.created_by AND jt0.deleted=0\n AND jt0.deleted=0 where inbound_email.deleted=0"; |
|
2369 | - $actual = $inboundEmail->create_export_query('',''); |
|
2370 | - $this->assertSame($expected,$actual); |
|
2367 | + //test with empty string params |
|
2368 | + $expected = " SELECT inbound_email.* , jt0.user_name created_by_name , jt0.created_by created_by_name_owner , 'Users' created_by_name_mod FROM inbound_email LEFT JOIN users jt0 ON jt0.id=inbound_email.created_by AND jt0.deleted=0\n AND jt0.deleted=0 where inbound_email.deleted=0"; |
|
2369 | + $actual = $inboundEmail->create_export_query('',''); |
|
2370 | + $this->assertSame($expected,$actual); |
|
2371 | 2371 | |
2372 | 2372 | |
2373 | - //test with valid string params |
|
2374 | - $expected = " SELECT inbound_email.* , jt0.user_name created_by_name , jt0.created_by created_by_name_owner , 'Users' created_by_name_mod FROM inbound_email LEFT JOIN users jt0 ON jt0.id=inbound_email.created_by AND jt0.deleted=0\n AND jt0.deleted=0 where (jt0.user_name=\"\") AND inbound_email.deleted=0 ORDER BY inbound_email.id"; |
|
2375 | - $actual = $inboundEmail->create_export_query('id','jt0.user_name=""'); |
|
2376 | - $this->assertSame($expected,$actual); |
|
2373 | + //test with valid string params |
|
2374 | + $expected = " SELECT inbound_email.* , jt0.user_name created_by_name , jt0.created_by created_by_name_owner , 'Users' created_by_name_mod FROM inbound_email LEFT JOIN users jt0 ON jt0.id=inbound_email.created_by AND jt0.deleted=0\n AND jt0.deleted=0 where (jt0.user_name=\"\") AND inbound_email.deleted=0 ORDER BY inbound_email.id"; |
|
2375 | + $actual = $inboundEmail->create_export_query('id','jt0.user_name=""'); |
|
2376 | + $this->assertSame($expected,$actual); |
|
2377 | 2377 | |
2378 | - } |
|
2378 | + } |
|
2379 | 2379 | |
2380 | - public function testget_list_view_data(){ |
|
2380 | + public function testget_list_view_data(){ |
|
2381 | 2381 | |
2382 | - $inboundEmail = new InboundEmail(); |
|
2382 | + $inboundEmail = new InboundEmail(); |
|
2383 | 2383 | |
2384 | - $inboundEmail->mailbox_type = "INBOX"; |
|
2385 | - $inboundEmail->status = "Active"; |
|
2384 | + $inboundEmail->mailbox_type = "INBOX"; |
|
2385 | + $inboundEmail->status = "Active"; |
|
2386 | 2386 | |
2387 | - $result = $inboundEmail->get_list_view_data(); |
|
2387 | + $result = $inboundEmail->get_list_view_data(); |
|
2388 | 2388 | |
2389 | - $expected = array( |
|
2390 | - 'DELETED' => '0', |
|
2391 | - 'STATUS' => NULL, |
|
2392 | - 'DELETE_SEEN' => '0', |
|
2393 | - 'MAILBOX_TYPE' => 'INBOX', |
|
2394 | - 'IS_PERSONAL' => '0', |
|
2395 | - 'MAILBOX_TYPE_NAME' => NULL, |
|
2396 | - 'GLOBAL_PERSONAL_STRING' => NULL, |
|
2397 | - ); |
|
2389 | + $expected = array( |
|
2390 | + 'DELETED' => '0', |
|
2391 | + 'STATUS' => NULL, |
|
2392 | + 'DELETE_SEEN' => '0', |
|
2393 | + 'MAILBOX_TYPE' => 'INBOX', |
|
2394 | + 'IS_PERSONAL' => '0', |
|
2395 | + 'MAILBOX_TYPE_NAME' => NULL, |
|
2396 | + 'GLOBAL_PERSONAL_STRING' => NULL, |
|
2397 | + ); |
|
2398 | 2398 | |
2399 | - $this->assertTrue(is_array($result)); |
|
2400 | - $this->assertEquals($expected, $result); |
|
2399 | + $this->assertTrue(is_array($result)); |
|
2400 | + $this->assertEquals($expected, $result); |
|
2401 | 2401 | |
2402 | - $result = $inboundEmail->get_list_view_data(); |
|
2402 | + $result = $inboundEmail->get_list_view_data(); |
|
2403 | 2403 | |
2404 | - } |
|
2404 | + } |
|
2405 | 2405 | |
2406 | 2406 | |
2407 | - public function testfill_in_additional_list_fields() { |
|
2407 | + public function testfill_in_additional_list_fields() { |
|
2408 | 2408 | |
2409 | - $inboundEmail = new InboundEmail(); |
|
2409 | + $inboundEmail = new InboundEmail(); |
|
2410 | 2410 | |
2411 | - $inboundEmail->service = "tls::ca::ssl::protocol"; |
|
2411 | + $inboundEmail->service = "tls::ca::ssl::protocol"; |
|
2412 | 2412 | |
2413 | - $result = $inboundEmail->fill_in_additional_list_fields(); |
|
2413 | + $result = $inboundEmail->fill_in_additional_list_fields(); |
|
2414 | 2414 | |
2415 | - $this->assertEquals($inboundEmail->tls, "tls"); |
|
2416 | - $this->assertEquals($inboundEmail->ca, "ca"); |
|
2417 | - $this->assertEquals($inboundEmail->ssl, "ssl"); |
|
2418 | - $this->assertEquals($inboundEmail->protocol, "protocol"); |
|
2415 | + $this->assertEquals($inboundEmail->tls, "tls"); |
|
2416 | + $this->assertEquals($inboundEmail->ca, "ca"); |
|
2417 | + $this->assertEquals($inboundEmail->ssl, "ssl"); |
|
2418 | + $this->assertEquals($inboundEmail->protocol, "protocol"); |
|
2419 | 2419 | |
2420 | - } |
|
2420 | + } |
|
2421 | 2421 | |
2422 | 2422 | |
2423 | - public function testfill_in_additional_detail_fields() { |
|
2423 | + public function testfill_in_additional_detail_fields() { |
|
2424 | 2424 | |
2425 | - $inboundEmail = new InboundEmail(); |
|
2425 | + $inboundEmail = new InboundEmail(); |
|
2426 | 2426 | |
2427 | - $inboundEmail->service = "tls::ca::ssl::protocol"; |
|
2427 | + $inboundEmail->service = "tls::ca::ssl::protocol"; |
|
2428 | 2428 | |
2429 | - $result = $inboundEmail->fill_in_additional_detail_fields(); |
|
2429 | + $result = $inboundEmail->fill_in_additional_detail_fields(); |
|
2430 | 2430 | |
2431 | - $this->assertEquals($inboundEmail->tls, "tls"); |
|
2432 | - $this->assertEquals($inboundEmail->ca, "ca"); |
|
2433 | - $this->assertEquals($inboundEmail->ssl, "ssl"); |
|
2434 | - $this->assertEquals($inboundEmail->protocol, "protocol"); |
|
2431 | + $this->assertEquals($inboundEmail->tls, "tls"); |
|
2432 | + $this->assertEquals($inboundEmail->ca, "ca"); |
|
2433 | + $this->assertEquals($inboundEmail->ssl, "ssl"); |
|
2434 | + $this->assertEquals($inboundEmail->protocol, "protocol"); |
|
2435 | 2435 | |
2436 | - } |
|
2436 | + } |
|
2437 | 2437 | |
2438 | 2438 | |
2439 | - public function testisAutoImport() { |
|
2439 | + public function testisAutoImport() { |
|
2440 | 2440 | |
2441 | - $inboundEmail = new InboundEmail(); |
|
2441 | + $inboundEmail = new InboundEmail(); |
|
2442 | 2442 | |
2443 | - $user = new User(); |
|
2443 | + $user = new User(); |
|
2444 | 2444 | |
2445 | - //test with invalid user |
|
2446 | - $result = $inboundEmail->isAutoImport($user); |
|
2447 | - $this->assertEquals(false, $result); |
|
2445 | + //test with invalid user |
|
2446 | + $result = $inboundEmail->isAutoImport($user); |
|
2447 | + $this->assertEquals(false, $result); |
|
2448 | 2448 | |
2449 | 2449 | |
2450 | - //test with default user |
|
2451 | - $user->retrieve("1"); |
|
2452 | - $result = $inboundEmail->isAutoImport($user); |
|
2453 | - $this->assertEquals(false, $result); |
|
2450 | + //test with default user |
|
2451 | + $user->retrieve("1"); |
|
2452 | + $result = $inboundEmail->isAutoImport($user); |
|
2453 | + $this->assertEquals(false, $result); |
|
2454 | 2454 | |
2455 | - } |
|
2455 | + } |
|
2456 | 2456 | |
2457 | 2457 | |
2458 | - public function testcleanOutCache() { |
|
2458 | + public function testcleanOutCache() { |
|
2459 | 2459 | |
2460 | - $inboundEmail = new InboundEmail(); |
|
2460 | + $inboundEmail = new InboundEmail(); |
|
2461 | 2461 | |
2462 | - //execute the method and test if it works and does not throws an exception. |
|
2463 | - try { |
|
2464 | - $inboundEmail->cleanOutCache(); |
|
2465 | - $this->assertTrue(true); |
|
2466 | - } |
|
2467 | - catch (Exception $e) { |
|
2468 | - $this->fail(); |
|
2469 | - } |
|
2462 | + //execute the method and test if it works and does not throws an exception. |
|
2463 | + try { |
|
2464 | + $inboundEmail->cleanOutCache(); |
|
2465 | + $this->assertTrue(true); |
|
2466 | + } |
|
2467 | + catch (Exception $e) { |
|
2468 | + $this->fail(); |
|
2469 | + } |
|
2470 | 2470 | |
2471 | - } |
|
2471 | + } |
|
2472 | 2472 | |
2473 | 2473 | |
2474 | - public function testcopyEmails() { |
|
2474 | + public function testcopyEmails() { |
|
2475 | 2475 | |
2476 | - $inboundEmail = new InboundEmail(); |
|
2476 | + $inboundEmail = new InboundEmail(); |
|
2477 | 2477 | |
2478 | - $inboundEmail->id = 1; |
|
2478 | + $inboundEmail->id = 1; |
|
2479 | 2479 | |
2480 | - //execute the method and test if it works and does not throws an exception. |
|
2481 | - try { |
|
2482 | - $result = $inboundEmail->copyEmails(1, "INBOX", 1, "TRASH", array(1)); |
|
2483 | - $this->assertTrue(true); |
|
2484 | - } |
|
2485 | - catch (Exception $e) { |
|
2486 | - $this->fail(); |
|
2487 | - } |
|
2480 | + //execute the method and test if it works and does not throws an exception. |
|
2481 | + try { |
|
2482 | + $result = $inboundEmail->copyEmails(1, "INBOX", 1, "TRASH", array(1)); |
|
2483 | + $this->assertTrue(true); |
|
2484 | + } |
|
2485 | + catch (Exception $e) { |
|
2486 | + $this->fail(); |
|
2487 | + } |
|
2488 | 2488 | |
2489 | - } |
|
2489 | + } |
|
2490 | 2490 | |
2491 | 2491 | |
2492 | - public function testmoveEmails() { |
|
2492 | + public function testmoveEmails() { |
|
2493 | 2493 | |
2494 | - $inboundEmail = new InboundEmail(); |
|
2494 | + $inboundEmail = new InboundEmail(); |
|
2495 | 2495 | |
2496 | - $inboundEmail->id = 1; |
|
2496 | + $inboundEmail->id = 1; |
|
2497 | 2497 | |
2498 | - $result = $inboundEmail->moveEmails(1, "INBOX", 1, "TRASH", array(1)); |
|
2499 | - $this->assertEquals(false, $result); |
|
2498 | + $result = $inboundEmail->moveEmails(1, "INBOX", 1, "TRASH", array(1)); |
|
2499 | + $this->assertEquals(false, $result); |
|
2500 | 2500 | |
2501 | - $result = $inboundEmail->moveEmails(1, "INBOX", 2, "TRASH", array(1)); |
|
2502 | - $this->assertEquals(false, $result); |
|
2501 | + $result = $inboundEmail->moveEmails(1, "INBOX", 2, "TRASH", array(1)); |
|
2502 | + $this->assertEquals(false, $result); |
|
2503 | 2503 | |
2504 | - } |
|
2504 | + } |
|
2505 | 2505 | |
2506 | - public function testgetTempFilename() { |
|
2506 | + public function testgetTempFilename() { |
|
2507 | 2507 | |
2508 | 2508 | |
2509 | - $inboundEmail = new InboundEmail(); |
|
2509 | + $inboundEmail = new InboundEmail(); |
|
2510 | 2510 | |
2511 | - $inboundEmail->compoundMessageId = "cmid"; |
|
2511 | + $inboundEmail->compoundMessageId = "cmid"; |
|
2512 | 2512 | |
2513 | 2513 | |
2514 | - //test with default false |
|
2515 | - $result = $inboundEmail->getTempFilename(); |
|
2516 | - $this->assertEquals("cmid0", $result); |
|
2514 | + //test with default false |
|
2515 | + $result = $inboundEmail->getTempFilename(); |
|
2516 | + $this->assertEquals("cmid0", $result); |
|
2517 | 2517 | |
2518 | 2518 | |
2519 | - //test with true |
|
2520 | - $result = $inboundEmail->getTempFilename(true); |
|
2521 | - $this->assertEquals("cmid", $result); |
|
2519 | + //test with true |
|
2520 | + $result = $inboundEmail->getTempFilename(true); |
|
2521 | + $this->assertEquals("cmid", $result); |
|
2522 | 2522 | |
2523 | - } |
|
2523 | + } |
|
2524 | 2524 | |
2525 | 2525 | |
2526 | - public function testdeleteMessageOnMailServer() { |
|
2526 | + public function testdeleteMessageOnMailServer() { |
|
2527 | 2527 | |
2528 | 2528 | |
2529 | - $inboundEmail = new InboundEmail(); |
|
2529 | + $inboundEmail = new InboundEmail(); |
|
2530 | 2530 | |
2531 | - $result = $inboundEmail->deleteMessageOnMailServer("1"); |
|
2531 | + $result = $inboundEmail->deleteMessageOnMailServer("1"); |
|
2532 | 2532 | |
2533 | - $this->assertEquals(false, $result); |
|
2533 | + $this->assertEquals(false, $result); |
|
2534 | 2534 | |
2535 | - } |
|
2535 | + } |
|
2536 | 2536 | |
2537 | 2537 | |
2538 | - public function testdeleteMessageOnMailServerForPop3() { |
|
2538 | + public function testdeleteMessageOnMailServerForPop3() { |
|
2539 | 2539 | |
2540 | - $inboundEmail = new InboundEmail(); |
|
2540 | + $inboundEmail = new InboundEmail(); |
|
2541 | 2541 | |
2542 | - //execute the method and test if it works and does not throws an exception. |
|
2543 | - try { |
|
2544 | - $inboundEmail->deleteMessageOnMailServerForPop3("1"); |
|
2545 | - $this->assertTrue(true); |
|
2546 | - } |
|
2547 | - catch (Exception $e) { |
|
2548 | - $this->fail(); |
|
2549 | - } |
|
2542 | + //execute the method and test if it works and does not throws an exception. |
|
2543 | + try { |
|
2544 | + $inboundEmail->deleteMessageOnMailServerForPop3("1"); |
|
2545 | + $this->assertTrue(true); |
|
2546 | + } |
|
2547 | + catch (Exception $e) { |
|
2548 | + $this->fail(); |
|
2549 | + } |
|
2550 | 2550 | |
2551 | - } |
|
2551 | + } |
|
2552 | 2552 | |
2553 | 2553 | |
2554 | - public function testisPop3Protocol() { |
|
2554 | + public function testisPop3Protocol() { |
|
2555 | 2555 | |
2556 | - $inboundEmail = new InboundEmail(); |
|
2556 | + $inboundEmail = new InboundEmail(); |
|
2557 | 2557 | |
2558 | - //test without setting protocol |
|
2559 | - $this->assertEquals(false, $inboundEmail->isPop3Protocol()); |
|
2558 | + //test without setting protocol |
|
2559 | + $this->assertEquals(false, $inboundEmail->isPop3Protocol()); |
|
2560 | 2560 | |
2561 | 2561 | |
2562 | - //test with pop3 protocol |
|
2563 | - $inboundEmail->protocol = "pop3"; |
|
2564 | - $this->assertEquals(true, $inboundEmail->isPop3Protocol()); |
|
2562 | + //test with pop3 protocol |
|
2563 | + $inboundEmail->protocol = "pop3"; |
|
2564 | + $this->assertEquals(true, $inboundEmail->isPop3Protocol()); |
|
2565 | 2565 | |
2566 | - } |
|
2566 | + } |
|
2567 | 2567 | |
2568 | 2568 | |
2569 | - public function testSetAndGetUsersDefaultOutboundServerId() |
|
2570 | - { |
|
2571 | - $inboundEmail = new InboundEmail(); |
|
2569 | + public function testSetAndGetUsersDefaultOutboundServerId() |
|
2570 | + { |
|
2571 | + $inboundEmail = new InboundEmail(); |
|
2572 | 2572 | |
2573 | - $user = new User(); |
|
2574 | - $user->retrieve(1); |
|
2573 | + $user = new User(); |
|
2574 | + $user->retrieve(1); |
|
2575 | 2575 | |
2576 | - //set a Outbound Server Id |
|
2577 | - $inboundEmail->setUsersDefaultOutboundServerId($user,"123"); |
|
2576 | + //set a Outbound Server Id |
|
2577 | + $inboundEmail->setUsersDefaultOutboundServerId($user,"123"); |
|
2578 | 2578 | |
2579 | 2579 | |
2580 | - //retrieve Outbound Server Id back and verify |
|
2581 | - $result = $inboundEmail->getUsersDefaultOutboundServerId($user); |
|
2580 | + //retrieve Outbound Server Id back and verify |
|
2581 | + $result = $inboundEmail->getUsersDefaultOutboundServerId($user); |
|
2582 | 2582 | |
2583 | - $this->assertEquals("123", $result); |
|
2584 | - } |
|
2583 | + $this->assertEquals("123", $result); |
|
2584 | + } |
|
2585 | 2585 | |
2586 | 2586 | |
2587 | - public function testsetEmailForDisplay() { |
|
2587 | + public function testsetEmailForDisplay() { |
|
2588 | 2588 | |
2589 | - $inboundEmail = new InboundEmail(); |
|
2589 | + $inboundEmail = new InboundEmail(); |
|
2590 | 2590 | |
2591 | - $result = $inboundEmail->setEmailForDisplay(""); |
|
2592 | - $this->assertEquals("NOOP", $result); |
|
2591 | + $result = $inboundEmail->setEmailForDisplay(""); |
|
2592 | + $this->assertEquals("NOOP", $result); |
|
2593 | 2593 | |
2594 | 2594 | |
2595 | - //test with pop3 protocol and default parameters |
|
2596 | - $inboundEmail->protocol = "pop3"; |
|
2597 | - $result = $inboundEmail->setEmailForDisplay("1"); |
|
2598 | - $this->assertEquals("error", $result); |
|
2595 | + //test with pop3 protocol and default parameters |
|
2596 | + $inboundEmail->protocol = "pop3"; |
|
2597 | + $result = $inboundEmail->setEmailForDisplay("1"); |
|
2598 | + $this->assertEquals("error", $result); |
|
2599 | 2599 | |
2600 | 2600 | |
2601 | - //test with pop3 protocol and all parameters true |
|
2602 | - $result = $inboundEmail->setEmailForDisplay("1",true,true,true); |
|
2603 | - $this->assertEquals("error", $result); |
|
2601 | + //test with pop3 protocol and all parameters true |
|
2602 | + $result = $inboundEmail->setEmailForDisplay("1",true,true,true); |
|
2603 | + $this->assertEquals("error", $result); |
|
2604 | 2604 | |
2605 | 2605 | |
2606 | - } |
|
2606 | + } |
|
2607 | 2607 | |
2608 | - public function testdisplayOneEmail() { |
|
2608 | + public function testdisplayOneEmail() { |
|
2609 | 2609 | |
2610 | - $inboundEmail = new InboundEmail(); |
|
2610 | + $inboundEmail = new InboundEmail(); |
|
2611 | 2611 | |
2612 | - $inboundEmail->id = 1; |
|
2613 | - $inboundEmail->mailbox = "INBOX"; |
|
2614 | - $inboundEmail->email = new Email(); |
|
2612 | + $inboundEmail->id = 1; |
|
2613 | + $inboundEmail->mailbox = "INBOX"; |
|
2614 | + $inboundEmail->email = new Email(); |
|
2615 | 2615 | |
2616 | - $inboundEmail->email->name = "test"; |
|
2617 | - $inboundEmail->email->from_addr_name = "from"; |
|
2618 | - $inboundEmail->email->to_addrs_names ="to"; |
|
2619 | - $inboundEmail->email->cc_addrs_names = "cc"; |
|
2620 | - $inboundEmail->email->reply_to_addr = "reply"; |
|
2616 | + $inboundEmail->email->name = "test"; |
|
2617 | + $inboundEmail->email->from_addr_name = "from"; |
|
2618 | + $inboundEmail->email->to_addrs_names ="to"; |
|
2619 | + $inboundEmail->email->cc_addrs_names = "cc"; |
|
2620 | + $inboundEmail->email->reply_to_addr = "reply"; |
|
2621 | 2621 | |
2622 | - $expected = array ( |
|
2623 | - 'meta' => array ( 'type' => 'archived', 'uid' => 1, 'ieId' => 1, 'email' => array ( 'name' => 'test','from_name' => '', 'from_addr' => 'from','date_start' => ' ', 'time_start' => '', 'message_id' => '', 'cc_addrs' => 'cc', 'attachments' => '', 'toaddrs' => 'to', 'description' => '', 'reply_to_addr' => 'reply', ), 'mbox' => "INBOX", 'cc' => '', 'is_sugarEmail' => false, ) |
|
2624 | - ); |
|
2625 | - $result = $inboundEmail->displayOneEmail(1, "INBOX"); |
|
2622 | + $expected = array ( |
|
2623 | + 'meta' => array ( 'type' => 'archived', 'uid' => 1, 'ieId' => 1, 'email' => array ( 'name' => 'test','from_name' => '', 'from_addr' => 'from','date_start' => ' ', 'time_start' => '', 'message_id' => '', 'cc_addrs' => 'cc', 'attachments' => '', 'toaddrs' => 'to', 'description' => '', 'reply_to_addr' => 'reply', ), 'mbox' => "INBOX", 'cc' => '', 'is_sugarEmail' => false, ) |
|
2624 | + ); |
|
2625 | + $result = $inboundEmail->displayOneEmail(1, "INBOX"); |
|
2626 | 2626 | |
2627 | - $this->assertEquals($expected, $result); |
|
2627 | + $this->assertEquals($expected, $result); |
|
2628 | 2628 | |
2629 | - } |
|
2629 | + } |
|
2630 | 2630 | |
2631 | 2631 | |
2632 | - public function testcollapseLongMailingList() { |
|
2632 | + public function testcollapseLongMailingList() { |
|
2633 | 2633 | |
2634 | - $inboundEmail = new InboundEmail(); |
|
2634 | + $inboundEmail = new InboundEmail(); |
|
2635 | 2635 | |
2636 | - $emails = "[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]"; |
|
2636 | + $emails = "[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]"; |
|
2637 | 2637 | |
2638 | - $expected = "<span onclick='javascript:SUGAR.email2.detailView.showFullEmailList(this);' style='cursor:pointer;'>[email protected], [email protected] [...4 More]</span><span onclick='javascript:SUGAR.email2.detailView.showCroppedEmailList(this)' style='cursor:pointer; display:none;'>[email protected], [email protected], [email protected], [email protected], [email protected], [email protected] [ less ]</span>"; |
|
2638 | + $expected = "<span onclick='javascript:SUGAR.email2.detailView.showFullEmailList(this);' style='cursor:pointer;'>[email protected], [email protected] [...4 More]</span><span onclick='javascript:SUGAR.email2.detailView.showCroppedEmailList(this)' style='cursor:pointer; display:none;'>[email protected], [email protected], [email protected], [email protected], [email protected], [email protected] [ less ]</span>"; |
|
2639 | 2639 | |
2640 | - $actual = $inboundEmail->collapseLongMailingList($emails); |
|
2640 | + $actual = $inboundEmail->collapseLongMailingList($emails); |
|
2641 | 2641 | |
2642 | - $this->assertEquals($expected, $actual); |
|
2642 | + $this->assertEquals($expected, $actual); |
|
2643 | 2643 | |
2644 | - } |
|
2644 | + } |
|
2645 | 2645 | |
2646 | 2646 | |
2647 | 2647 | |
2648 | - public function testsortFetchedOverview() { |
|
2648 | + public function testsortFetchedOverview() { |
|
2649 | 2649 | |
2650 | - $inboundEmail = new InboundEmail(); |
|
2650 | + $inboundEmail = new InboundEmail(); |
|
2651 | 2651 | |
2652 | - $inboundEmail->id = 1; |
|
2653 | - $inboundEmail->mailbox = "INBOX"; |
|
2652 | + $inboundEmail->id = 1; |
|
2653 | + $inboundEmail->mailbox = "INBOX"; |
|
2654 | 2654 | |
2655 | - $overview1 = new Overview(); |
|
2656 | - $overview1->subject = "subject 1"; |
|
2657 | - $overview1->from = "from 1"; |
|
2658 | - $overview1->flagged = "1"; |
|
2659 | - $overview1->answered = "1"; |
|
2660 | - $overview1->date = "2016-01-01"; |
|
2655 | + $overview1 = new Overview(); |
|
2656 | + $overview1->subject = "subject 1"; |
|
2657 | + $overview1->from = "from 1"; |
|
2658 | + $overview1->flagged = "1"; |
|
2659 | + $overview1->answered = "1"; |
|
2660 | + $overview1->date = "2016-01-01"; |
|
2661 | 2661 | |
2662 | - $overview2 = new Overview(); |
|
2663 | - $overview2->subject = "subject 2"; |
|
2664 | - $overview2->from = "from 2"; |
|
2665 | - $overview2->flagged = "2"; |
|
2666 | - $overview2->answered = "2"; |
|
2667 | - $overview2->date = "2016-01-02"; |
|
2662 | + $overview2 = new Overview(); |
|
2663 | + $overview2->subject = "subject 2"; |
|
2664 | + $overview2->from = "from 2"; |
|
2665 | + $overview2->flagged = "2"; |
|
2666 | + $overview2->answered = "2"; |
|
2667 | + $overview2->date = "2016-01-02"; |
|
2668 | 2668 | |
2669 | - $arr = array(); |
|
2670 | - $arr[] = $overview1; |
|
2671 | - $arr[] = $overview2; |
|
2669 | + $arr = array(); |
|
2670 | + $arr[] = $overview1; |
|
2671 | + $arr[] = $overview2; |
|
2672 | 2672 | |
2673 | 2673 | |
2674 | - //execute the method to sort the objects array descending and verify the order |
|
2675 | - $result = $inboundEmail->sortFetchedOverview($arr, 3,'DESC'); |
|
2676 | - $this->assertEquals('subject 2', $result['retArr'][0]->subject); |
|
2674 | + //execute the method to sort the objects array descending and verify the order |
|
2675 | + $result = $inboundEmail->sortFetchedOverview($arr, 3,'DESC'); |
|
2676 | + $this->assertEquals('subject 2', $result['retArr'][0]->subject); |
|
2677 | 2677 | |
2678 | 2678 | |
2679 | - //execute the method to sort the objects array ascending and verify the order |
|
2680 | - $result = $inboundEmail->sortFetchedOverview($arr, 3,'ASC'); |
|
2681 | - $this->assertEquals('subject 1', $result['retArr'][0]->subject); |
|
2679 | + //execute the method to sort the objects array ascending and verify the order |
|
2680 | + $result = $inboundEmail->sortFetchedOverview($arr, 3,'ASC'); |
|
2681 | + $this->assertEquals('subject 1', $result['retArr'][0]->subject); |
|
2682 | 2682 | |
2683 | - } |
|
2683 | + } |
|
2684 | 2684 | |
2685 | 2685 | |
2686 | - public function testdisplayFolderContents() { |
|
2686 | + public function testdisplayFolderContents() { |
|
2687 | 2687 | |
2688 | - $inboundEmail = new InboundEmail(); |
|
2688 | + $inboundEmail = new InboundEmail(); |
|
2689 | 2689 | |
2690 | - $expected = array ( 'mbox' => 'INBOX', 'ieId' => 1, 'name' => 'test', 'fromCache' => 0, 'out' => array () ); |
|
2691 | - $inboundEmail->id = 1; |
|
2692 | - $inboundEmail->name = "test"; |
|
2690 | + $expected = array ( 'mbox' => 'INBOX', 'ieId' => 1, 'name' => 'test', 'fromCache' => 0, 'out' => array () ); |
|
2691 | + $inboundEmail->id = 1; |
|
2692 | + $inboundEmail->name = "test"; |
|
2693 | 2693 | |
2694 | - $result = $inboundEmail->displayFolderContents("INBOX", 'false', 1); |
|
2694 | + $result = $inboundEmail->displayFolderContents("INBOX", 'false', 1); |
|
2695 | 2695 | |
2696 | - $this->assertEquals($expected, $result); |
|
2696 | + $this->assertEquals($expected, $result); |
|
2697 | 2697 | |
2698 | - } |
|
2698 | + } |
|
2699 | 2699 | |
2700 | 2700 | |
2701 | - public function testcreateUserSubscriptionsForGroupAccount() |
|
2702 | - { |
|
2701 | + public function testcreateUserSubscriptionsForGroupAccount() |
|
2702 | + { |
|
2703 | 2703 | |
2704 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
2705 | - global $db; |
|
2706 | - unset ($db->database); |
|
2707 | - $db->checkConnection(); |
|
2704 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
2705 | + global $db; |
|
2706 | + unset ($db->database); |
|
2707 | + $db->checkConnection(); |
|
2708 | 2708 | |
2709 | 2709 | |
2710 | - $inboundEmail = new InboundEmail(); |
|
2710 | + $inboundEmail = new InboundEmail(); |
|
2711 | 2711 | |
2712 | - //$inboundEmail->createUserSubscriptionsForGroupAccount(); |
|
2712 | + //$inboundEmail->createUserSubscriptionsForGroupAccount(); |
|
2713 | 2713 | |
2714 | - $this->markTestIncomplete("Fatal error: Class 'Team' not found"); |
|
2714 | + $this->markTestIncomplete("Fatal error: Class 'Team' not found"); |
|
2715 | 2715 | } |
2716 | 2716 | |
2717 | 2717 | |
2718 | - public function testcreateAutoImportSugarFolder() |
|
2719 | - { |
|
2720 | - //unset and reconnect Db to resolve mysqli fetch exeception |
|
2721 | - global $db; |
|
2722 | - unset ($db->database); |
|
2723 | - $db->checkConnection(); |
|
2718 | + public function testcreateAutoImportSugarFolder() |
|
2719 | + { |
|
2720 | + //unset and reconnect Db to resolve mysqli fetch exeception |
|
2721 | + global $db; |
|
2722 | + unset ($db->database); |
|
2723 | + $db->checkConnection(); |
|
2724 | 2724 | |
2725 | - $inboundEmail = new InboundEmail(); |
|
2725 | + $inboundEmail = new InboundEmail(); |
|
2726 | 2726 | |
2727 | - $inboundEmail->name = "test"; |
|
2727 | + $inboundEmail->name = "test"; |
|
2728 | 2728 | |
2729 | - $result = $inboundEmail->createAutoImportSugarFolder(); |
|
2729 | + $result = $inboundEmail->createAutoImportSugarFolder(); |
|
2730 | 2730 | |
2731 | - //test for record ID to verify that record is saved |
|
2732 | - $this->assertTrue(isset($result)); |
|
2733 | - $this->assertEquals(36, strlen($result)); |
|
2731 | + //test for record ID to verify that record is saved |
|
2732 | + $this->assertTrue(isset($result)); |
|
2733 | + $this->assertEquals(36, strlen($result)); |
|
2734 | 2734 | |
2735 | - } |
|
2735 | + } |
|
2736 | 2736 | |
2737 | - public function testgetMailboxes() { |
|
2737 | + public function testgetMailboxes() { |
|
2738 | 2738 | |
2739 | - $inboundEmail = new InboundEmail(); |
|
2739 | + $inboundEmail = new InboundEmail(); |
|
2740 | 2740 | |
2741 | - $inboundEmail->mailboxarray = array("INBOX.TRASH","OUTBOX.TRASH"); |
|
2742 | - $expected = array ( 'INBOX' => array ( 'TRASH' => 'TRASH' ), 'OUTBOX' => array ( 'TRASH' => 'TRASH') ); |
|
2741 | + $inboundEmail->mailboxarray = array("INBOX.TRASH","OUTBOX.TRASH"); |
|
2742 | + $expected = array ( 'INBOX' => array ( 'TRASH' => 'TRASH' ), 'OUTBOX' => array ( 'TRASH' => 'TRASH') ); |
|
2743 | 2743 | |
2744 | 2744 | |
2745 | - //test with justRaw default/false |
|
2746 | - $result = $inboundEmail->getMailboxes(); |
|
2747 | - $this->assertEquals($expected, $result); |
|
2745 | + //test with justRaw default/false |
|
2746 | + $result = $inboundEmail->getMailboxes(); |
|
2747 | + $this->assertEquals($expected, $result); |
|
2748 | 2748 | |
2749 | 2749 | |
2750 | - //test with justRaw true |
|
2751 | - $result = $inboundEmail->getMailboxes(true); |
|
2752 | - $this->assertEquals($inboundEmail->mailboxarray, $result); |
|
2750 | + //test with justRaw true |
|
2751 | + $result = $inboundEmail->getMailboxes(true); |
|
2752 | + $this->assertEquals($inboundEmail->mailboxarray, $result); |
|
2753 | 2753 | |
2754 | - } |
|
2754 | + } |
|
2755 | 2755 | |
2756 | - public function testgetMailBoxesForGroupAccount() { |
|
2756 | + public function testgetMailBoxesForGroupAccount() { |
|
2757 | 2757 | |
2758 | - $inboundEmail = new InboundEmail(); |
|
2758 | + $inboundEmail = new InboundEmail(); |
|
2759 | 2759 | |
2760 | - $inboundEmail->mailbox = 1; |
|
2761 | - $inboundEmail->mailbox = "INBOX.TRASH,OUTBOX.TRASH"; |
|
2762 | - $expected = array ( 'INBOX' => array ( 'TRASH' => 'TRASH' ),'OUTBOX' => array ( 'TRASH' => 'TRASH')); |
|
2760 | + $inboundEmail->mailbox = 1; |
|
2761 | + $inboundEmail->mailbox = "INBOX.TRASH,OUTBOX.TRASH"; |
|
2762 | + $expected = array ( 'INBOX' => array ( 'TRASH' => 'TRASH' ),'OUTBOX' => array ( 'TRASH' => 'TRASH')); |
|
2763 | 2763 | |
2764 | - $result = $inboundEmail->getMailBoxesForGroupAccount(); |
|
2764 | + $result = $inboundEmail->getMailBoxesForGroupAccount(); |
|
2765 | 2765 | |
2766 | - $this->assertEquals($expected, $result); |
|
2766 | + $this->assertEquals($expected, $result); |
|
2767 | 2767 | |
2768 | - } |
|
2768 | + } |
|
2769 | 2769 | |
2770 | 2770 | |
2771 | - public function testretrieveMailBoxFolders() { |
|
2771 | + public function testretrieveMailBoxFolders() { |
|
2772 | 2772 | |
2773 | - $inboundEmail = new InboundEmail(); |
|
2773 | + $inboundEmail = new InboundEmail(); |
|
2774 | 2774 | |
2775 | - $inboundEmail->mailbox = "INBOX,OUTBOX,TRASH"; |
|
2775 | + $inboundEmail->mailbox = "INBOX,OUTBOX,TRASH"; |
|
2776 | 2776 | |
2777 | - $inboundEmail->retrieveMailBoxFolders(); |
|
2777 | + $inboundEmail->retrieveMailBoxFolders(); |
|
2778 | 2778 | |
2779 | - $this->assertEquals(array("INBOX","OUTBOX","TRASH"), $inboundEmail->mailboxarray); |
|
2779 | + $this->assertEquals(array("INBOX","OUTBOX","TRASH"), $inboundEmail->mailboxarray); |
|
2780 | 2780 | |
2781 | - } |
|
2781 | + } |
|
2782 | 2782 | |
2783 | 2783 | |
2784 | - public function testinsertMailBoxFolders( ) { |
|
2784 | + public function testinsertMailBoxFolders( ) { |
|
2785 | 2785 | |
2786 | - $inboundEmail = new InboundEmail(); |
|
2786 | + $inboundEmail = new InboundEmail(); |
|
2787 | 2787 | |
2788 | - $inboundEmail->id = "101"; |
|
2788 | + $inboundEmail->id = "101"; |
|
2789 | 2789 | |
2790 | - //execute the method and test if it works and does not throws an exception. |
|
2791 | - try { |
|
2792 | - $inboundEmail->insertMailBoxFolders(array("INBOX","OUTBOX")); |
|
2793 | - $this->assertTrue(true); |
|
2794 | - } |
|
2795 | - catch (Exception $e) { |
|
2796 | - $this->fail(); |
|
2797 | - } |
|
2790 | + //execute the method and test if it works and does not throws an exception. |
|
2791 | + try { |
|
2792 | + $inboundEmail->insertMailBoxFolders(array("INBOX","OUTBOX")); |
|
2793 | + $this->assertTrue(true); |
|
2794 | + } |
|
2795 | + catch (Exception $e) { |
|
2796 | + $this->fail(); |
|
2797 | + } |
|
2798 | 2798 | |
2799 | - } |
|
2799 | + } |
|
2800 | 2800 | |
2801 | 2801 | |
2802 | - public function testretrieveDelimiter() { |
|
2802 | + public function testretrieveDelimiter() { |
|
2803 | 2803 | |
2804 | - $inboundEmail = new InboundEmail(); |
|
2804 | + $inboundEmail = new InboundEmail(); |
|
2805 | 2805 | |
2806 | - $result = $inboundEmail->retrieveDelimiter(); |
|
2806 | + $result = $inboundEmail->retrieveDelimiter(); |
|
2807 | 2807 | |
2808 | - $this->assertEquals(".", $result); |
|
2808 | + $this->assertEquals(".", $result); |
|
2809 | 2809 | |
2810 | - } |
|
2810 | + } |
|
2811 | 2811 | |
2812 | - public function testgenerateFlatArrayFromMultiDimArray() { |
|
2812 | + public function testgenerateFlatArrayFromMultiDimArray() { |
|
2813 | 2813 | |
2814 | - $inboundEmail = new InboundEmail(); |
|
2814 | + $inboundEmail = new InboundEmail(); |
|
2815 | 2815 | |
2816 | - $arraymbox = array ( 'INBOX' => array ( 'TRASH' => 'TRASH' ), 'OUTBOX' => array ( 'TRASH' => 'TRASH') ); |
|
2816 | + $arraymbox = array ( 'INBOX' => array ( 'TRASH' => 'TRASH' ), 'OUTBOX' => array ( 'TRASH' => 'TRASH') ); |
|
2817 | 2817 | |
2818 | - $expected = array('INBOX','INBOX.TRASH','OUTBOX', 'OUTBOX.TRASH'); |
|
2818 | + $expected = array('INBOX','INBOX.TRASH','OUTBOX', 'OUTBOX.TRASH'); |
|
2819 | 2819 | |
2820 | - $result = $inboundEmail->generateFlatArrayFromMultiDimArray($arraymbox, "."); |
|
2820 | + $result = $inboundEmail->generateFlatArrayFromMultiDimArray($arraymbox, "."); |
|
2821 | 2821 | |
2822 | - $this->assertEquals($expected, $result); |
|
2822 | + $this->assertEquals($expected, $result); |
|
2823 | 2823 | |
2824 | - } |
|
2824 | + } |
|
2825 | 2825 | |
2826 | - public function testgenerateMultiDimArrayFromFlatArray( ) { |
|
2826 | + public function testgenerateMultiDimArrayFromFlatArray( ) { |
|
2827 | 2827 | |
2828 | - $inboundEmail = new InboundEmail(); |
|
2828 | + $inboundEmail = new InboundEmail(); |
|
2829 | 2829 | |
2830 | - $expected = array ( 'INBOX' => array ( 'TRASH' => 'TRASH' ),'OUTBOX' => array ( 'TRASH' => 'TRASH')); |
|
2830 | + $expected = array ( 'INBOX' => array ( 'TRASH' => 'TRASH' ),'OUTBOX' => array ( 'TRASH' => 'TRASH')); |
|
2831 | 2831 | |
2832 | - $result = $inboundEmail->generateMultiDimArrayFromFlatArray(array("INBOX.TRASH","OUTBOX.TRASH"), "."); |
|
2832 | + $result = $inboundEmail->generateMultiDimArrayFromFlatArray(array("INBOX.TRASH","OUTBOX.TRASH"), "."); |
|
2833 | 2833 | |
2834 | - $this->assertEquals($expected, $result); |
|
2834 | + $this->assertEquals($expected, $result); |
|
2835 | 2835 | |
2836 | - } |
|
2836 | + } |
|
2837 | 2837 | |
2838 | - public function testgenerateArrayData( ) { |
|
2838 | + public function testgenerateArrayData( ) { |
|
2839 | 2839 | |
2840 | - $inboundEmail = new InboundEmail(); |
|
2840 | + $inboundEmail = new InboundEmail(); |
|
2841 | 2841 | |
2842 | - $result = array(); |
|
2843 | - $arraymbox = array ( 'INBOX' => array ('TRASH' => 'TRASH')); |
|
2844 | - $expected = array( 'MAIN', 'MAIN.INBOX','MAIN.INBOX.TRASH' ); |
|
2842 | + $result = array(); |
|
2843 | + $arraymbox = array ( 'INBOX' => array ('TRASH' => 'TRASH')); |
|
2844 | + $expected = array( 'MAIN', 'MAIN.INBOX','MAIN.INBOX.TRASH' ); |
|
2845 | 2845 | |
2846 | - $inboundEmail->generateArrayData("MAIN", $arraymbox, $result, "."); |
|
2846 | + $inboundEmail->generateArrayData("MAIN", $arraymbox, $result, "."); |
|
2847 | 2847 | |
2848 | - $this->assertEquals($expected, $result); |
|
2848 | + $this->assertEquals($expected, $result); |
|
2849 | 2849 | |
2850 | - } |
|
2850 | + } |
|
2851 | 2851 | |
2852 | 2852 | |
2853 | - public function testsortMailboxes() { |
|
2853 | + public function testsortMailboxes() { |
|
2854 | 2854 | |
2855 | 2855 | |
2856 | - $inboundEmail = new InboundEmail(); |
|
2856 | + $inboundEmail = new InboundEmail(); |
|
2857 | 2857 | |
2858 | - $result= $inboundEmail->sortMailboxes("INBOX.TRASH",array()); |
|
2858 | + $result= $inboundEmail->sortMailboxes("INBOX.TRASH",array()); |
|
2859 | 2859 | |
2860 | - $expected = array ( 'INBOX' => array ('TRASH' => 'TRASH')); |
|
2860 | + $expected = array ( 'INBOX' => array ('TRASH' => 'TRASH')); |
|
2861 | 2861 | |
2862 | - $this->assertEquals($expected, $result); |
|
2862 | + $this->assertEquals($expected, $result); |
|
2863 | 2863 | |
2864 | - } |
|
2864 | + } |
|
2865 | 2865 | |
2866 | 2866 | |
2867 | - public function testgetServiceString() { |
|
2867 | + public function testgetServiceString() { |
|
2868 | 2868 | |
2869 | - $inboundEmail = new InboundEmail(); |
|
2869 | + $inboundEmail = new InboundEmail(); |
|
2870 | 2870 | |
2871 | - $inboundEmail->service = "tls::ca::ssl::protocol"; |
|
2871 | + $inboundEmail->service = "tls::ca::ssl::protocol"; |
|
2872 | 2872 | |
2873 | - $result = $inboundEmail->getServiceString(); |
|
2873 | + $result = $inboundEmail->getServiceString(); |
|
2874 | 2874 | |
2875 | - $this->assertEquals("/tls/ca/ssl/protocol", $result); |
|
2875 | + $this->assertEquals("/tls/ca/ssl/protocol", $result); |
|
2876 | 2876 | |
2877 | - } |
|
2877 | + } |
|
2878 | 2878 | |
2879 | 2879 | |
2880 | 2880 | |
2881 | 2881 | public function testgetNewEmailsForSyncedMailbox() |
2882 | 2882 | { |
2883 | - $inboundEmail = new InboundEmail(); |
|
2883 | + $inboundEmail = new InboundEmail(); |
|
2884 | 2884 | |
2885 | - //execute the method and test if it works and does not throws an exception. |
|
2886 | - try { |
|
2887 | - $inboundEmail->getNewEmailsForSyncedMailbox(); |
|
2888 | - $this->assertTrue(true); |
|
2889 | - } |
|
2890 | - catch (Exception $e) { |
|
2891 | - $this->fail(); |
|
2892 | - } |
|
2885 | + //execute the method and test if it works and does not throws an exception. |
|
2886 | + try { |
|
2887 | + $inboundEmail->getNewEmailsForSyncedMailbox(); |
|
2888 | + $this->assertTrue(true); |
|
2889 | + } |
|
2890 | + catch (Exception $e) { |
|
2891 | + $this->fail(); |
|
2892 | + } |
|
2893 | 2893 | |
2894 | 2894 | } |
2895 | 2895 | |
2896 | 2896 | |
2897 | 2897 | public function testimportMessages() |
2898 | 2898 | { |
2899 | - $inboundEmail = new InboundEmail(); |
|
2899 | + $inboundEmail = new InboundEmail(); |
|
2900 | 2900 | |
2901 | - //execute the method and test if it works and does not throws an exception. |
|
2902 | - try { |
|
2903 | - $inboundEmail->protocol = 'pop3'; |
|
2904 | - $inboundEmail->importMessages(); |
|
2901 | + //execute the method and test if it works and does not throws an exception. |
|
2902 | + try { |
|
2903 | + $inboundEmail->protocol = 'pop3'; |
|
2904 | + $inboundEmail->importMessages(); |
|
2905 | 2905 | |
2906 | - $this->assertTrue(true); |
|
2907 | - } |
|
2908 | - catch (Exception $e) { |
|
2909 | - $this->fail(); |
|
2910 | - } |
|
2906 | + $this->assertTrue(true); |
|
2907 | + } |
|
2908 | + catch (Exception $e) { |
|
2909 | + $this->fail(); |
|
2910 | + } |
|
2911 | 2911 | |
2912 | 2912 | |
2913 | 2913 | } |
2914 | 2914 | |
2915 | - public function testOverview() { |
|
2915 | + public function testOverview() { |
|
2916 | 2916 | |
2917 | 2917 | |
2918 | - //execute the contructor and check for the Object type and attributes |
|
2919 | - $overview = new Overview(); |
|
2918 | + //execute the contructor and check for the Object type and attributes |
|
2919 | + $overview = new Overview(); |
|
2920 | 2920 | |
2921 | - $this->assertInstanceOf('Overview',$overview); |
|
2921 | + $this->assertInstanceOf('Overview',$overview); |
|
2922 | 2922 | |
2923 | - $this->assertTrue(is_array($overview->fieldDefs)); |
|
2924 | - $this->assertTrue(is_array($overview->indices)); |
|
2923 | + $this->assertTrue(is_array($overview->fieldDefs)); |
|
2924 | + $this->assertTrue(is_array($overview->indices)); |
|
2925 | 2925 | |
2926 | - } |
|
2926 | + } |
|
2927 | 2927 | |
2928 | 2928 | } |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | //execute the contructor and check for the Object type and attributes |
16 | 16 | $inboundEmail = new InboundEmail(); |
17 | 17 | |
18 | - $this->assertInstanceOf('InboundEmail',$inboundEmail); |
|
19 | - $this->assertInstanceOf('SugarBean',$inboundEmail); |
|
18 | + $this->assertInstanceOf('InboundEmail', $inboundEmail); |
|
19 | + $this->assertInstanceOf('SugarBean', $inboundEmail); |
|
20 | 20 | |
21 | 21 | $this->assertAttributeEquals('InboundEmail', 'module_dir', $inboundEmail); |
22 | 22 | $this->assertAttributeEquals('InboundEmail', 'object_name', $inboundEmail); |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | $inboundEmail = new InboundEmail(); |
133 | 133 | |
134 | 134 | |
135 | - $result = $inboundEmail->getSingularRelatedId("test","inbound_email"); |
|
135 | + $result = $inboundEmail->getSingularRelatedId("test", "inbound_email"); |
|
136 | 136 | $this->assertEquals(false, $result); |
137 | 137 | |
138 | 138 | |
139 | - $result = $inboundEmail->getSingularRelatedId("invalid test","inbound_email"); |
|
139 | + $result = $inboundEmail->getSingularRelatedId("invalid test", "inbound_email"); |
|
140 | 140 | $this->assertEquals(null, $result); |
141 | 141 | |
142 | 142 | |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | |
182 | 182 | $this->assertTrue(is_array($result)); |
183 | 183 | |
184 | - foreach($result as $ie){ |
|
185 | - $this->assertInstanceOf('InboundEmail',$ie); |
|
184 | + foreach ($result as $ie) { |
|
185 | + $this->assertInstanceOf('InboundEmail', $ie); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | } |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | |
197 | 197 | $this->assertTrue(is_array($result)); |
198 | 198 | |
199 | - foreach($result as $ie){ |
|
200 | - $this->assertInstanceOf('InboundEmail',$ie); |
|
199 | + foreach ($result as $ie) { |
|
200 | + $this->assertInstanceOf('InboundEmail', $ie); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | } |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | |
212 | 212 | $this->assertTrue(is_array($result)); |
213 | 213 | |
214 | - foreach($result as $ie){ |
|
215 | - $this->assertInstanceOf('InboundEmail',$ie); |
|
214 | + foreach ($result as $ie) { |
|
215 | + $this->assertInstanceOf('InboundEmail', $ie); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | } |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | $result = $inboundEmail->search($id); |
245 | 245 | |
246 | 246 | $this->assertTrue(is_array($result)); |
247 | - $this->assertEquals("Search Results" ,$result["mbox"]); |
|
248 | - $this->assertEquals($id ,$result["ieId"]); |
|
247 | + $this->assertEquals("Search Results", $result["mbox"]); |
|
248 | + $this->assertEquals($id, $result["ieId"]); |
|
249 | 249 | |
250 | 250 | } |
251 | 251 | |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | |
260 | 260 | //execute he method and verify attributes |
261 | 261 | $inboundEmail->saveMailBoxFolders("INBOX,TRASH"); |
262 | - $this->assertEquals(array("INBOX","TRASH") , $inboundEmail->mailboxarray); |
|
262 | + $this->assertEquals(array("INBOX", "TRASH"), $inboundEmail->mailboxarray); |
|
263 | 263 | |
264 | 264 | //retrieve it back and verify the updates |
265 | 265 | $inboundEmail->retrieve($id); |
266 | - $this->assertEquals("INBOX,TRASH" , $inboundEmail->mailbox); |
|
266 | + $this->assertEquals("INBOX,TRASH", $inboundEmail->mailbox); |
|
267 | 267 | |
268 | 268 | } |
269 | 269 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | //retrieve it back and verify the updates |
281 | 281 | $inboundEmail->retrieve($id); |
282 | - $this->assertEquals("TEST" , $inboundEmail->mailbox); |
|
282 | + $this->assertEquals("TEST", $inboundEmail->mailbox); |
|
283 | 283 | |
284 | 284 | } |
285 | 285 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $inboundEmail->mark_deleted($id); |
293 | 293 | |
294 | 294 | $result = $inboundEmail->retrieve($id); |
295 | - $this->assertEquals(null,$result); |
|
295 | + $this->assertEquals(null, $result); |
|
296 | 296 | |
297 | 297 | } |
298 | 298 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $inboundEmail->hardDelete($id); |
305 | 305 | |
306 | 306 | $result = $inboundEmail->retrieve($id); |
307 | - $this->assertEquals(null,$result); |
|
307 | + $this->assertEquals(null, $result); |
|
308 | 308 | |
309 | 309 | } |
310 | 310 | |
@@ -346,12 +346,12 @@ discard block |
||
346 | 346 | |
347 | 347 | //test with array having common element |
348 | 348 | $result = $inboundEmail->filterMailBoxFromRaw(array("mailbox1", "mailbox2", "mailbox3"), array("mailbox1")); |
349 | - $this->assertSame(array("mailbox1"), $result ); |
|
349 | + $this->assertSame(array("mailbox1"), $result); |
|
350 | 350 | |
351 | 351 | |
352 | 352 | //test with array having nothing common |
353 | - $result = $inboundEmail->filterMailBoxFromRaw( array("mailbox1", "mailbox2"), array("mailbox4")); |
|
354 | - $this->assertSame(array(), $result ); |
|
353 | + $result = $inboundEmail->filterMailBoxFromRaw(array("mailbox1", "mailbox2"), array("mailbox4")); |
|
354 | + $this->assertSame(array(), $result); |
|
355 | 355 | |
356 | 356 | } |
357 | 357 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $overview->subject = "subject"; |
414 | 414 | $overview->from = "from"; |
415 | 415 | $overview->fromaddr = "[email protected]"; |
416 | - $overview->to = "to"; |
|
416 | + $overview->to = "to"; |
|
417 | 417 | $overview->toaddr = "[email protected]"; |
418 | 418 | $overview->size = 0; |
419 | 419 | $overview->message_id = 1; |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | |
440 | 440 | |
441 | 441 | //test wih default protocol |
442 | - $result = $inboundEmail->getCacheValueForUIDs("INBOX", array(1,2,3,4,5)); |
|
442 | + $result = $inboundEmail->getCacheValueForUIDs("INBOX", array(1, 2, 3, 4, 5)); |
|
443 | 443 | |
444 | 444 | $this->assertTrue(is_array($result)); |
445 | 445 | $this->assertTrue(is_array($result['uids'])); |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | |
450 | 450 | //test wih pop3 protocol |
451 | 451 | $inboundEmail->protocol = 'pop3'; |
452 | - $result = $inboundEmail->getCacheValueForUIDs("INBOX", array(1,2,3,4,5)); |
|
452 | + $result = $inboundEmail->getCacheValueForUIDs("INBOX", array(1, 2, 3, 4, 5)); |
|
453 | 453 | |
454 | 454 | $this->assertTrue(is_array($result)); |
455 | 455 | $this->assertTrue(is_array($result['uids'])); |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | $ret = $inboundEmail->getCacheValue("INBOX"); |
509 | 509 | |
510 | 510 | //use the cache values array as parameter and verify that it returns an array |
511 | - $result = $inboundEmail->displayFetchedSortedListXML($ret,"INBOX"); |
|
511 | + $result = $inboundEmail->displayFetchedSortedListXML($ret, "INBOX"); |
|
512 | 512 | $this->assertTrue(is_array($result)); |
513 | 513 | |
514 | 514 | |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | $inboundEmail->id = 1; |
581 | 581 | |
582 | 582 | //execute the method to populate answered field |
583 | - $inboundEmail->mark_answered(1,'pop3'); |
|
583 | + $inboundEmail->mark_answered(1, 'pop3'); |
|
584 | 584 | |
585 | 585 | //retrieve back to verify the records updated |
586 | 586 | $result = $inboundEmail->getCacheValue("INBOX"); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | |
598 | 598 | $inboundEmail->id = 1; |
599 | 599 | |
600 | - $result = $inboundEmail->pop3_shiftCache(array('1'=>'1'),array('1')); |
|
600 | + $result = $inboundEmail->pop3_shiftCache(array('1'=>'1'), array('1')); |
|
601 | 601 | |
602 | 602 | //retrieve back to verify the records updated |
603 | 603 | $result = $inboundEmail->getCacheValue("INBOX"); |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | $inboundEmail->mailbox = "INBOX,OUTBOX"; |
916 | 916 | |
917 | 917 | $result = $inboundEmail->checkEmailOneMailbox("INBOX"); |
918 | - $this->assertEquals(1,$result); |
|
918 | + $this->assertEquals(1, $result); |
|
919 | 919 | |
920 | 920 | } |
921 | 921 | |
@@ -1144,11 +1144,11 @@ discard block |
||
1144 | 1144 | //execute the method and test if it works and does not throws an exception. |
1145 | 1145 | try { |
1146 | 1146 | |
1147 | - $inboundEmail->markEmails('1','unread'); |
|
1148 | - $inboundEmail->markEmails('1','read'); |
|
1149 | - $inboundEmail->markEmails('1','flagged'); |
|
1150 | - $inboundEmail->markEmails('1','unflagged'); |
|
1151 | - $inboundEmail->markEmails('1','answered'); |
|
1147 | + $inboundEmail->markEmails('1', 'unread'); |
|
1148 | + $inboundEmail->markEmails('1', 'read'); |
|
1149 | + $inboundEmail->markEmails('1', 'flagged'); |
|
1150 | + $inboundEmail->markEmails('1', 'unflagged'); |
|
1151 | + $inboundEmail->markEmails('1', 'answered'); |
|
1152 | 1152 | |
1153 | 1153 | $this->assertTrue(true); |
1154 | 1154 | } |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | |
1176 | 1176 | $inboundEmail = new InboundEmail(); |
1177 | 1177 | |
1178 | - $result = $inboundEmail->saveNewFolder("TEST","INBOX"); |
|
1178 | + $result = $inboundEmail->saveNewFolder("TEST", "INBOX"); |
|
1179 | 1179 | |
1180 | 1180 | $this->assertEquals(false, $result); |
1181 | 1181 | } |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | |
1240 | 1240 | $_REQUEST['ie_name'] = "test"; |
1241 | 1241 | $_REQUEST['ie_status'] = "Active"; |
1242 | - $_REQUEST['server_url'] =""; |
|
1242 | + $_REQUEST['server_url'] = ""; |
|
1243 | 1243 | $_REQUEST['email_user'] = "test"; |
1244 | 1244 | $_REQUEST['email_password'] = "test_pass"; |
1245 | 1245 | $_REQUEST['mailbox'] = "INBOX"; |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | |
1308 | 1308 | |
1309 | 1309 | //test with valid user id |
1310 | - $user->id= 1; |
|
1310 | + $user->id = 1; |
|
1311 | 1311 | $result = $inboundEmail->getUserPersonalAccountCount($user); |
1312 | 1312 | $this->assertGreaterThan(0, $result); |
1313 | 1313 | |
@@ -1329,8 +1329,8 @@ discard block |
||
1329 | 1329 | $result = $inboundEmail->retrieveByGroupFolderId(""); |
1330 | 1330 | |
1331 | 1331 | $this->assertTrue(is_array($result)); |
1332 | - foreach($result as $ie){ |
|
1333 | - $this->assertInstanceOf('InboundEmail',$ie); |
|
1332 | + foreach ($result as $ie) { |
|
1333 | + $this->assertInstanceOf('InboundEmail', $ie); |
|
1334 | 1334 | } |
1335 | 1335 | |
1336 | 1336 | |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | |
1390 | 1390 | $this->assertEquals(false, $inboundEmail->findOptimumSettings(true)); |
1391 | 1391 | |
1392 | - $this->assertEquals(false, $inboundEmail->findOptimumSettings(false,'test','test','','','INBOX')); |
|
1392 | + $this->assertEquals(false, $inboundEmail->findOptimumSettings(false, 'test', 'test', '', '', 'INBOX')); |
|
1393 | 1393 | |
1394 | 1394 | |
1395 | 1395 | |
@@ -1401,12 +1401,12 @@ discard block |
||
1401 | 1401 | |
1402 | 1402 | //test without setting session key |
1403 | 1403 | $result = $inboundEmail->getSessionConnectionString("mail.google.com", "test", 22, "IMAP"); |
1404 | - $this->assertEquals("",$result); |
|
1404 | + $this->assertEquals("", $result); |
|
1405 | 1405 | |
1406 | 1406 | //test with session key set |
1407 | 1407 | $_SESSION["mail.google.comtest22IMAP"] = "test connection string"; |
1408 | 1408 | $result = $inboundEmail->getSessionConnectionString("mail.google.com", "test", 22, "IMAP"); |
1409 | - $this->assertEquals("test connection string",$result); |
|
1409 | + $this->assertEquals("test connection string", $result); |
|
1410 | 1410 | |
1411 | 1411 | } |
1412 | 1412 | |
@@ -1425,13 +1425,13 @@ discard block |
||
1425 | 1425 | |
1426 | 1426 | //test without setting session key |
1427 | 1427 | $result = $inboundEmail->getSessionInboundDelimiterString("mail.google.com", "test", 22, "IMAP"); |
1428 | - $this->assertEquals("",$result); |
|
1428 | + $this->assertEquals("", $result); |
|
1429 | 1429 | |
1430 | 1430 | |
1431 | 1431 | //test with session key set |
1432 | 1432 | $_SESSION["mail.google.comtest22IMAPdelimiter"] = "delimit string"; |
1433 | 1433 | $result = $inboundEmail->getSessionInboundDelimiterString("mail.google.com", "test", 22, "IMAP"); |
1434 | - $this->assertEquals("delimit string",$result); |
|
1434 | + $this->assertEquals("delimit string", $result); |
|
1435 | 1435 | |
1436 | 1436 | } |
1437 | 1437 | |
@@ -1451,13 +1451,13 @@ discard block |
||
1451 | 1451 | |
1452 | 1452 | //test without setting session key |
1453 | 1453 | $result = $inboundEmail->getSessionInboundFoldersString("mail.google.com", "test", 22, "IMAP"); |
1454 | - $this->assertEquals("",$result); |
|
1454 | + $this->assertEquals("", $result); |
|
1455 | 1455 | |
1456 | 1456 | |
1457 | 1457 | //test with session key set |
1458 | 1458 | $_SESSION["mail.google.comtest22IMAPfoldersList"] = "foldersList string"; |
1459 | 1459 | $result = $inboundEmail->getSessionInboundFoldersString("mail.google.com", "test", 22, "IMAP"); |
1460 | - $this->assertEquals("foldersList string",$result); |
|
1460 | + $this->assertEquals("foldersList string", $result); |
|
1461 | 1461 | |
1462 | 1462 | } |
1463 | 1463 | |
@@ -1502,13 +1502,13 @@ discard block |
||
1502 | 1502 | |
1503 | 1503 | $inboundEmail = new InboundEmail(); |
1504 | 1504 | |
1505 | - $inboundEmail->group_id =1; |
|
1505 | + $inboundEmail->group_id = 1; |
|
1506 | 1506 | |
1507 | 1507 | $result = $inboundEmail->getGroupsWithSelectOptions(); |
1508 | 1508 | $this->assertEquals("", $result); |
1509 | 1509 | |
1510 | 1510 | $expected = "\n<OPTION value='0'>1</OPTION>\n<OPTION selected value='1'>2</OPTION>\n<OPTION value='2'>3</OPTION>"; |
1511 | - $result = $inboundEmail->getGroupsWithSelectOptions(array(1,2,3)); |
|
1511 | + $result = $inboundEmail->getGroupsWithSelectOptions(array(1, 2, 3)); |
|
1512 | 1512 | $this->assertEquals($expected, $result); |
1513 | 1513 | //var_dump($result); |
1514 | 1514 | |
@@ -1533,7 +1533,7 @@ discard block |
||
1533 | 1533 | |
1534 | 1534 | //execute the method and test if it works and does not throws an exception. |
1535 | 1535 | try { |
1536 | - $result = $inboundEmail->handleAutoresponse($email,$contactAddr); |
|
1536 | + $result = $inboundEmail->handleAutoresponse($email, $contactAddr); |
|
1537 | 1537 | $this->assertTrue(true); |
1538 | 1538 | } |
1539 | 1539 | catch (Exception $e) { |
@@ -1603,8 +1603,8 @@ discard block |
||
1603 | 1603 | $this->assertEquals(false, $result); |
1604 | 1604 | |
1605 | 1605 | //test with attributes set |
1606 | - $inboundEmail->mailbox_type = 'createcase' ; |
|
1607 | - $inboundEmail->groupfolder_id =1; |
|
1606 | + $inboundEmail->mailbox_type = 'createcase'; |
|
1607 | + $inboundEmail->groupfolder_id = 1; |
|
1608 | 1608 | |
1609 | 1609 | $result = $inboundEmail->isMailBoxTypeCreateCase(); |
1610 | 1610 | $this->assertEquals(true, $result); |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | $inboundEmail = new InboundEmail(); |
1667 | 1667 | |
1668 | 1668 | $parts = array( |
1669 | - (Object) array('encoding'=>'utf-8','parts'=> array( (Object) array('encoding'=>'utf-8','parts'=>array((Object) array('encoding'=>'utf-8','parts'=>'dummy parts 2'))))) |
|
1669 | + (Object)array('encoding'=>'utf-8', 'parts'=> array((Object)array('encoding'=>'utf-8', 'parts'=>array((Object)array('encoding'=>'utf-8', 'parts'=>'dummy parts 2'))))) |
|
1670 | 1670 | ); |
1671 | 1671 | |
1672 | 1672 | //$result = $inboundEmail->getEncodingFromBreadCrumb("1.2.3", $parts); |
@@ -1683,7 +1683,7 @@ discard block |
||
1683 | 1683 | $inboundEmail = new InboundEmail(); |
1684 | 1684 | |
1685 | 1685 | $parts = array( |
1686 | - (Object) array('ifparameters'=>1, 'attribute'=>'charset', 'value'=>'test','parts'=> array( (Object) array('ifparameters'=>1, 'attribute'=>'charset','value'=>'test' ,'parts'=>array((Object) array('ifparameters'=>1, 'attribute'=>'charset', 'value'=>'test','parts'=>'dummy parts 2'))))) |
|
1686 | + (Object)array('ifparameters'=>1, 'attribute'=>'charset', 'value'=>'test', 'parts'=> array((Object)array('ifparameters'=>1, 'attribute'=>'charset', 'value'=>'test', 'parts'=>array((Object)array('ifparameters'=>1, 'attribute'=>'charset', 'value'=>'test', 'parts'=>'dummy parts 2'))))) |
|
1687 | 1687 | ); |
1688 | 1688 | |
1689 | 1689 | $result = $inboundEmail->getCharsetFromBreadCrumb("1.2.3", $parts); |
@@ -1705,7 +1705,7 @@ discard block |
||
1705 | 1705 | |
1706 | 1706 | //execute the method and test if it works and does not throws an exception. |
1707 | 1707 | try { |
1708 | - $result = $inboundEmail->getMessageTextFromSingleMimePart(1,1,$structure); |
|
1708 | + $result = $inboundEmail->getMessageTextFromSingleMimePart(1, 1, $structure); |
|
1709 | 1709 | $this->assertTrue(true); |
1710 | 1710 | } |
1711 | 1711 | catch (Exception $e) { |
@@ -1774,7 +1774,7 @@ discard block |
||
1774 | 1774 | $inboundEmail = new InboundEmail(); |
1775 | 1775 | |
1776 | 1776 | |
1777 | - $expected = array ( |
|
1777 | + $expected = array( |
|
1778 | 1778 | 'From' => 'Media Temple user ([email protected])', |
1779 | 1779 | 'Subject' => 'article: How to Trace a Email', |
1780 | 1780 | 'Date' => 'January 25, 2011 3:30:58 PM PDT', |
@@ -1801,12 +1801,12 @@ discard block |
||
1801 | 1801 | $inboundEmail = new InboundEmail(); |
1802 | 1802 | |
1803 | 1803 | //test with default |
1804 | - $result = $inboundEmail->handleCharsetTranslation("sample text",'default'); |
|
1804 | + $result = $inboundEmail->handleCharsetTranslation("sample text", 'default'); |
|
1805 | 1805 | $this->assertEquals("sample text", $result); |
1806 | 1806 | |
1807 | 1807 | |
1808 | 1808 | //test with ISO-8859-8 |
1809 | - $result = $inboundEmail->handleCharsetTranslation("sample text",'ISO-8859-8'); |
|
1809 | + $result = $inboundEmail->handleCharsetTranslation("sample text", 'ISO-8859-8'); |
|
1810 | 1810 | $this->assertEquals("sample text", $result); |
1811 | 1811 | |
1812 | 1812 | } |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | |
1934 | 1934 | $result = $inboundEmail->getNoteBeanForAttachment("1"); |
1935 | 1935 | |
1936 | - $this->assertInstanceOf('Note',$result); |
|
1936 | + $this->assertInstanceOf('Note', $result); |
|
1937 | 1937 | $this->assertAttributeEquals('1', 'parent_id', $result); |
1938 | 1938 | $this->assertAttributeEquals('Emails', 'parent_type', $result); |
1939 | 1939 | |
@@ -1946,8 +1946,8 @@ discard block |
||
1946 | 1946 | $inboundEmail = new InboundEmail(); |
1947 | 1947 | |
1948 | 1948 | //test with filename attribute |
1949 | - $part = (Object) array('dparameters'=> array((Object) array('attribute'=>'filename','value'=>'test1.txt'),(Object) array('attribute'=>'filename','value'=>'test2.txt')), |
|
1950 | - 'parameters'=> array((Object) array('attribute'=>'name','value'=>'test1'),(Object) array('attribute'=>'name','value'=>'test2')) |
|
1949 | + $part = (Object)array('dparameters'=> array((Object)array('attribute'=>'filename', 'value'=>'test1.txt'), (Object)array('attribute'=>'filename', 'value'=>'test2.txt')), |
|
1950 | + 'parameters'=> array((Object)array('attribute'=>'name', 'value'=>'test1'), (Object)array('attribute'=>'name', 'value'=>'test2')) |
|
1951 | 1951 | ); |
1952 | 1952 | |
1953 | 1953 | $result = $inboundEmail->retrieveAttachmentNameFromStructure($part); |
@@ -1956,8 +1956,8 @@ discard block |
||
1956 | 1956 | |
1957 | 1957 | |
1958 | 1958 | //test with no filename attribute |
1959 | - $part = (Object) array('dparameters'=> array((Object) array('attribute'=>'name','value'=>'test1.txt')), |
|
1960 | - 'parameters'=> array((Object) array('attribute'=>'name','value'=>'test1'),(Object) array('attribute'=>'name','value'=>'test2')) |
|
1959 | + $part = (Object)array('dparameters'=> array((Object)array('attribute'=>'name', 'value'=>'test1.txt')), |
|
1960 | + 'parameters'=> array((Object)array('attribute'=>'name', 'value'=>'test1'), (Object)array('attribute'=>'name', 'value'=>'test2')) |
|
1961 | 1961 | |
1962 | 1962 | ); |
1963 | 1963 | |
@@ -1977,7 +1977,7 @@ discard block |
||
1977 | 1977 | |
1978 | 1978 | $inboundEmail = new InboundEmail(); |
1979 | 1979 | |
1980 | - $part = (Object) array("disposition" => "multipart", "subtype" => 10); |
|
1980 | + $part = (Object)array("disposition" => "multipart", "subtype" => 10); |
|
1981 | 1981 | |
1982 | 1982 | //execute the method and test if it works and does not throws an exception. |
1983 | 1983 | try { |
@@ -1996,8 +1996,8 @@ discard block |
||
1996 | 1996 | $inboundEmail = new InboundEmail(); |
1997 | 1997 | |
1998 | 1998 | $this->assertEquals("test", $inboundEmail->handleTranserEncoding("test")); |
1999 | - $this->assertEquals("test", $inboundEmail->handleTranserEncoding("dGVzdA==",3)); |
|
2000 | - $this->assertEquals("test", $inboundEmail->handleTranserEncoding("test",4)); |
|
1999 | + $this->assertEquals("test", $inboundEmail->handleTranserEncoding("dGVzdA==", 3)); |
|
2000 | + $this->assertEquals("test", $inboundEmail->handleTranserEncoding("test", 4)); |
|
2001 | 2001 | |
2002 | 2002 | } |
2003 | 2003 | |
@@ -2024,7 +2024,7 @@ discard block |
||
2024 | 2024 | $textHeader = "From: Media Temple user ([email protected])\r\nSubject: article: How to Trace a Email\r\nDate: January 25, 2011 3:30:58 PM PDT\r\nTo: [email protected]\r\nReturn-Path: <[email protected]>\r\nEnvelope-To: [email protected]\r\nDelivery-Date: Tue, 25 Jan 2011 15:31:01 -0700"; |
2025 | 2025 | |
2026 | 2026 | $result = $inboundEmail->importDupeCheck("1", $textHeader, $textHeader); |
2027 | - $this->assertEquals(true ,$result); |
|
2027 | + $this->assertEquals(true, $result); |
|
2028 | 2028 | |
2029 | 2029 | } |
2030 | 2030 | |
@@ -2035,7 +2035,7 @@ discard block |
||
2035 | 2035 | |
2036 | 2036 | $result = $inboundEmail->handleMimeHeaderDecode("Subject: article: How to Trace a Email"); |
2037 | 2037 | |
2038 | - $this->assertEquals("Subject: article: How to Trace a Email" ,$result); |
|
2038 | + $this->assertEquals("Subject: article: How to Trace a Email", $result); |
|
2039 | 2039 | |
2040 | 2040 | } |
2041 | 2041 | |
@@ -2046,7 +2046,7 @@ discard block |
||
2046 | 2046 | |
2047 | 2047 | $result = $inboundEmail->handleMimeHeaderDecode("Date: January 25, 2011 3:30:58 PM PDT"); |
2048 | 2048 | |
2049 | - $this->assertEquals("Date: January 25, 2011 3:30:58 PM PDT" ,$result); |
|
2049 | + $this->assertEquals("Date: January 25, 2011 3:30:58 PM PDT", $result); |
|
2050 | 2050 | |
2051 | 2051 | } |
2052 | 2052 | |
@@ -2084,7 +2084,7 @@ discard block |
||
2084 | 2084 | //execute the method and test if it works and does not throws an exception. |
2085 | 2085 | try { |
2086 | 2086 | $result = $inboundEmail->importOneEmail("1", "1"); |
2087 | - $this->assertEquals(false,$result); |
|
2087 | + $this->assertEquals(false, $result); |
|
2088 | 2088 | } |
2089 | 2089 | catch (Exception $e) { |
2090 | 2090 | $this->fail(); |
@@ -2112,7 +2112,7 @@ discard block |
||
2112 | 2112 | |
2113 | 2113 | $result = $inboundEmail->handleUUEncodedEmailBody($raw, 1); |
2114 | 2114 | |
2115 | - $this->assertEquals("\n" . $raw ,$result); |
|
2115 | + $this->assertEquals("\n".$raw, $result); |
|
2116 | 2116 | |
2117 | 2117 | |
2118 | 2118 | } |
@@ -2150,7 +2150,7 @@ discard block |
||
2150 | 2150 | |
2151 | 2151 | $email = new Email(); |
2152 | 2152 | $email->reply_to_email = "[email protected]"; |
2153 | - $email->from_addr = "[email protected]"; |
|
2153 | + $email->from_addr = "[email protected]"; |
|
2154 | 2154 | |
2155 | 2155 | $result = $inboundEmail->checkFilterDomain($email); |
2156 | 2156 | $this->assertEquals(true, $result); |
@@ -2167,8 +2167,8 @@ discard block |
||
2167 | 2167 | |
2168 | 2168 | $inboundEmail = new InboundEmail(); |
2169 | 2169 | |
2170 | - $this->assertEquals(false, $inboundEmail->checkOutOfOffice("currently Out of Office, will reply later") ); |
|
2171 | - $this->assertEquals(true, $inboundEmail->checkOutOfOffice("test subject") ); |
|
2170 | + $this->assertEquals(false, $inboundEmail->checkOutOfOffice("currently Out of Office, will reply later")); |
|
2171 | + $this->assertEquals(true, $inboundEmail->checkOutOfOffice("test subject")); |
|
2172 | 2172 | |
2173 | 2173 | } |
2174 | 2174 | |
@@ -2184,7 +2184,7 @@ discard block |
||
2184 | 2184 | |
2185 | 2185 | $inboundEmail = new InboundEmail(); |
2186 | 2186 | |
2187 | - $inboundEmail->id =1; |
|
2187 | + $inboundEmail->id = 1; |
|
2188 | 2188 | |
2189 | 2189 | |
2190 | 2190 | //execute the setAutoreplyStatus method to set an auto reply status for email |
@@ -2193,7 +2193,7 @@ discard block |
||
2193 | 2193 | |
2194 | 2194 | //test with and invalid email. it will return true as well because it's stil under max limit. |
2195 | 2195 | $result = $inboundEmail->getAutoreplyStatus("[email protected]"); |
2196 | - $this->assertEquals(true ,$result); |
|
2196 | + $this->assertEquals(true, $result); |
|
2197 | 2197 | |
2198 | 2198 | } |
2199 | 2199 | |
@@ -2227,7 +2227,7 @@ discard block |
||
2227 | 2227 | $expected = " <form action=\"index.php\" method=\"post\" name=\"Macro\" id=\"form\">\n <input type=\"hidden\" name=\"module\" value=\"InboundEmail\">\n <input type=\"hidden\" name=\"action\" value=\"ListView\">\n <input type=\"hidden\" name=\"save\" value=\"true\">\n\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td>\n <input title=\"Save\"\n accessKey=\"a\"\n class=\"button\"\n onclick=\"this.form.return_module.value='InboundEmail'; this.form.return_action.value='ListView';\"\n type=\"submit\" name=\"Edit\" value=\" Save \">\n </td>\n </tr>\n </table>\n\n <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"detail view\">\n <tr>\n <td valign=\"top\" width='10%' NOWRAP scope=\"row\">\n <slot>\n <b>:</b>\n </slot>\n </td>\n <td valign=\"top\" width='20%'>\n <slot>\n <input name=\"inbound_email_case_macro\" type=\"text\" value=\"[CASE:%1]\">\n </slot>\n </td>\n <td valign=\"top\" width='70%'>\n <slot>\n \n <br />\n <i></i>\n </slot>\n </td>\n </tr>\n </table>\n </form>"; |
2228 | 2228 | $result = $inboundEmail->getSystemSettingsForm(); |
2229 | 2229 | |
2230 | - $this->assertSame($expected,$result); |
|
2230 | + $this->assertSame($expected, $result); |
|
2231 | 2231 | |
2232 | 2232 | } |
2233 | 2233 | |
@@ -2245,11 +2245,11 @@ discard block |
||
2245 | 2245 | |
2246 | 2246 | $inboundEmail = new InboundEmail(); |
2247 | 2247 | |
2248 | - $result = $inboundEmail->get_stored_options("test",""); |
|
2248 | + $result = $inboundEmail->get_stored_options("test", ""); |
|
2249 | 2249 | $this->assertEquals("", $result); |
2250 | 2250 | |
2251 | 2251 | |
2252 | - $result = $inboundEmail->get_stored_options("test","default_option"); |
|
2252 | + $result = $inboundEmail->get_stored_options("test", "default_option"); |
|
2253 | 2253 | $this->assertEquals("default_option", $result); |
2254 | 2254 | |
2255 | 2255 | } |
@@ -2294,8 +2294,8 @@ discard block |
||
2294 | 2294 | $inboundEmail = new InboundEmail(); |
2295 | 2295 | |
2296 | 2296 | $this->assertEquals("{:/service=}", $inboundEmail->getConnectString()); //test with default options |
2297 | - $this->assertEquals("{:/service=mail.google.com}INBOX", $inboundEmail->getConnectString("mail.google.com","INBOX"));//test with includeMbox true |
|
2298 | - $this->assertEquals("{:/service=mail.google.com}", $inboundEmail->getConnectString("mail.google.com","INBOX",false));//test with includeMbox false |
|
2297 | + $this->assertEquals("{:/service=mail.google.com}INBOX", $inboundEmail->getConnectString("mail.google.com", "INBOX")); //test with includeMbox true |
|
2298 | + $this->assertEquals("{:/service=mail.google.com}", $inboundEmail->getConnectString("mail.google.com", "INBOX", false)); //test with includeMbox false |
|
2299 | 2299 | |
2300 | 2300 | } |
2301 | 2301 | |
@@ -2351,11 +2351,11 @@ discard block |
||
2351 | 2351 | $inboundEmail = new InboundEmail(); |
2352 | 2352 | |
2353 | 2353 | //test without setting name |
2354 | - $this->assertEquals(Null,$inboundEmail->get_summary_text()); |
|
2354 | + $this->assertEquals(Null, $inboundEmail->get_summary_text()); |
|
2355 | 2355 | |
2356 | 2356 | //test with name set |
2357 | 2357 | $inboundEmail->name = "test"; |
2358 | - $this->assertEquals('test',$inboundEmail->get_summary_text()); |
|
2358 | + $this->assertEquals('test', $inboundEmail->get_summary_text()); |
|
2359 | 2359 | |
2360 | 2360 | } |
2361 | 2361 | |
@@ -2366,18 +2366,18 @@ discard block |
||
2366 | 2366 | |
2367 | 2367 | //test with empty string params |
2368 | 2368 | $expected = " SELECT inbound_email.* , jt0.user_name created_by_name , jt0.created_by created_by_name_owner , 'Users' created_by_name_mod FROM inbound_email LEFT JOIN users jt0 ON jt0.id=inbound_email.created_by AND jt0.deleted=0\n AND jt0.deleted=0 where inbound_email.deleted=0"; |
2369 | - $actual = $inboundEmail->create_export_query('',''); |
|
2370 | - $this->assertSame($expected,$actual); |
|
2369 | + $actual = $inboundEmail->create_export_query('', ''); |
|
2370 | + $this->assertSame($expected, $actual); |
|
2371 | 2371 | |
2372 | 2372 | |
2373 | 2373 | //test with valid string params |
2374 | 2374 | $expected = " SELECT inbound_email.* , jt0.user_name created_by_name , jt0.created_by created_by_name_owner , 'Users' created_by_name_mod FROM inbound_email LEFT JOIN users jt0 ON jt0.id=inbound_email.created_by AND jt0.deleted=0\n AND jt0.deleted=0 where (jt0.user_name=\"\") AND inbound_email.deleted=0 ORDER BY inbound_email.id"; |
2375 | - $actual = $inboundEmail->create_export_query('id','jt0.user_name=""'); |
|
2376 | - $this->assertSame($expected,$actual); |
|
2375 | + $actual = $inboundEmail->create_export_query('id', 'jt0.user_name=""'); |
|
2376 | + $this->assertSame($expected, $actual); |
|
2377 | 2377 | |
2378 | 2378 | } |
2379 | 2379 | |
2380 | - public function testget_list_view_data(){ |
|
2380 | + public function testget_list_view_data() { |
|
2381 | 2381 | |
2382 | 2382 | $inboundEmail = new InboundEmail(); |
2383 | 2383 | |
@@ -2574,7 +2574,7 @@ discard block |
||
2574 | 2574 | $user->retrieve(1); |
2575 | 2575 | |
2576 | 2576 | //set a Outbound Server Id |
2577 | - $inboundEmail->setUsersDefaultOutboundServerId($user,"123"); |
|
2577 | + $inboundEmail->setUsersDefaultOutboundServerId($user, "123"); |
|
2578 | 2578 | |
2579 | 2579 | |
2580 | 2580 | //retrieve Outbound Server Id back and verify |
@@ -2599,7 +2599,7 @@ discard block |
||
2599 | 2599 | |
2600 | 2600 | |
2601 | 2601 | //test with pop3 protocol and all parameters true |
2602 | - $result = $inboundEmail->setEmailForDisplay("1",true,true,true); |
|
2602 | + $result = $inboundEmail->setEmailForDisplay("1", true, true, true); |
|
2603 | 2603 | $this->assertEquals("error", $result); |
2604 | 2604 | |
2605 | 2605 | |
@@ -2615,12 +2615,12 @@ discard block |
||
2615 | 2615 | |
2616 | 2616 | $inboundEmail->email->name = "test"; |
2617 | 2617 | $inboundEmail->email->from_addr_name = "from"; |
2618 | - $inboundEmail->email->to_addrs_names ="to"; |
|
2618 | + $inboundEmail->email->to_addrs_names = "to"; |
|
2619 | 2619 | $inboundEmail->email->cc_addrs_names = "cc"; |
2620 | 2620 | $inboundEmail->email->reply_to_addr = "reply"; |
2621 | 2621 | |
2622 | - $expected = array ( |
|
2623 | - 'meta' => array ( 'type' => 'archived', 'uid' => 1, 'ieId' => 1, 'email' => array ( 'name' => 'test','from_name' => '', 'from_addr' => 'from','date_start' => ' ', 'time_start' => '', 'message_id' => '', 'cc_addrs' => 'cc', 'attachments' => '', 'toaddrs' => 'to', 'description' => '', 'reply_to_addr' => 'reply', ), 'mbox' => "INBOX", 'cc' => '', 'is_sugarEmail' => false, ) |
|
2622 | + $expected = array( |
|
2623 | + 'meta' => array('type' => 'archived', 'uid' => 1, 'ieId' => 1, 'email' => array('name' => 'test', 'from_name' => '', 'from_addr' => 'from', 'date_start' => ' ', 'time_start' => '', 'message_id' => '', 'cc_addrs' => 'cc', 'attachments' => '', 'toaddrs' => 'to', 'description' => '', 'reply_to_addr' => 'reply',), 'mbox' => "INBOX", 'cc' => '', 'is_sugarEmail' => false,) |
|
2624 | 2624 | ); |
2625 | 2625 | $result = $inboundEmail->displayOneEmail(1, "INBOX"); |
2626 | 2626 | |
@@ -2672,12 +2672,12 @@ discard block |
||
2672 | 2672 | |
2673 | 2673 | |
2674 | 2674 | //execute the method to sort the objects array descending and verify the order |
2675 | - $result = $inboundEmail->sortFetchedOverview($arr, 3,'DESC'); |
|
2675 | + $result = $inboundEmail->sortFetchedOverview($arr, 3, 'DESC'); |
|
2676 | 2676 | $this->assertEquals('subject 2', $result['retArr'][0]->subject); |
2677 | 2677 | |
2678 | 2678 | |
2679 | 2679 | //execute the method to sort the objects array ascending and verify the order |
2680 | - $result = $inboundEmail->sortFetchedOverview($arr, 3,'ASC'); |
|
2680 | + $result = $inboundEmail->sortFetchedOverview($arr, 3, 'ASC'); |
|
2681 | 2681 | $this->assertEquals('subject 1', $result['retArr'][0]->subject); |
2682 | 2682 | |
2683 | 2683 | } |
@@ -2687,7 +2687,7 @@ discard block |
||
2687 | 2687 | |
2688 | 2688 | $inboundEmail = new InboundEmail(); |
2689 | 2689 | |
2690 | - $expected = array ( 'mbox' => 'INBOX', 'ieId' => 1, 'name' => 'test', 'fromCache' => 0, 'out' => array () ); |
|
2690 | + $expected = array('mbox' => 'INBOX', 'ieId' => 1, 'name' => 'test', 'fromCache' => 0, 'out' => array()); |
|
2691 | 2691 | $inboundEmail->id = 1; |
2692 | 2692 | $inboundEmail->name = "test"; |
2693 | 2693 | |
@@ -2738,8 +2738,8 @@ discard block |
||
2738 | 2738 | |
2739 | 2739 | $inboundEmail = new InboundEmail(); |
2740 | 2740 | |
2741 | - $inboundEmail->mailboxarray = array("INBOX.TRASH","OUTBOX.TRASH"); |
|
2742 | - $expected = array ( 'INBOX' => array ( 'TRASH' => 'TRASH' ), 'OUTBOX' => array ( 'TRASH' => 'TRASH') ); |
|
2741 | + $inboundEmail->mailboxarray = array("INBOX.TRASH", "OUTBOX.TRASH"); |
|
2742 | + $expected = array('INBOX' => array('TRASH' => 'TRASH'), 'OUTBOX' => array('TRASH' => 'TRASH')); |
|
2743 | 2743 | |
2744 | 2744 | |
2745 | 2745 | //test with justRaw default/false |
@@ -2759,7 +2759,7 @@ discard block |
||
2759 | 2759 | |
2760 | 2760 | $inboundEmail->mailbox = 1; |
2761 | 2761 | $inboundEmail->mailbox = "INBOX.TRASH,OUTBOX.TRASH"; |
2762 | - $expected = array ( 'INBOX' => array ( 'TRASH' => 'TRASH' ),'OUTBOX' => array ( 'TRASH' => 'TRASH')); |
|
2762 | + $expected = array('INBOX' => array('TRASH' => 'TRASH'), 'OUTBOX' => array('TRASH' => 'TRASH')); |
|
2763 | 2763 | |
2764 | 2764 | $result = $inboundEmail->getMailBoxesForGroupAccount(); |
2765 | 2765 | |
@@ -2776,7 +2776,7 @@ discard block |
||
2776 | 2776 | |
2777 | 2777 | $inboundEmail->retrieveMailBoxFolders(); |
2778 | 2778 | |
2779 | - $this->assertEquals(array("INBOX","OUTBOX","TRASH"), $inboundEmail->mailboxarray); |
|
2779 | + $this->assertEquals(array("INBOX", "OUTBOX", "TRASH"), $inboundEmail->mailboxarray); |
|
2780 | 2780 | |
2781 | 2781 | } |
2782 | 2782 | |
@@ -2789,7 +2789,7 @@ discard block |
||
2789 | 2789 | |
2790 | 2790 | //execute the method and test if it works and does not throws an exception. |
2791 | 2791 | try { |
2792 | - $inboundEmail->insertMailBoxFolders(array("INBOX","OUTBOX")); |
|
2792 | + $inboundEmail->insertMailBoxFolders(array("INBOX", "OUTBOX")); |
|
2793 | 2793 | $this->assertTrue(true); |
2794 | 2794 | } |
2795 | 2795 | catch (Exception $e) { |
@@ -2813,9 +2813,9 @@ discard block |
||
2813 | 2813 | |
2814 | 2814 | $inboundEmail = new InboundEmail(); |
2815 | 2815 | |
2816 | - $arraymbox = array ( 'INBOX' => array ( 'TRASH' => 'TRASH' ), 'OUTBOX' => array ( 'TRASH' => 'TRASH') ); |
|
2816 | + $arraymbox = array('INBOX' => array('TRASH' => 'TRASH'), 'OUTBOX' => array('TRASH' => 'TRASH')); |
|
2817 | 2817 | |
2818 | - $expected = array('INBOX','INBOX.TRASH','OUTBOX', 'OUTBOX.TRASH'); |
|
2818 | + $expected = array('INBOX', 'INBOX.TRASH', 'OUTBOX', 'OUTBOX.TRASH'); |
|
2819 | 2819 | |
2820 | 2820 | $result = $inboundEmail->generateFlatArrayFromMultiDimArray($arraymbox, "."); |
2821 | 2821 | |
@@ -2827,9 +2827,9 @@ discard block |
||
2827 | 2827 | |
2828 | 2828 | $inboundEmail = new InboundEmail(); |
2829 | 2829 | |
2830 | - $expected = array ( 'INBOX' => array ( 'TRASH' => 'TRASH' ),'OUTBOX' => array ( 'TRASH' => 'TRASH')); |
|
2830 | + $expected = array('INBOX' => array('TRASH' => 'TRASH'), 'OUTBOX' => array('TRASH' => 'TRASH')); |
|
2831 | 2831 | |
2832 | - $result = $inboundEmail->generateMultiDimArrayFromFlatArray(array("INBOX.TRASH","OUTBOX.TRASH"), "."); |
|
2832 | + $result = $inboundEmail->generateMultiDimArrayFromFlatArray(array("INBOX.TRASH", "OUTBOX.TRASH"), "."); |
|
2833 | 2833 | |
2834 | 2834 | $this->assertEquals($expected, $result); |
2835 | 2835 | |
@@ -2840,8 +2840,8 @@ discard block |
||
2840 | 2840 | $inboundEmail = new InboundEmail(); |
2841 | 2841 | |
2842 | 2842 | $result = array(); |
2843 | - $arraymbox = array ( 'INBOX' => array ('TRASH' => 'TRASH')); |
|
2844 | - $expected = array( 'MAIN', 'MAIN.INBOX','MAIN.INBOX.TRASH' ); |
|
2843 | + $arraymbox = array('INBOX' => array('TRASH' => 'TRASH')); |
|
2844 | + $expected = array('MAIN', 'MAIN.INBOX', 'MAIN.INBOX.TRASH'); |
|
2845 | 2845 | |
2846 | 2846 | $inboundEmail->generateArrayData("MAIN", $arraymbox, $result, "."); |
2847 | 2847 | |
@@ -2855,9 +2855,9 @@ discard block |
||
2855 | 2855 | |
2856 | 2856 | $inboundEmail = new InboundEmail(); |
2857 | 2857 | |
2858 | - $result= $inboundEmail->sortMailboxes("INBOX.TRASH",array()); |
|
2858 | + $result = $inboundEmail->sortMailboxes("INBOX.TRASH", array()); |
|
2859 | 2859 | |
2860 | - $expected = array ( 'INBOX' => array ('TRASH' => 'TRASH')); |
|
2860 | + $expected = array('INBOX' => array('TRASH' => 'TRASH')); |
|
2861 | 2861 | |
2862 | 2862 | $this->assertEquals($expected, $result); |
2863 | 2863 | |
@@ -2918,7 +2918,7 @@ discard block |
||
2918 | 2918 | //execute the contructor and check for the Object type and attributes |
2919 | 2919 | $overview = new Overview(); |
2920 | 2920 | |
2921 | - $this->assertInstanceOf('Overview',$overview); |
|
2921 | + $this->assertInstanceOf('Overview', $overview); |
|
2922 | 2922 | |
2923 | 2923 | $this->assertTrue(is_array($overview->fieldDefs)); |
2924 | 2924 | $this->assertTrue(is_array($overview->indices)); |
@@ -227,8 +227,7 @@ discard block |
||
227 | 227 | try { |
228 | 228 | $inboundEmail->renameFolder("mailbox1", "new_mailbox"); |
229 | 229 | $this->assertTrue(true); |
230 | - } |
|
231 | - catch (Exception $e) { |
|
230 | + } catch (Exception $e) { |
|
232 | 231 | $this->fail(); |
233 | 232 | } |
234 | 233 | |
@@ -739,8 +738,7 @@ discard block |
||
739 | 738 | try { |
740 | 739 | $inboundEmail->deletePop3Cache(); |
741 | 740 | $this->assertTrue(true); |
742 | - } |
|
743 | - catch (Exception $e) { |
|
741 | + } catch (Exception $e) { |
|
744 | 742 | $this->fail(); |
745 | 743 | } |
746 | 744 | |
@@ -770,8 +768,7 @@ discard block |
||
770 | 768 | try { |
771 | 769 | $inboundEmail->pop3_cleanUp(); |
772 | 770 | $this->assertTrue(true); |
773 | - } |
|
774 | - catch (Exception $e) { |
|
771 | + } catch (Exception $e) { |
|
775 | 772 | $this->fail(); |
776 | 773 | } |
777 | 774 | |
@@ -844,8 +841,7 @@ discard block |
||
844 | 841 | $this->assertEquals("could not open socket connection to POP3 server", $result); |
845 | 842 | |
846 | 843 | $this->assertTrue(true); |
847 | - } |
|
848 | - catch (Exception $e) { |
|
844 | + } catch (Exception $e) { |
|
849 | 845 | $this->fail(); |
850 | 846 | } |
851 | 847 | |
@@ -867,8 +863,7 @@ discard block |
||
867 | 863 | $this->assertEquals(false, $result); |
868 | 864 | |
869 | 865 | $this->assertTrue(true); |
870 | - } |
|
871 | - catch (Exception $e) { |
|
866 | + } catch (Exception $e) { |
|
872 | 867 | $this->fail(); |
873 | 868 | } |
874 | 869 | |
@@ -888,8 +883,7 @@ discard block |
||
888 | 883 | |
889 | 884 | $result = $inboundEmail->getMessagesInEmailCache(0, 1); |
890 | 885 | $this->assertTrue(true); |
891 | - } |
|
892 | - catch (Exception $e) { |
|
886 | + } catch (Exception $e) { |
|
893 | 887 | $this->fail(); |
894 | 888 | } |
895 | 889 | |
@@ -900,8 +894,7 @@ discard block |
||
900 | 894 | try { |
901 | 895 | $result = $inboundEmail->getMessagesInEmailCache(1, 0); |
902 | 896 | $this->assertTrue(true); |
903 | - } |
|
904 | - catch (Exception $e) { |
|
897 | + } catch (Exception $e) { |
|
905 | 898 | $this->fail(); |
906 | 899 | } |
907 | 900 | |
@@ -988,8 +981,7 @@ discard block |
||
988 | 981 | try { |
989 | 982 | $inboundEmail->checkEmail("INBOX"); |
990 | 983 | $this->assertTrue(true); |
991 | - } |
|
992 | - catch (Exception $e) { |
|
984 | + } catch (Exception $e) { |
|
993 | 985 | $this->fail(); |
994 | 986 | } |
995 | 987 | |
@@ -1001,8 +993,7 @@ discard block |
||
1001 | 993 | try { |
1002 | 994 | $inboundEmail->checkEmail("INBOX"); |
1003 | 995 | $this->assertTrue(true); |
1004 | - } |
|
1005 | - catch (Exception $e) { |
|
996 | + } catch (Exception $e) { |
|
1006 | 997 | $this->fail(); |
1007 | 998 | } |
1008 | 999 | |
@@ -1020,8 +1011,7 @@ discard block |
||
1020 | 1011 | try { |
1021 | 1012 | $inboundEmail->syncEmail(); |
1022 | 1013 | $this->assertTrue(true); |
1023 | - } |
|
1024 | - catch (Exception $e) { |
|
1014 | + } catch (Exception $e) { |
|
1025 | 1015 | $this->fail(); |
1026 | 1016 | } |
1027 | 1017 | |
@@ -1039,8 +1029,7 @@ discard block |
||
1039 | 1029 | try { |
1040 | 1030 | $inboundEmail->deleteCachedMessages("1,2", "test"); |
1041 | 1031 | $this->assertTrue(true); |
1042 | - } |
|
1043 | - catch (Exception $e) { |
|
1032 | + } catch (Exception $e) { |
|
1044 | 1033 | $this->fail(); |
1045 | 1034 | } |
1046 | 1035 | |
@@ -1151,8 +1140,7 @@ discard block |
||
1151 | 1140 | $inboundEmail->markEmails('1','answered'); |
1152 | 1141 | |
1153 | 1142 | $this->assertTrue(true); |
1154 | - } |
|
1155 | - catch (Exception $e) { |
|
1143 | + } catch (Exception $e) { |
|
1156 | 1144 | $this->fail(); |
1157 | 1145 | } |
1158 | 1146 | |
@@ -1535,8 +1523,7 @@ discard block |
||
1535 | 1523 | try { |
1536 | 1524 | $result = $inboundEmail->handleAutoresponse($email,$contactAddr); |
1537 | 1525 | $this->assertTrue(true); |
1538 | - } |
|
1539 | - catch (Exception $e) { |
|
1526 | + } catch (Exception $e) { |
|
1540 | 1527 | $this->fail(); |
1541 | 1528 | } |
1542 | 1529 | |
@@ -1579,8 +1566,7 @@ discard block |
||
1579 | 1566 | try { |
1580 | 1567 | $inboundEmail->handleMailboxType($email, $header); |
1581 | 1568 | $this->assertTrue(true); |
1582 | - } |
|
1583 | - catch (Exception $e) { |
|
1569 | + } catch (Exception $e) { |
|
1584 | 1570 | $this->fail(); |
1585 | 1571 | } |
1586 | 1572 | |
@@ -1629,8 +1615,7 @@ discard block |
||
1629 | 1615 | try { |
1630 | 1616 | $inboundEmail->handleCreateCase($email, 1); |
1631 | 1617 | $this->assertTrue(true); |
1632 | - } |
|
1633 | - catch (Exception $e) { |
|
1618 | + } catch (Exception $e) { |
|
1634 | 1619 | $this->fail(); |
1635 | 1620 | } |
1636 | 1621 | |
@@ -1707,8 +1692,7 @@ discard block |
||
1707 | 1692 | try { |
1708 | 1693 | $result = $inboundEmail->getMessageTextFromSingleMimePart(1,1,$structure); |
1709 | 1694 | $this->assertTrue(true); |
1710 | - } |
|
1711 | - catch (Exception $e) { |
|
1695 | + } catch (Exception $e) { |
|
1712 | 1696 | $this->fail(); |
1713 | 1697 | } |
1714 | 1698 | |
@@ -1754,8 +1738,7 @@ discard block |
||
1754 | 1738 | try { |
1755 | 1739 | $result = $inboundEmail->getMessageText(1, "PLAIN", $structure, $fullHeader); |
1756 | 1740 | $this->assertTrue(true); |
1757 | - } |
|
1758 | - catch (Exception $e) { |
|
1741 | + } catch (Exception $e) { |
|
1759 | 1742 | $this->fail(); |
1760 | 1743 | } |
1761 | 1744 | |
@@ -1825,8 +1808,7 @@ discard block |
||
1825 | 1808 | try { |
1826 | 1809 | $result = $inboundEmail->buildBreadCrumbs(array(), "ALTERNATIVE", '1'); |
1827 | 1810 | $this->assertTrue(true); |
1828 | - } |
|
1829 | - catch (Exception $e) { |
|
1811 | + } catch (Exception $e) { |
|
1830 | 1812 | $this->fail(); |
1831 | 1813 | } |
1832 | 1814 | |
@@ -1846,8 +1828,7 @@ discard block |
||
1846 | 1828 | try { |
1847 | 1829 | $inboundEmail->buildBreadCrumbsHTML(array()); |
1848 | 1830 | $this->assertTrue(true); |
1849 | - } |
|
1850 | - catch (Exception $e) { |
|
1831 | + } catch (Exception $e) { |
|
1851 | 1832 | $this->fail(); |
1852 | 1833 | } |
1853 | 1834 | |
@@ -1918,8 +1899,7 @@ discard block |
||
1918 | 1899 | try { |
1919 | 1900 | $inboundEmail->saveAttachments("1", array(), "1", '0', true); |
1920 | 1901 | $this->assertTrue(true); |
1921 | - } |
|
1922 | - catch (Exception $e) { |
|
1902 | + } catch (Exception $e) { |
|
1923 | 1903 | $this->fail(); |
1924 | 1904 | } |
1925 | 1905 | |
@@ -1983,8 +1963,7 @@ discard block |
||
1983 | 1963 | try { |
1984 | 1964 | $inboundEmail->saveAttachmentBinaries(new Note(), "1", "1.1", $part, 1); |
1985 | 1965 | $this->assertTrue(true); |
1986 | - } |
|
1987 | - catch (Exception $e) { |
|
1966 | + } catch (Exception $e) { |
|
1988 | 1967 | $this->fail(); |
1989 | 1968 | } |
1990 | 1969 | |
@@ -2064,8 +2043,7 @@ discard block |
||
2064 | 2043 | try { |
2065 | 2044 | $result = $inboundEmail->getDuplicateEmailId("1", "1"); |
2066 | 2045 | $this->assertTrue(true); |
2067 | - } |
|
2068 | - catch (Exception $e) { |
|
2046 | + } catch (Exception $e) { |
|
2069 | 2047 | $this->fail(); |
2070 | 2048 | } |
2071 | 2049 | |
@@ -2085,8 +2063,7 @@ discard block |
||
2085 | 2063 | try { |
2086 | 2064 | $result = $inboundEmail->importOneEmail("1", "1"); |
2087 | 2065 | $this->assertEquals(false,$result); |
2088 | - } |
|
2089 | - catch (Exception $e) { |
|
2066 | + } catch (Exception $e) { |
|
2090 | 2067 | $this->fail(); |
2091 | 2068 | } |
2092 | 2069 | |
@@ -2307,8 +2284,7 @@ discard block |
||
2307 | 2284 | try { |
2308 | 2285 | $inboundEmail->disconnectMailserver(); |
2309 | 2286 | $this->assertTrue(true); |
2310 | - } |
|
2311 | - catch (Exception $e) { |
|
2287 | + } catch (Exception $e) { |
|
2312 | 2288 | $this->fail(); |
2313 | 2289 | } |
2314 | 2290 | |
@@ -2338,8 +2314,7 @@ discard block |
||
2338 | 2314 | try { |
2339 | 2315 | $inboundEmail->checkImap(); |
2340 | 2316 | $this->assertTrue(true); |
2341 | - } |
|
2342 | - catch (Exception $e) { |
|
2317 | + } catch (Exception $e) { |
|
2343 | 2318 | $this->fail(); |
2344 | 2319 | } |
2345 | 2320 | |
@@ -2463,8 +2438,7 @@ discard block |
||
2463 | 2438 | try { |
2464 | 2439 | $inboundEmail->cleanOutCache(); |
2465 | 2440 | $this->assertTrue(true); |
2466 | - } |
|
2467 | - catch (Exception $e) { |
|
2441 | + } catch (Exception $e) { |
|
2468 | 2442 | $this->fail(); |
2469 | 2443 | } |
2470 | 2444 | |
@@ -2481,8 +2455,7 @@ discard block |
||
2481 | 2455 | try { |
2482 | 2456 | $result = $inboundEmail->copyEmails(1, "INBOX", 1, "TRASH", array(1)); |
2483 | 2457 | $this->assertTrue(true); |
2484 | - } |
|
2485 | - catch (Exception $e) { |
|
2458 | + } catch (Exception $e) { |
|
2486 | 2459 | $this->fail(); |
2487 | 2460 | } |
2488 | 2461 | |
@@ -2543,8 +2516,7 @@ discard block |
||
2543 | 2516 | try { |
2544 | 2517 | $inboundEmail->deleteMessageOnMailServerForPop3("1"); |
2545 | 2518 | $this->assertTrue(true); |
2546 | - } |
|
2547 | - catch (Exception $e) { |
|
2519 | + } catch (Exception $e) { |
|
2548 | 2520 | $this->fail(); |
2549 | 2521 | } |
2550 | 2522 | |
@@ -2791,8 +2763,7 @@ discard block |
||
2791 | 2763 | try { |
2792 | 2764 | $inboundEmail->insertMailBoxFolders(array("INBOX","OUTBOX")); |
2793 | 2765 | $this->assertTrue(true); |
2794 | - } |
|
2795 | - catch (Exception $e) { |
|
2766 | + } catch (Exception $e) { |
|
2796 | 2767 | $this->fail(); |
2797 | 2768 | } |
2798 | 2769 | |
@@ -2886,8 +2857,7 @@ discard block |
||
2886 | 2857 | try { |
2887 | 2858 | $inboundEmail->getNewEmailsForSyncedMailbox(); |
2888 | 2859 | $this->assertTrue(true); |
2889 | - } |
|
2890 | - catch (Exception $e) { |
|
2860 | + } catch (Exception $e) { |
|
2891 | 2861 | $this->fail(); |
2892 | 2862 | } |
2893 | 2863 | |
@@ -2904,8 +2874,7 @@ discard block |
||
2904 | 2874 | $inboundEmail->importMessages(); |
2905 | 2875 | |
2906 | 2876 | $this->assertTrue(true); |
2907 | - } |
|
2908 | - catch (Exception $e) { |
|
2877 | + } catch (Exception $e) { |
|
2909 | 2878 | $this->fail(); |
2910 | 2879 | } |
2911 | 2880 |
@@ -3,113 +3,113 @@ discard block |
||
3 | 3 | |
4 | 4 | class AOR_ReportTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | - public function testAOR_Report(){ |
|
6 | + public function testAOR_Report(){ |
|
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 | - $aor_Report = new AOR_Report(); |
|
12 | - $this->assertInstanceOf('AOR_Report',$aor_Report); |
|
13 | - $this->assertInstanceOf('Basic',$aor_Report); |
|
14 | - $this->assertInstanceOf('SugarBean',$aor_Report); |
|
10 | + //execute the contructor and check for the Object type and attributes |
|
11 | + $aor_Report = new AOR_Report(); |
|
12 | + $this->assertInstanceOf('AOR_Report',$aor_Report); |
|
13 | + $this->assertInstanceOf('Basic',$aor_Report); |
|
14 | + $this->assertInstanceOf('SugarBean',$aor_Report); |
|
15 | 15 | |
16 | - $this->assertAttributeEquals('AOR_Reports', 'module_dir', $aor_Report); |
|
17 | - $this->assertAttributeEquals('AOR_Report', 'object_name', $aor_Report); |
|
18 | - $this->assertAttributeEquals('aor_reports', 'table_name', $aor_Report); |
|
19 | - $this->assertAttributeEquals(true, 'new_schema', $aor_Report); |
|
20 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aor_Report); |
|
21 | - $this->assertAttributeEquals(true, 'importable', $aor_Report); |
|
16 | + $this->assertAttributeEquals('AOR_Reports', 'module_dir', $aor_Report); |
|
17 | + $this->assertAttributeEquals('AOR_Report', 'object_name', $aor_Report); |
|
18 | + $this->assertAttributeEquals('aor_reports', 'table_name', $aor_Report); |
|
19 | + $this->assertAttributeEquals(true, 'new_schema', $aor_Report); |
|
20 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aor_Report); |
|
21 | + $this->assertAttributeEquals(true, 'importable', $aor_Report); |
|
22 | 22 | |
23 | - } |
|
23 | + } |
|
24 | 24 | |
25 | - public function testbean_implements(){ |
|
25 | + public function testbean_implements(){ |
|
26 | 26 | |
27 | - $aor_Report = new AOR_Report(); |
|
27 | + $aor_Report = new AOR_Report(); |
|
28 | 28 | |
29 | - $this->assertEquals(false, $aor_Report->bean_implements('')); //test with blank value |
|
30 | - $this->assertEquals(false, $aor_Report->bean_implements('test')); //test with invalid value |
|
31 | - $this->assertEquals(true, $aor_Report->bean_implements('ACL')); //test with valid value |
|
29 | + $this->assertEquals(false, $aor_Report->bean_implements('')); //test with blank value |
|
30 | + $this->assertEquals(false, $aor_Report->bean_implements('test')); //test with invalid value |
|
31 | + $this->assertEquals(true, $aor_Report->bean_implements('ACL')); //test with valid value |
|
32 | 32 | |
33 | - } |
|
33 | + } |
|
34 | 34 | |
35 | 35 | public function testsave(){ |
36 | 36 | |
37 | - $aor_Report = new AOR_Report(); |
|
37 | + $aor_Report = new AOR_Report(); |
|
38 | 38 | |
39 | - //populate value for aor_fields related/child object |
|
40 | - $_POST['aor_fields_field'][] = 'test_field'; |
|
41 | - $_POST['aor_fields_name'][] = 'test'; |
|
42 | - $_POST['aor_fields_module_path'][] = 'test_path'; |
|
43 | - $_POST['aor_fields_display'][] = '1'; |
|
44 | - $_POST['aor_fields_link'][] = '1'; |
|
45 | - $_POST['aor_fields_label'][] = 'test_label'; |
|
46 | - $_POST['aor_fields_field_function'][] = 'test_function'; |
|
47 | - $_POST['aor_fields_total'][] = 'total'; |
|
48 | - $_POST['aor_fields_group_by'][] = '1'; |
|
49 | - $_POST['aor_fields_group_order'][] = 'desc'; |
|
50 | - $_POST['aor_fields_group_display'][] = '1'; |
|
39 | + //populate value for aor_fields related/child object |
|
40 | + $_POST['aor_fields_field'][] = 'test_field'; |
|
41 | + $_POST['aor_fields_name'][] = 'test'; |
|
42 | + $_POST['aor_fields_module_path'][] = 'test_path'; |
|
43 | + $_POST['aor_fields_display'][] = '1'; |
|
44 | + $_POST['aor_fields_link'][] = '1'; |
|
45 | + $_POST['aor_fields_label'][] = 'test_label'; |
|
46 | + $_POST['aor_fields_field_function'][] = 'test_function'; |
|
47 | + $_POST['aor_fields_total'][] = 'total'; |
|
48 | + $_POST['aor_fields_group_by'][] = '1'; |
|
49 | + $_POST['aor_fields_group_order'][] = 'desc'; |
|
50 | + $_POST['aor_fields_group_display'][] = '1'; |
|
51 | 51 | |
52 | - //populate values for aor_chart related/child object |
|
53 | - $_POST['aor_chart_id'] = array('test'=>''); |
|
54 | - $_POST['aor_chart_title'] = array('test'=>'test'); |
|
55 | - $_POST['aor_chart_type'] = array('test'=>'bar'); |
|
56 | - $_POST['aor_chart_x_field'] = array('test'=>'1'); |
|
57 | - $_POST['aor_chart_y_field'] = array('test'=>'2'); |
|
52 | + //populate values for aor_chart related/child object |
|
53 | + $_POST['aor_chart_id'] = array('test'=>''); |
|
54 | + $_POST['aor_chart_title'] = array('test'=>'test'); |
|
55 | + $_POST['aor_chart_type'] = array('test'=>'bar'); |
|
56 | + $_POST['aor_chart_x_field'] = array('test'=>'1'); |
|
57 | + $_POST['aor_chart_y_field'] = array('test'=>'2'); |
|
58 | 58 | |
59 | - //populate aor_Report object values |
|
60 | - $aor_Report->name = "test"; |
|
61 | - $aor_Report->description = "test text"; |
|
59 | + //populate aor_Report object values |
|
60 | + $aor_Report->name = "test"; |
|
61 | + $aor_Report->description = "test text"; |
|
62 | 62 | |
63 | - $aor_Report->save(); |
|
63 | + $aor_Report->save(); |
|
64 | 64 | |
65 | - //test for record ID to verify that record is saved |
|
66 | - $this->assertTrue(isset($aor_Report->id)); |
|
67 | - $this->assertEquals(36, strlen($aor_Report->id)); |
|
65 | + //test for record ID to verify that record is saved |
|
66 | + $this->assertTrue(isset($aor_Report->id)); |
|
67 | + $this->assertEquals(36, strlen($aor_Report->id)); |
|
68 | 68 | |
69 | 69 | |
70 | - //mark the record as deleted for cleanup |
|
71 | - $aor_Report->mark_deleted($aor_Report->id); |
|
70 | + //mark the record as deleted for cleanup |
|
71 | + $aor_Report->mark_deleted($aor_Report->id); |
|
72 | 72 | |
73 | - unset($aor_Report); |
|
73 | + unset($aor_Report); |
|
74 | 74 | |
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | 78 | public function testload_report_beans(){ |
79 | 79 | |
80 | - $aor_Report = new AOR_Report(); |
|
80 | + $aor_Report = new AOR_Report(); |
|
81 | 81 | |
82 | - //execute the method and test if it works and does not throws an exception. |
|
83 | - try { |
|
84 | - $aor_Report->load_report_beans(); |
|
85 | - $this->assertTrue(true); |
|
86 | - } |
|
87 | - catch (Exception $e) { |
|
88 | - $this->fail(); |
|
89 | - } |
|
82 | + //execute the method and test if it works and does not throws an exception. |
|
83 | + try { |
|
84 | + $aor_Report->load_report_beans(); |
|
85 | + $this->assertTrue(true); |
|
86 | + } |
|
87 | + catch (Exception $e) { |
|
88 | + $this->fail(); |
|
89 | + } |
|
90 | 90 | |
91 | 91 | } |
92 | 92 | |
93 | 93 | |
94 | 94 | public function testgetReportFields(){ |
95 | 95 | |
96 | - //execute the method and verify that it returns an array |
|
97 | - $aor_Report = new AOR_Report(); |
|
98 | - $result = $aor_Report->getReportFields(); |
|
99 | - $this->assertTrue(is_array($result)); |
|
96 | + //execute the method and verify that it returns an array |
|
97 | + $aor_Report = new AOR_Report(); |
|
98 | + $result = $aor_Report->getReportFields(); |
|
99 | + $this->assertTrue(is_array($result)); |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | |
103 | 103 | |
104 | 104 | public function testbuild_report_chart(){ |
105 | 105 | |
106 | - $aor_Report = new AOR_Report(); |
|
107 | - $aor_Report->report_module = "Accounts"; |
|
106 | + $aor_Report = new AOR_Report(); |
|
107 | + $aor_Report->report_module = "Accounts"; |
|
108 | 108 | |
109 | - //execute the method and verify that it returns chart display script. strings returned vary due to included chart id. |
|
110 | - $expected = '<script src="modules/AOR_Charts/lib/pChart/imagemap.js"></script>'; |
|
111 | - $result = $aor_Report->build_report_chart(); |
|
112 | - $this->assertStringStartsWith($expected, $result); |
|
109 | + //execute the method and verify that it returns chart display script. strings returned vary due to included chart id. |
|
110 | + $expected = '<script src="modules/AOR_Charts/lib/pChart/imagemap.js"></script>'; |
|
111 | + $result = $aor_Report->build_report_chart(); |
|
112 | + $this->assertStringStartsWith($expected, $result); |
|
113 | 113 | |
114 | 114 | } |
115 | 115 | |
@@ -117,26 +117,26 @@ discard block |
||
117 | 117 | public function testbuild_group_report(){ |
118 | 118 | |
119 | 119 | |
120 | - $aor_Report = new AOR_Report(); |
|
121 | - $aor_Report->report_module = "Accounts"; |
|
122 | - $aor_Report->id = "1"; |
|
120 | + $aor_Report = new AOR_Report(); |
|
121 | + $aor_Report->report_module = "Accounts"; |
|
122 | + $aor_Report->id = "1"; |
|
123 | 123 | |
124 | - //execute the method without any parameters and verify it returns html string |
|
125 | - $html1 = $aor_Report->build_group_report(); |
|
126 | - $this->assertGreaterThan(0,strlen($html1)); |
|
124 | + //execute the method without any parameters and verify it returns html string |
|
125 | + $html1 = $aor_Report->build_group_report(); |
|
126 | + $this->assertGreaterThan(0,strlen($html1)); |
|
127 | 127 | |
128 | - //execute the method wit offset parameter and verify it returns html string |
|
129 | - $html2 = $aor_Report->build_group_report(1); |
|
130 | - $this->assertGreaterThan(0,strlen($html2)); |
|
128 | + //execute the method wit offset parameter and verify it returns html string |
|
129 | + $html2 = $aor_Report->build_group_report(1); |
|
130 | + $this->assertGreaterThan(0,strlen($html2)); |
|
131 | 131 | |
132 | - //execute the method with both parameters and verify it returns html string |
|
133 | - $html3 = $aor_Report->build_group_report(0,false); |
|
134 | - $this->assertGreaterThan(0,strlen($html3)); |
|
132 | + //execute the method with both parameters and verify it returns html string |
|
133 | + $html3 = $aor_Report->build_group_report(0,false); |
|
134 | + $this->assertGreaterThan(0,strlen($html3)); |
|
135 | 135 | |
136 | - //verify that all three html strings are different. |
|
137 | - $this->assertNotEquals($html1,$html2); |
|
138 | - $this->assertNotEquals($html1,$html3); |
|
139 | - $this->assertNotEquals($html2,$html3); |
|
136 | + //verify that all three html strings are different. |
|
137 | + $this->assertNotEquals($html1,$html2); |
|
138 | + $this->assertNotEquals($html1,$html3); |
|
139 | + $this->assertNotEquals($html2,$html3); |
|
140 | 140 | |
141 | 141 | |
142 | 142 | } |
@@ -144,71 +144,71 @@ discard block |
||
144 | 144 | |
145 | 145 | public function testbuild_report_html(){ |
146 | 146 | |
147 | - $aor_Report = new AOR_Report(); |
|
148 | - $aor_Report->report_module = "Accounts"; |
|
147 | + $aor_Report = new AOR_Report(); |
|
148 | + $aor_Report->report_module = "Accounts"; |
|
149 | 149 | |
150 | 150 | |
151 | - //execute the method without any parameters and verify it returns html string |
|
152 | - $html1 = $aor_Report->build_report_html(); |
|
153 | - $this->assertGreaterThan(0,strlen($html1)); |
|
151 | + //execute the method without any parameters and verify it returns html string |
|
152 | + $html1 = $aor_Report->build_report_html(); |
|
153 | + $this->assertGreaterThan(0,strlen($html1)); |
|
154 | 154 | |
155 | 155 | |
156 | - //execute the method with both parameters and verify it returns html string |
|
157 | - $html2 = $aor_Report->build_report_html(0,false); |
|
158 | - $this->assertGreaterThan(0,strlen($html2)); |
|
156 | + //execute the method with both parameters and verify it returns html string |
|
157 | + $html2 = $aor_Report->build_report_html(0,false); |
|
158 | + $this->assertGreaterThan(0,strlen($html2)); |
|
159 | 159 | |
160 | 160 | |
161 | - //execute the method with group and identifier parameters and verify it returns html string |
|
162 | - $html3 = $aor_Report->build_report_html(1,false,'grouptest','testidentifier'); |
|
163 | - $this->assertGreaterThan(0,strlen($html3)); |
|
161 | + //execute the method with group and identifier parameters and verify it returns html string |
|
162 | + $html3 = $aor_Report->build_report_html(1,false,'grouptest','testidentifier'); |
|
163 | + $this->assertGreaterThan(0,strlen($html3)); |
|
164 | 164 | |
165 | 165 | |
166 | - //verify that group and identifier exist in the strings |
|
167 | - $this->assertNotFalse(strpos($html3,'grouptest')); |
|
168 | - $this->assertNotFalse(strpos($html3,'testidentifier')); |
|
166 | + //verify that group and identifier exist in the strings |
|
167 | + $this->assertNotFalse(strpos($html3,'grouptest')); |
|
168 | + $this->assertNotFalse(strpos($html3,'testidentifier')); |
|
169 | 169 | |
170 | 170 | } |
171 | 171 | |
172 | 172 | public function testgetTotalHTML(){ |
173 | 173 | |
174 | 174 | |
175 | - //execute the method with required data preset and verify it returns expected result |
|
176 | - $fields =Array('label'=>Array('display'=>1 , 'total'=> 'SUM','label'=>'total')); |
|
177 | - $totals = Array('label'=> array(10,20,30)); |
|
178 | - $expected = "<tbody><tr><th>total Sum</th></tr><tr><td>60</td></tr></tbody>"; |
|
175 | + //execute the method with required data preset and verify it returns expected result |
|
176 | + $fields =Array('label'=>Array('display'=>1 , 'total'=> 'SUM','label'=>'total')); |
|
177 | + $totals = Array('label'=> array(10,20,30)); |
|
178 | + $expected = "<tbody><tr><th>total Sum</th></tr><tr><td>60</td></tr></tbody>"; |
|
179 | 179 | |
180 | - $aor_Report = new AOR_Report(); |
|
181 | - $actual = $aor_Report->getTotalHTML($fields,$totals); |
|
180 | + $aor_Report = new AOR_Report(); |
|
181 | + $actual = $aor_Report->getTotalHTML($fields,$totals); |
|
182 | 182 | |
183 | - $this->assertSame($expected, $actual); |
|
183 | + $this->assertSame($expected, $actual); |
|
184 | 184 | |
185 | 185 | } |
186 | 186 | |
187 | 187 | public function testcalculateTotal(){ |
188 | 188 | |
189 | - //execute the method with data preset and verify it returns expected result |
|
190 | - $totals = Array(10,20,30); |
|
189 | + //execute the method with data preset and verify it returns expected result |
|
190 | + $totals = Array(10,20,30); |
|
191 | 191 | |
192 | - $aor_Report = new AOR_Report(); |
|
192 | + $aor_Report = new AOR_Report(); |
|
193 | 193 | |
194 | - $this->assertEquals('', $aor_Report->calculateTotal('', $totals)); |
|
195 | - $this->assertEquals(60, $aor_Report->calculateTotal('SUM', $totals)); |
|
196 | - $this->assertEquals(3, $aor_Report->calculateTotal('COUNT', $totals)); |
|
197 | - $this->assertEquals(20 , $aor_Report->calculateTotal('AVG', $totals)); |
|
194 | + $this->assertEquals('', $aor_Report->calculateTotal('', $totals)); |
|
195 | + $this->assertEquals(60, $aor_Report->calculateTotal('SUM', $totals)); |
|
196 | + $this->assertEquals(3, $aor_Report->calculateTotal('COUNT', $totals)); |
|
197 | + $this->assertEquals(20 , $aor_Report->calculateTotal('AVG', $totals)); |
|
198 | 198 | |
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | 202 | public function testbuild_report_csv(){ |
203 | 203 | |
204 | - //this method uses exit so it cannot be tested |
|
204 | + //this method uses exit so it cannot be tested |
|
205 | 205 | |
206 | - /*$aor_Report = new AOR_Report(); |
|
206 | + /*$aor_Report = new AOR_Report(); |
|
207 | 207 | $aor_Report->report_module = "Accounts"; |
208 | 208 | $aor_Report->build_report_csv(); |
209 | 209 | */ |
210 | 210 | |
211 | - $this->markTestIncomplete('Can Not be implemented'); |
|
211 | + $this->markTestIncomplete('Can Not be implemented'); |
|
212 | 212 | |
213 | 213 | } |
214 | 214 | |
@@ -216,76 +216,76 @@ discard block |
||
216 | 216 | |
217 | 217 | public function testbuild_report_query(){ |
218 | 218 | |
219 | - $aor_Report = new AOR_Report(); |
|
220 | - $aor_Report->report_module = "Accounts"; |
|
219 | + $aor_Report = new AOR_Report(); |
|
220 | + $aor_Report->report_module = "Accounts"; |
|
221 | 221 | |
222 | - //execute the method without any parameters and verify that it returns a non empty string |
|
223 | - $actual = $aor_Report->build_report_query(); |
|
224 | - $this->assertGreaterThan(0, strlen($actual)); |
|
222 | + //execute the method without any parameters and verify that it returns a non empty string |
|
223 | + $actual = $aor_Report->build_report_query(); |
|
224 | + $this->assertGreaterThan(0, strlen($actual)); |
|
225 | 225 | |
226 | - //execute the method with parameter and verify that it returns a non empty string |
|
227 | - $actual = $aor_Report->build_report_query('name'); |
|
228 | - $this->assertGreaterThan(0, strlen($actual)); |
|
226 | + //execute the method with parameter and verify that it returns a non empty string |
|
227 | + $actual = $aor_Report->build_report_query('name'); |
|
228 | + $this->assertGreaterThan(0, strlen($actual)); |
|
229 | 229 | |
230 | 230 | } |
231 | 231 | |
232 | 232 | public function testbuild_report_query_select(){ |
233 | 233 | |
234 | - $aor_Report = new AOR_Report(); |
|
235 | - $aor_Report->report_module = "Accounts"; |
|
236 | - $query_array = array(); |
|
234 | + $aor_Report = new AOR_Report(); |
|
235 | + $aor_Report->report_module = "Accounts"; |
|
236 | + $query_array = array(); |
|
237 | 237 | |
238 | - //execute the method with parameters and verify that it returns an array. |
|
239 | - $actual = $aor_Report->build_report_query_select($query_array, 'name'); |
|
240 | - $this->assertTrue(is_array($actual)); |
|
238 | + //execute the method with parameters and verify that it returns an array. |
|
239 | + $actual = $aor_Report->build_report_query_select($query_array, 'name'); |
|
240 | + $this->assertTrue(is_array($actual)); |
|
241 | 241 | |
242 | 242 | } |
243 | 243 | |
244 | 244 | |
245 | 245 | public function testbuild_report_query_join( ){ |
246 | 246 | |
247 | - $aor_Report = new AOR_Report(); |
|
248 | - $aor_Report->report_module = "Accounts"; |
|
247 | + $aor_Report = new AOR_Report(); |
|
248 | + $aor_Report->report_module = "Accounts"; |
|
249 | 249 | |
250 | 250 | |
251 | - //test with type custom and verify that it retunrs expected results |
|
252 | - $expected = array ('join' => array ('accounts_contacts' => 'LEFT JOIN `accounts_cstm` `contacts` ON `accounts`.id = `contacts`.id_c ')); |
|
253 | - $actual = $aor_Report->build_report_query_join('contacts', 'accounts_contacts', 'accounts', new Account() , 'custom', array() ); |
|
254 | - $this->assertSame($expected ,$actual); |
|
251 | + //test with type custom and verify that it retunrs expected results |
|
252 | + $expected = array ('join' => array ('accounts_contacts' => 'LEFT JOIN `accounts_cstm` `contacts` ON `accounts`.id = `contacts`.id_c ')); |
|
253 | + $actual = $aor_Report->build_report_query_join('contacts', 'accounts_contacts', 'accounts', new Account() , 'custom', array() ); |
|
254 | + $this->assertSame($expected ,$actual); |
|
255 | 255 | |
256 | 256 | |
257 | - //test with type relationship and verify that it retunrs expected results |
|
258 | - $expected = array ('join' =>array ('accounts_contacts' => "LEFT JOIN accounts_contacts `accounts|accounts_contacts` ON `accounts`.id=`accounts|accounts_contacts`.account_id AND `accounts|accounts_contacts`.deleted=0\n\nLEFT JOIN contacts `accounts_contacts` ON `accounts_contacts`.id=`accounts|accounts_contacts`.contact_id AND `accounts_contacts`.deleted=0\n"), |
|
259 | - 'select' =>array ('`accounts_contacts`.id AS \'accounts_contacts_id\'')); |
|
260 | - $actual = $aor_Report->build_report_query_join('contacts', 'accounts_contacts', 'accounts', new Account() , 'relationship', array() ); |
|
261 | - $this->assertSame($expected , $actual); |
|
257 | + //test with type relationship and verify that it retunrs expected results |
|
258 | + $expected = array ('join' =>array ('accounts_contacts' => "LEFT JOIN accounts_contacts `accounts|accounts_contacts` ON `accounts`.id=`accounts|accounts_contacts`.account_id AND `accounts|accounts_contacts`.deleted=0\n\nLEFT JOIN contacts `accounts_contacts` ON `accounts_contacts`.id=`accounts|accounts_contacts`.contact_id AND `accounts_contacts`.deleted=0\n"), |
|
259 | + 'select' =>array ('`accounts_contacts`.id AS \'accounts_contacts_id\'')); |
|
260 | + $actual = $aor_Report->build_report_query_join('contacts', 'accounts_contacts', 'accounts', new Account() , 'relationship', array() ); |
|
261 | + $this->assertSame($expected , $actual); |
|
262 | 262 | |
263 | 263 | } |
264 | 264 | |
265 | 265 | public function testbuild_report_access_query(){ |
266 | 266 | |
267 | - $aor_Report = new AOR_Report(); |
|
267 | + $aor_Report = new AOR_Report(); |
|
268 | 268 | |
269 | - //test without alias and verify that it retunrs expected results |
|
270 | - $result = $aor_Report->build_report_access_query(new AOR_Report(), ''); |
|
271 | - $this->assertEquals("",$result); |
|
269 | + //test without alias and verify that it retunrs expected results |
|
270 | + $result = $aor_Report->build_report_access_query(new AOR_Report(), ''); |
|
271 | + $this->assertEquals("",$result); |
|
272 | 272 | |
273 | - //test with alias and verify that it retunrs expected results |
|
274 | - $result = $aor_Report->build_report_access_query(new AOR_Report(), 'rep'); |
|
275 | - $this->assertEquals("",$result); |
|
273 | + //test with alias and verify that it retunrs expected results |
|
274 | + $result = $aor_Report->build_report_access_query(new AOR_Report(), 'rep'); |
|
275 | + $this->assertEquals("",$result); |
|
276 | 276 | |
277 | 277 | } |
278 | 278 | |
279 | 279 | |
280 | 280 | public function testbuild_report_query_where(){ |
281 | 281 | |
282 | - $aor_Report = new AOR_Report(); |
|
283 | - $aor_Report->report_module = "Accounts"; |
|
282 | + $aor_Report = new AOR_Report(); |
|
283 | + $aor_Report->report_module = "Accounts"; |
|
284 | 284 | |
285 | - //execute the method and verify that it retunrs expected results |
|
286 | - $expected = Array ('where' => array ('accounts.deleted = 0 ')); |
|
287 | - $actual = $aor_Report->build_report_query_where(); |
|
288 | - $this->assertSame($expected , $actual); |
|
285 | + //execute the method and verify that it retunrs expected results |
|
286 | + $expected = Array ('where' => array ('accounts.deleted = 0 ')); |
|
287 | + $actual = $aor_Report->build_report_query_where(); |
|
288 | + $this->assertSame($expected , $actual); |
|
289 | 289 | |
290 | 290 | } |
291 | 291 |
@@ -3,15 +3,15 @@ discard block |
||
3 | 3 | |
4 | 4 | class AOR_ReportTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | - public function testAOR_Report(){ |
|
6 | + public function testAOR_Report() { |
|
7 | 7 | |
8 | 8 | error_reporting(E_ERROR | E_PARSE); |
9 | 9 | |
10 | 10 | //execute the contructor and check for the Object type and attributes |
11 | 11 | $aor_Report = new AOR_Report(); |
12 | - $this->assertInstanceOf('AOR_Report',$aor_Report); |
|
13 | - $this->assertInstanceOf('Basic',$aor_Report); |
|
14 | - $this->assertInstanceOf('SugarBean',$aor_Report); |
|
12 | + $this->assertInstanceOf('AOR_Report', $aor_Report); |
|
13 | + $this->assertInstanceOf('Basic', $aor_Report); |
|
14 | + $this->assertInstanceOf('SugarBean', $aor_Report); |
|
15 | 15 | |
16 | 16 | $this->assertAttributeEquals('AOR_Reports', 'module_dir', $aor_Report); |
17 | 17 | $this->assertAttributeEquals('AOR_Report', 'object_name', $aor_Report); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | } |
24 | 24 | |
25 | - public function testbean_implements(){ |
|
25 | + public function testbean_implements() { |
|
26 | 26 | |
27 | 27 | $aor_Report = new AOR_Report(); |
28 | 28 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | } |
34 | 34 | |
35 | - public function testsave(){ |
|
35 | + public function testsave() { |
|
36 | 36 | |
37 | 37 | $aor_Report = new AOR_Report(); |
38 | 38 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | - public function testload_report_beans(){ |
|
78 | + public function testload_report_beans() { |
|
79 | 79 | |
80 | 80 | $aor_Report = new AOR_Report(); |
81 | 81 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | |
94 | - public function testgetReportFields(){ |
|
94 | + public function testgetReportFields() { |
|
95 | 95 | |
96 | 96 | //execute the method and verify that it returns an array |
97 | 97 | $aor_Report = new AOR_Report(); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | |
104 | - public function testbuild_report_chart(){ |
|
104 | + public function testbuild_report_chart() { |
|
105 | 105 | |
106 | 106 | $aor_Report = new AOR_Report(); |
107 | 107 | $aor_Report->report_module = "Accounts"; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | |
117 | - public function testbuild_group_report(){ |
|
117 | + public function testbuild_group_report() { |
|
118 | 118 | |
119 | 119 | |
120 | 120 | $aor_Report = new AOR_Report(); |
@@ -123,26 +123,26 @@ discard block |
||
123 | 123 | |
124 | 124 | //execute the method without any parameters and verify it returns html string |
125 | 125 | $html1 = $aor_Report->build_group_report(); |
126 | - $this->assertGreaterThan(0,strlen($html1)); |
|
126 | + $this->assertGreaterThan(0, strlen($html1)); |
|
127 | 127 | |
128 | 128 | //execute the method wit offset parameter and verify it returns html string |
129 | 129 | $html2 = $aor_Report->build_group_report(1); |
130 | - $this->assertGreaterThan(0,strlen($html2)); |
|
130 | + $this->assertGreaterThan(0, strlen($html2)); |
|
131 | 131 | |
132 | 132 | //execute the method with both parameters and verify it returns html string |
133 | - $html3 = $aor_Report->build_group_report(0,false); |
|
134 | - $this->assertGreaterThan(0,strlen($html3)); |
|
133 | + $html3 = $aor_Report->build_group_report(0, false); |
|
134 | + $this->assertGreaterThan(0, strlen($html3)); |
|
135 | 135 | |
136 | 136 | //verify that all three html strings are different. |
137 | - $this->assertNotEquals($html1,$html2); |
|
138 | - $this->assertNotEquals($html1,$html3); |
|
139 | - $this->assertNotEquals($html2,$html3); |
|
137 | + $this->assertNotEquals($html1, $html2); |
|
138 | + $this->assertNotEquals($html1, $html3); |
|
139 | + $this->assertNotEquals($html2, $html3); |
|
140 | 140 | |
141 | 141 | |
142 | 142 | } |
143 | 143 | |
144 | 144 | |
145 | - public function testbuild_report_html(){ |
|
145 | + public function testbuild_report_html() { |
|
146 | 146 | |
147 | 147 | $aor_Report = new AOR_Report(); |
148 | 148 | $aor_Report->report_module = "Accounts"; |
@@ -150,56 +150,56 @@ discard block |
||
150 | 150 | |
151 | 151 | //execute the method without any parameters and verify it returns html string |
152 | 152 | $html1 = $aor_Report->build_report_html(); |
153 | - $this->assertGreaterThan(0,strlen($html1)); |
|
153 | + $this->assertGreaterThan(0, strlen($html1)); |
|
154 | 154 | |
155 | 155 | |
156 | 156 | //execute the method with both parameters and verify it returns html string |
157 | - $html2 = $aor_Report->build_report_html(0,false); |
|
158 | - $this->assertGreaterThan(0,strlen($html2)); |
|
157 | + $html2 = $aor_Report->build_report_html(0, false); |
|
158 | + $this->assertGreaterThan(0, strlen($html2)); |
|
159 | 159 | |
160 | 160 | |
161 | 161 | //execute the method with group and identifier parameters and verify it returns html string |
162 | - $html3 = $aor_Report->build_report_html(1,false,'grouptest','testidentifier'); |
|
163 | - $this->assertGreaterThan(0,strlen($html3)); |
|
162 | + $html3 = $aor_Report->build_report_html(1, false, 'grouptest', 'testidentifier'); |
|
163 | + $this->assertGreaterThan(0, strlen($html3)); |
|
164 | 164 | |
165 | 165 | |
166 | 166 | //verify that group and identifier exist in the strings |
167 | - $this->assertNotFalse(strpos($html3,'grouptest')); |
|
168 | - $this->assertNotFalse(strpos($html3,'testidentifier')); |
|
167 | + $this->assertNotFalse(strpos($html3, 'grouptest')); |
|
168 | + $this->assertNotFalse(strpos($html3, 'testidentifier')); |
|
169 | 169 | |
170 | 170 | } |
171 | 171 | |
172 | - public function testgetTotalHTML(){ |
|
172 | + public function testgetTotalHTML() { |
|
173 | 173 | |
174 | 174 | |
175 | 175 | //execute the method with required data preset and verify it returns expected result |
176 | - $fields =Array('label'=>Array('display'=>1 , 'total'=> 'SUM','label'=>'total')); |
|
177 | - $totals = Array('label'=> array(10,20,30)); |
|
176 | + $fields = Array('label'=>Array('display'=>1, 'total'=> 'SUM', 'label'=>'total')); |
|
177 | + $totals = Array('label'=> array(10, 20, 30)); |
|
178 | 178 | $expected = "<tbody><tr><th>total Sum</th></tr><tr><td>60</td></tr></tbody>"; |
179 | 179 | |
180 | 180 | $aor_Report = new AOR_Report(); |
181 | - $actual = $aor_Report->getTotalHTML($fields,$totals); |
|
181 | + $actual = $aor_Report->getTotalHTML($fields, $totals); |
|
182 | 182 | |
183 | 183 | $this->assertSame($expected, $actual); |
184 | 184 | |
185 | 185 | } |
186 | 186 | |
187 | - public function testcalculateTotal(){ |
|
187 | + public function testcalculateTotal() { |
|
188 | 188 | |
189 | 189 | //execute the method with data preset and verify it returns expected result |
190 | - $totals = Array(10,20,30); |
|
190 | + $totals = Array(10, 20, 30); |
|
191 | 191 | |
192 | 192 | $aor_Report = new AOR_Report(); |
193 | 193 | |
194 | 194 | $this->assertEquals('', $aor_Report->calculateTotal('', $totals)); |
195 | 195 | $this->assertEquals(60, $aor_Report->calculateTotal('SUM', $totals)); |
196 | 196 | $this->assertEquals(3, $aor_Report->calculateTotal('COUNT', $totals)); |
197 | - $this->assertEquals(20 , $aor_Report->calculateTotal('AVG', $totals)); |
|
197 | + $this->assertEquals(20, $aor_Report->calculateTotal('AVG', $totals)); |
|
198 | 198 | |
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | - public function testbuild_report_csv(){ |
|
202 | + public function testbuild_report_csv() { |
|
203 | 203 | |
204 | 204 | //this method uses exit so it cannot be tested |
205 | 205 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | |
216 | 216 | |
217 | - public function testbuild_report_query(){ |
|
217 | + public function testbuild_report_query() { |
|
218 | 218 | |
219 | 219 | $aor_Report = new AOR_Report(); |
220 | 220 | $aor_Report->report_module = "Accounts"; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | } |
231 | 231 | |
232 | - public function testbuild_report_query_select(){ |
|
232 | + public function testbuild_report_query_select() { |
|
233 | 233 | |
234 | 234 | $aor_Report = new AOR_Report(); |
235 | 235 | $aor_Report->report_module = "Accounts"; |
@@ -242,50 +242,50 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | |
245 | - public function testbuild_report_query_join( ){ |
|
245 | + public function testbuild_report_query_join( ) { |
|
246 | 246 | |
247 | 247 | $aor_Report = new AOR_Report(); |
248 | 248 | $aor_Report->report_module = "Accounts"; |
249 | 249 | |
250 | 250 | |
251 | 251 | //test with type custom and verify that it retunrs expected results |
252 | - $expected = array ('join' => array ('accounts_contacts' => 'LEFT JOIN `accounts_cstm` `contacts` ON `accounts`.id = `contacts`.id_c ')); |
|
253 | - $actual = $aor_Report->build_report_query_join('contacts', 'accounts_contacts', 'accounts', new Account() , 'custom', array() ); |
|
254 | - $this->assertSame($expected ,$actual); |
|
252 | + $expected = array('join' => array('accounts_contacts' => 'LEFT JOIN `accounts_cstm` `contacts` ON `accounts`.id = `contacts`.id_c ')); |
|
253 | + $actual = $aor_Report->build_report_query_join('contacts', 'accounts_contacts', 'accounts', new Account(), 'custom', array()); |
|
254 | + $this->assertSame($expected, $actual); |
|
255 | 255 | |
256 | 256 | |
257 | 257 | //test with type relationship and verify that it retunrs expected results |
258 | - $expected = array ('join' =>array ('accounts_contacts' => "LEFT JOIN accounts_contacts `accounts|accounts_contacts` ON `accounts`.id=`accounts|accounts_contacts`.account_id AND `accounts|accounts_contacts`.deleted=0\n\nLEFT JOIN contacts `accounts_contacts` ON `accounts_contacts`.id=`accounts|accounts_contacts`.contact_id AND `accounts_contacts`.deleted=0\n"), |
|
259 | - 'select' =>array ('`accounts_contacts`.id AS \'accounts_contacts_id\'')); |
|
260 | - $actual = $aor_Report->build_report_query_join('contacts', 'accounts_contacts', 'accounts', new Account() , 'relationship', array() ); |
|
261 | - $this->assertSame($expected , $actual); |
|
258 | + $expected = array('join' =>array('accounts_contacts' => "LEFT JOIN accounts_contacts `accounts|accounts_contacts` ON `accounts`.id=`accounts|accounts_contacts`.account_id AND `accounts|accounts_contacts`.deleted=0\n\nLEFT JOIN contacts `accounts_contacts` ON `accounts_contacts`.id=`accounts|accounts_contacts`.contact_id AND `accounts_contacts`.deleted=0\n"), |
|
259 | + 'select' =>array('`accounts_contacts`.id AS \'accounts_contacts_id\'')); |
|
260 | + $actual = $aor_Report->build_report_query_join('contacts', 'accounts_contacts', 'accounts', new Account(), 'relationship', array()); |
|
261 | + $this->assertSame($expected, $actual); |
|
262 | 262 | |
263 | 263 | } |
264 | 264 | |
265 | - public function testbuild_report_access_query(){ |
|
265 | + public function testbuild_report_access_query() { |
|
266 | 266 | |
267 | 267 | $aor_Report = new AOR_Report(); |
268 | 268 | |
269 | 269 | //test without alias and verify that it retunrs expected results |
270 | 270 | $result = $aor_Report->build_report_access_query(new AOR_Report(), ''); |
271 | - $this->assertEquals("",$result); |
|
271 | + $this->assertEquals("", $result); |
|
272 | 272 | |
273 | 273 | //test with alias and verify that it retunrs expected results |
274 | 274 | $result = $aor_Report->build_report_access_query(new AOR_Report(), 'rep'); |
275 | - $this->assertEquals("",$result); |
|
275 | + $this->assertEquals("", $result); |
|
276 | 276 | |
277 | 277 | } |
278 | 278 | |
279 | 279 | |
280 | - public function testbuild_report_query_where(){ |
|
280 | + public function testbuild_report_query_where() { |
|
281 | 281 | |
282 | 282 | $aor_Report = new AOR_Report(); |
283 | 283 | $aor_Report->report_module = "Accounts"; |
284 | 284 | |
285 | 285 | //execute the method and verify that it retunrs expected results |
286 | - $expected = Array ('where' => array ('accounts.deleted = 0 ')); |
|
286 | + $expected = Array('where' => array('accounts.deleted = 0 ')); |
|
287 | 287 | $actual = $aor_Report->build_report_query_where(); |
288 | - $this->assertSame($expected , $actual); |
|
288 | + $this->assertSame($expected, $actual); |
|
289 | 289 | |
290 | 290 | } |
291 | 291 |
@@ -83,8 +83,7 @@ |
||
83 | 83 | try { |
84 | 84 | $aor_Report->load_report_beans(); |
85 | 85 | $this->assertTrue(true); |
86 | - } |
|
87 | - catch (Exception $e) { |
|
86 | + } catch (Exception $e) { |
|
88 | 87 | $this->fail(); |
89 | 88 | } |
90 | 89 |
@@ -3,176 +3,176 @@ |
||
3 | 3 | class NoteTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | 5 | |
6 | - public function testNote() { |
|
6 | + public function testNote() { |
|
7 | 7 | |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $note = new Note(); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $note = new Note(); |
|
10 | 10 | |
11 | - $this->assertInstanceOf('Note',$note); |
|
12 | - $this->assertInstanceOf('SugarBean',$note); |
|
11 | + $this->assertInstanceOf('Note',$note); |
|
12 | + $this->assertInstanceOf('SugarBean',$note); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('Notes', 'module_dir', $note); |
|
15 | - $this->assertAttributeEquals('Note', 'object_name', $note); |
|
16 | - $this->assertAttributeEquals('notes', 'table_name', $note); |
|
14 | + $this->assertAttributeEquals('Notes', 'module_dir', $note); |
|
15 | + $this->assertAttributeEquals('Note', 'object_name', $note); |
|
16 | + $this->assertAttributeEquals('notes', 'table_name', $note); |
|
17 | 17 | |
18 | - $this->assertAttributeEquals(true, 'new_schema', $note); |
|
19 | - $this->assertAttributeEquals(true, 'importable', $note); |
|
18 | + $this->assertAttributeEquals(true, 'new_schema', $note); |
|
19 | + $this->assertAttributeEquals(true, 'importable', $note); |
|
20 | 20 | |
21 | - } |
|
21 | + } |
|
22 | 22 | |
23 | - public function testsafeAttachmentName() { |
|
23 | + public function testsafeAttachmentName() { |
|
24 | 24 | |
25 | - error_reporting(E_ERROR | E_PARSE); |
|
25 | + error_reporting(E_ERROR | E_PARSE); |
|
26 | 26 | |
27 | - $note = new Note(); |
|
27 | + $note = new Note(); |
|
28 | 28 | |
29 | - //test with valid file name |
|
30 | - $note->filename = "test.txt"; |
|
31 | - $note->safeAttachmentName(); |
|
32 | - $this->assertEquals("test.txt" ,$note->filename); |
|
29 | + //test with valid file name |
|
30 | + $note->filename = "test.txt"; |
|
31 | + $note->safeAttachmentName(); |
|
32 | + $this->assertEquals("test.txt" ,$note->filename); |
|
33 | 33 | |
34 | 34 | |
35 | - //test with invalid file name |
|
36 | - $note->filename = "test.php"; |
|
37 | - $note->safeAttachmentName(); |
|
38 | - $this->assertEquals(".txt" ,$note->name); |
|
39 | - $this->assertEquals("test.php.txt" ,$note->filename); |
|
35 | + //test with invalid file name |
|
36 | + $note->filename = "test.php"; |
|
37 | + $note->safeAttachmentName(); |
|
38 | + $this->assertEquals(".txt" ,$note->name); |
|
39 | + $this->assertEquals("test.php.txt" ,$note->filename); |
|
40 | 40 | |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | - public function testmark_deleted() { |
|
44 | + public function testmark_deleted() { |
|
45 | 45 | |
46 | - $note = new Note(); |
|
46 | + $note = new Note(); |
|
47 | 47 | |
48 | - //execute the method and test if it works and does not throws an exception. |
|
49 | - try { |
|
50 | - $note->mark_deleted(1); |
|
51 | - $this->assertTrue(true); |
|
52 | - } |
|
53 | - catch (Exception $e) { |
|
54 | - $this->fail(); |
|
55 | - } |
|
48 | + //execute the method and test if it works and does not throws an exception. |
|
49 | + try { |
|
50 | + $note->mark_deleted(1); |
|
51 | + $this->assertTrue(true); |
|
52 | + } |
|
53 | + catch (Exception $e) { |
|
54 | + $this->fail(); |
|
55 | + } |
|
56 | 56 | |
57 | - } |
|
57 | + } |
|
58 | 58 | |
59 | - public function testdeleteAttachment(){ |
|
59 | + public function testdeleteAttachment(){ |
|
60 | 60 | |
61 | - $note = new Note(); |
|
61 | + $note = new Note(); |
|
62 | 62 | |
63 | - $note->id = 1; |
|
64 | - $result = $note->deleteAttachment(); |
|
65 | - $this->assertEquals(true, $result); |
|
63 | + $note->id = 1; |
|
64 | + $result = $note->deleteAttachment(); |
|
65 | + $this->assertEquals(true, $result); |
|
66 | 66 | |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | 69 | |
70 | - public function testget_summary_text() { |
|
70 | + public function testget_summary_text() { |
|
71 | 71 | |
72 | - $note = new Note(); |
|
72 | + $note = new Note(); |
|
73 | 73 | |
74 | - //test without setting name |
|
75 | - $this->assertEquals('',$note->get_summary_text()); |
|
74 | + //test without setting name |
|
75 | + $this->assertEquals('',$note->get_summary_text()); |
|
76 | 76 | |
77 | - //test with name set |
|
78 | - $note->name = "test"; |
|
79 | - $this->assertEquals('test',$note->get_summary_text()); |
|
77 | + //test with name set |
|
78 | + $note->name = "test"; |
|
79 | + $this->assertEquals('test',$note->get_summary_text()); |
|
80 | 80 | |
81 | - } |
|
81 | + } |
|
82 | 82 | |
83 | 83 | public function testcreate_export_query() |
84 | 84 | { |
85 | 85 | |
86 | - $note = new Note(); |
|
86 | + $note = new Note(); |
|
87 | 87 | |
88 | - //test with empty string params |
|
89 | - $expected = "SELECT notes.*, contacts.first_name, contacts.last_name, users.user_name as assigned_user_name FROM notes LEFT JOIN contacts ON notes.contact_id=contacts.id LEFT JOIN users ON notes.assigned_user_id=users.id where notes.deleted=0 AND (contacts.deleted IS NULL OR contacts.deleted=0) ORDER BY notes.name"; |
|
90 | - $actual = $note->create_export_query('',''); |
|
91 | - $this->assertSame($expected,$actual); |
|
88 | + //test with empty string params |
|
89 | + $expected = "SELECT notes.*, contacts.first_name, contacts.last_name, users.user_name as assigned_user_name FROM notes LEFT JOIN contacts ON notes.contact_id=contacts.id LEFT JOIN users ON notes.assigned_user_id=users.id where notes.deleted=0 AND (contacts.deleted IS NULL OR contacts.deleted=0) ORDER BY notes.name"; |
|
90 | + $actual = $note->create_export_query('',''); |
|
91 | + $this->assertSame($expected,$actual); |
|
92 | 92 | |
93 | 93 | |
94 | - //test with valid string params |
|
95 | - $expected = "SELECT notes.*, contacts.first_name, contacts.last_name, users.user_name as assigned_user_name FROM notes LEFT JOIN contacts ON notes.contact_id=contacts.id LEFT JOIN users ON notes.assigned_user_id=users.id where users.user_name=\"\" AND notes.deleted=0 AND (contacts.deleted IS NULL OR contacts.deleted=0) ORDER BY notes.name"; |
|
96 | - $actual = $note->create_export_query('notes.id','users.user_name=""'); |
|
97 | - $this->assertSame($expected,$actual); |
|
94 | + //test with valid string params |
|
95 | + $expected = "SELECT notes.*, contacts.first_name, contacts.last_name, users.user_name as assigned_user_name FROM notes LEFT JOIN contacts ON notes.contact_id=contacts.id LEFT JOIN users ON notes.assigned_user_id=users.id where users.user_name=\"\" AND notes.deleted=0 AND (contacts.deleted IS NULL OR contacts.deleted=0) ORDER BY notes.name"; |
|
96 | + $actual = $note->create_export_query('notes.id','users.user_name=""'); |
|
97 | + $this->assertSame($expected,$actual); |
|
98 | 98 | |
99 | - } |
|
99 | + } |
|
100 | 100 | |
101 | - public function testfill_in_additional_list_fields() { |
|
101 | + public function testfill_in_additional_list_fields() { |
|
102 | 102 | |
103 | - $note = new Note(); |
|
103 | + $note = new Note(); |
|
104 | 104 | |
105 | - //execute the method and test if it works and does not throws an exception. |
|
106 | - try { |
|
107 | - $note->fill_in_additional_list_fields(); |
|
108 | - $this->assertTrue(true); |
|
109 | - } |
|
110 | - catch (Exception $e) { |
|
111 | - $this->fail(); |
|
112 | - } |
|
105 | + //execute the method and test if it works and does not throws an exception. |
|
106 | + try { |
|
107 | + $note->fill_in_additional_list_fields(); |
|
108 | + $this->assertTrue(true); |
|
109 | + } |
|
110 | + catch (Exception $e) { |
|
111 | + $this->fail(); |
|
112 | + } |
|
113 | 113 | |
114 | - } |
|
114 | + } |
|
115 | 115 | |
116 | - public function testfill_in_additional_detail_fields() { |
|
116 | + public function testfill_in_additional_detail_fields() { |
|
117 | 117 | |
118 | - $note = new Note(); |
|
118 | + $note = new Note(); |
|
119 | 119 | |
120 | - //execute the method and test if it works and does not throws an exception. |
|
121 | - try { |
|
122 | - $note->fill_in_additional_detail_fields(); |
|
123 | - $this->assertTrue(true); |
|
124 | - } |
|
125 | - catch (Exception $e) { |
|
126 | - $this->fail(); |
|
127 | - } |
|
120 | + //execute the method and test if it works and does not throws an exception. |
|
121 | + try { |
|
122 | + $note->fill_in_additional_detail_fields(); |
|
123 | + $this->assertTrue(true); |
|
124 | + } |
|
125 | + catch (Exception $e) { |
|
126 | + $this->fail(); |
|
127 | + } |
|
128 | 128 | |
129 | - } |
|
129 | + } |
|
130 | 130 | |
131 | 131 | |
132 | - public function testget_list_view_data() |
|
133 | - { |
|
134 | - $note = new Note(); |
|
135 | - $id = "abcdef12345"; |
|
132 | + public function testget_list_view_data() |
|
133 | + { |
|
134 | + $note = new Note(); |
|
135 | + $id = "abcdef12345"; |
|
136 | 136 | $note->id = $id; |
137 | - $note->parent_type = "Account"; |
|
138 | - $note->filename = "test.txt"; |
|
139 | - $note->contact_name = "test contact"; |
|
137 | + $note->parent_type = "Account"; |
|
138 | + $note->filename = "test.txt"; |
|
139 | + $note->contact_name = "test contact"; |
|
140 | 140 | |
141 | - $expected = array ( |
|
142 | - 'ID' => $id, |
|
143 | - 'FILENAME' => 'test.txt', |
|
144 | - 'PARENT_TYPE' => 'Account', |
|
145 | - 'EMBED_FLAG' => '0', |
|
146 | - 'DELETED' => 0, |
|
147 | - 'CONTACT_NAME' => 'test contact', |
|
148 | - 'PARENT_MODULE' => 'Account', |
|
149 | - 'STATUS' => 'Note', |
|
150 | - ); |
|
141 | + $expected = array ( |
|
142 | + 'ID' => $id, |
|
143 | + 'FILENAME' => 'test.txt', |
|
144 | + 'PARENT_TYPE' => 'Account', |
|
145 | + 'EMBED_FLAG' => '0', |
|
146 | + 'DELETED' => 0, |
|
147 | + 'CONTACT_NAME' => 'test contact', |
|
148 | + 'PARENT_MODULE' => 'Account', |
|
149 | + 'STATUS' => 'Note', |
|
150 | + ); |
|
151 | 151 | |
152 | - $actual = $note->get_list_view_data(); |
|
152 | + $actual = $note->get_list_view_data(); |
|
153 | 153 | |
154 | - $this->assertSame($expected, $actual); |
|
154 | + $this->assertSame($expected, $actual); |
|
155 | 155 | |
156 | - } |
|
156 | + } |
|
157 | 157 | |
158 | - public function testlistviewACLHelper() { |
|
158 | + public function testlistviewACLHelper() { |
|
159 | 159 | |
160 | - $note = new Note(); |
|
160 | + $note = new Note(); |
|
161 | 161 | |
162 | - $expected = array("MAIN"=>"a", "PARENT"=>"a", "CONTACT"=>"a" ); |
|
163 | - $actual = $note->listviewACLHelper(); |
|
164 | - $this->assertSame($expected,$actual); |
|
162 | + $expected = array("MAIN"=>"a", "PARENT"=>"a", "CONTACT"=>"a" ); |
|
163 | + $actual = $note->listviewACLHelper(); |
|
164 | + $this->assertSame($expected,$actual); |
|
165 | 165 | |
166 | - } |
|
166 | + } |
|
167 | 167 | |
168 | - public function testbean_implements() { |
|
168 | + public function testbean_implements() { |
|
169 | 169 | |
170 | - $note = new Note(); |
|
170 | + $note = new Note(); |
|
171 | 171 | |
172 | - $this->assertEquals(false, $note->bean_implements('')); //test with blank value |
|
173 | - $this->assertEquals(false, $note->bean_implements('test')); //test with invalid value |
|
174 | - $this->assertEquals(true, $note->bean_implements('ACL')); //test with valid value |
|
172 | + $this->assertEquals(false, $note->bean_implements('')); //test with blank value |
|
173 | + $this->assertEquals(false, $note->bean_implements('test')); //test with invalid value |
|
174 | + $this->assertEquals(true, $note->bean_implements('ACL')); //test with valid value |
|
175 | 175 | |
176 | - } |
|
176 | + } |
|
177 | 177 | |
178 | 178 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class NoteTest extends PHPUnit_Framework_TestCase { |
|
3 | +class NoteTest extends PHPUnit_Framework_TestCase { |
|
4 | 4 | |
5 | 5 | |
6 | 6 | public function testNote() { |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | //execute the contructor and check for the Object type and attributes |
9 | 9 | $note = new Note(); |
10 | 10 | |
11 | - $this->assertInstanceOf('Note',$note); |
|
12 | - $this->assertInstanceOf('SugarBean',$note); |
|
11 | + $this->assertInstanceOf('Note', $note); |
|
12 | + $this->assertInstanceOf('SugarBean', $note); |
|
13 | 13 | |
14 | 14 | $this->assertAttributeEquals('Notes', 'module_dir', $note); |
15 | 15 | $this->assertAttributeEquals('Note', 'object_name', $note); |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | //test with valid file name |
30 | 30 | $note->filename = "test.txt"; |
31 | 31 | $note->safeAttachmentName(); |
32 | - $this->assertEquals("test.txt" ,$note->filename); |
|
32 | + $this->assertEquals("test.txt", $note->filename); |
|
33 | 33 | |
34 | 34 | |
35 | 35 | //test with invalid file name |
36 | 36 | $note->filename = "test.php"; |
37 | 37 | $note->safeAttachmentName(); |
38 | - $this->assertEquals(".txt" ,$note->name); |
|
39 | - $this->assertEquals("test.php.txt" ,$note->filename); |
|
38 | + $this->assertEquals(".txt", $note->name); |
|
39 | + $this->assertEquals("test.php.txt", $note->filename); |
|
40 | 40 | |
41 | 41 | } |
42 | 42 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | } |
58 | 58 | |
59 | - public function testdeleteAttachment(){ |
|
59 | + public function testdeleteAttachment() { |
|
60 | 60 | |
61 | 61 | $note = new Note(); |
62 | 62 | |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | $note = new Note(); |
73 | 73 | |
74 | 74 | //test without setting name |
75 | - $this->assertEquals('',$note->get_summary_text()); |
|
75 | + $this->assertEquals('', $note->get_summary_text()); |
|
76 | 76 | |
77 | 77 | //test with name set |
78 | 78 | $note->name = "test"; |
79 | - $this->assertEquals('test',$note->get_summary_text()); |
|
79 | + $this->assertEquals('test', $note->get_summary_text()); |
|
80 | 80 | |
81 | 81 | } |
82 | 82 | |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | |
88 | 88 | //test with empty string params |
89 | 89 | $expected = "SELECT notes.*, contacts.first_name, contacts.last_name, users.user_name as assigned_user_name FROM notes LEFT JOIN contacts ON notes.contact_id=contacts.id LEFT JOIN users ON notes.assigned_user_id=users.id where notes.deleted=0 AND (contacts.deleted IS NULL OR contacts.deleted=0) ORDER BY notes.name"; |
90 | - $actual = $note->create_export_query('',''); |
|
91 | - $this->assertSame($expected,$actual); |
|
90 | + $actual = $note->create_export_query('', ''); |
|
91 | + $this->assertSame($expected, $actual); |
|
92 | 92 | |
93 | 93 | |
94 | 94 | //test with valid string params |
95 | 95 | $expected = "SELECT notes.*, contacts.first_name, contacts.last_name, users.user_name as assigned_user_name FROM notes LEFT JOIN contacts ON notes.contact_id=contacts.id LEFT JOIN users ON notes.assigned_user_id=users.id where users.user_name=\"\" AND notes.deleted=0 AND (contacts.deleted IS NULL OR contacts.deleted=0) ORDER BY notes.name"; |
96 | - $actual = $note->create_export_query('notes.id','users.user_name=""'); |
|
97 | - $this->assertSame($expected,$actual); |
|
96 | + $actual = $note->create_export_query('notes.id', 'users.user_name=""'); |
|
97 | + $this->assertSame($expected, $actual); |
|
98 | 98 | |
99 | 99 | } |
100 | 100 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $note->filename = "test.txt"; |
139 | 139 | $note->contact_name = "test contact"; |
140 | 140 | |
141 | - $expected = array ( |
|
141 | + $expected = array( |
|
142 | 142 | 'ID' => $id, |
143 | 143 | 'FILENAME' => 'test.txt', |
144 | 144 | 'PARENT_TYPE' => 'Account', |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | |
160 | 160 | $note = new Note(); |
161 | 161 | |
162 | - $expected = array("MAIN"=>"a", "PARENT"=>"a", "CONTACT"=>"a" ); |
|
162 | + $expected = array("MAIN"=>"a", "PARENT"=>"a", "CONTACT"=>"a"); |
|
163 | 163 | $actual = $note->listviewACLHelper(); |
164 | - $this->assertSame($expected,$actual); |
|
164 | + $this->assertSame($expected, $actual); |
|
165 | 165 | |
166 | 166 | } |
167 | 167 |
@@ -49,8 +49,7 @@ discard block |
||
49 | 49 | try { |
50 | 50 | $note->mark_deleted(1); |
51 | 51 | $this->assertTrue(true); |
52 | - } |
|
53 | - catch (Exception $e) { |
|
52 | + } catch (Exception $e) { |
|
54 | 53 | $this->fail(); |
55 | 54 | } |
56 | 55 | |
@@ -106,8 +105,7 @@ discard block |
||
106 | 105 | try { |
107 | 106 | $note->fill_in_additional_list_fields(); |
108 | 107 | $this->assertTrue(true); |
109 | - } |
|
110 | - catch (Exception $e) { |
|
108 | + } catch (Exception $e) { |
|
111 | 109 | $this->fail(); |
112 | 110 | } |
113 | 111 | |
@@ -121,8 +119,7 @@ discard block |
||
121 | 119 | try { |
122 | 120 | $note->fill_in_additional_detail_fields(); |
123 | 121 | $this->assertTrue(true); |
124 | - } |
|
125 | - catch (Exception $e) { |
|
122 | + } catch (Exception $e) { |
|
126 | 123 | $this->fail(); |
127 | 124 | } |
128 | 125 |
@@ -3,133 +3,133 @@ discard block |
||
3 | 3 | class LeadTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | 5 | |
6 | - public function testLead() |
|
7 | - { |
|
6 | + public function testLead() |
|
7 | + { |
|
8 | 8 | |
9 | - //execute the contructor and check for the Object type and attributes |
|
10 | - $lead = new Lead(); |
|
9 | + //execute the contructor and check for the Object type and attributes |
|
10 | + $lead = new Lead(); |
|
11 | 11 | |
12 | - $this->assertInstanceOf('Lead',$lead); |
|
13 | - $this->assertInstanceOf('Person',$lead); |
|
14 | - $this->assertInstanceOf('SugarBean',$lead); |
|
12 | + $this->assertInstanceOf('Lead',$lead); |
|
13 | + $this->assertInstanceOf('Person',$lead); |
|
14 | + $this->assertInstanceOf('SugarBean',$lead); |
|
15 | 15 | |
16 | - $this->assertAttributeEquals('Leads', 'module_dir', $lead); |
|
17 | - $this->assertAttributeEquals('Lead', 'object_name', $lead); |
|
18 | - $this->assertAttributeEquals('Leads', 'object_names', $lead); |
|
19 | - $this->assertAttributeEquals('leads', 'table_name', $lead); |
|
16 | + $this->assertAttributeEquals('Leads', 'module_dir', $lead); |
|
17 | + $this->assertAttributeEquals('Lead', 'object_name', $lead); |
|
18 | + $this->assertAttributeEquals('Leads', 'object_names', $lead); |
|
19 | + $this->assertAttributeEquals('leads', 'table_name', $lead); |
|
20 | 20 | |
21 | - $this->assertAttributeEquals(true, 'new_schema', $lead); |
|
22 | - $this->assertAttributeEquals(true, 'importable', $lead); |
|
21 | + $this->assertAttributeEquals(true, 'new_schema', $lead); |
|
22 | + $this->assertAttributeEquals(true, 'importable', $lead); |
|
23 | 23 | |
24 | - } |
|
24 | + } |
|
25 | 25 | |
26 | - public function testget_account() |
|
27 | - { |
|
28 | - error_reporting(E_ERROR | E_PARSE); |
|
26 | + public function testget_account() |
|
27 | + { |
|
28 | + error_reporting(E_ERROR | E_PARSE); |
|
29 | 29 | |
30 | - $lead = new Lead(); |
|
30 | + $lead = new Lead(); |
|
31 | 31 | |
32 | - //test without pre settting attributes |
|
33 | - $result = $lead->get_account(); |
|
34 | - $this->assertEquals(null,$result); |
|
32 | + //test without pre settting attributes |
|
33 | + $result = $lead->get_account(); |
|
34 | + $this->assertEquals(null,$result); |
|
35 | 35 | |
36 | 36 | |
37 | - //test with required attributes preset |
|
38 | - $lead->account_id =1; |
|
39 | - $result = $lead->get_account(); |
|
40 | - $this->assertEquals(null,$result); |
|
37 | + //test with required attributes preset |
|
38 | + $lead->account_id =1; |
|
39 | + $result = $lead->get_account(); |
|
40 | + $this->assertEquals(null,$result); |
|
41 | 41 | |
42 | 42 | |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | - public function testget_opportunity() |
|
46 | - { |
|
45 | + public function testget_opportunity() |
|
46 | + { |
|
47 | 47 | |
48 | - $lead = new Lead(); |
|
48 | + $lead = new Lead(); |
|
49 | 49 | |
50 | - //test without pre settting attributes |
|
51 | - $result = $lead->get_opportunity(); |
|
52 | - $this->assertEquals(null,$result); |
|
50 | + //test without pre settting attributes |
|
51 | + $result = $lead->get_opportunity(); |
|
52 | + $this->assertEquals(null,$result); |
|
53 | 53 | |
54 | 54 | |
55 | - //test with required attributes preset |
|
56 | - $lead->opportunity_id =1; |
|
57 | - $result = $lead->get_opportunity(); |
|
58 | - $this->assertEquals(null,$result); |
|
55 | + //test with required attributes preset |
|
56 | + $lead->opportunity_id =1; |
|
57 | + $result = $lead->get_opportunity(); |
|
58 | + $this->assertEquals(null,$result); |
|
59 | 59 | |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | - public function testget_contact() |
|
63 | - { |
|
62 | + public function testget_contact() |
|
63 | + { |
|
64 | 64 | |
65 | - $lead = new Lead(); |
|
65 | + $lead = new Lead(); |
|
66 | 66 | |
67 | - //test without pre settting attributes |
|
68 | - $result = $lead->get_contact(); |
|
69 | - $this->assertEquals(null,$result); |
|
67 | + //test without pre settting attributes |
|
68 | + $result = $lead->get_contact(); |
|
69 | + $this->assertEquals(null,$result); |
|
70 | 70 | |
71 | 71 | |
72 | - //test with required attributes preset |
|
73 | - $lead->contact_id =1; |
|
74 | - $result = $lead->get_contact(); |
|
75 | - $this->assertEquals(null,$result); |
|
72 | + //test with required attributes preset |
|
73 | + $lead->contact_id =1; |
|
74 | + $result = $lead->get_contact(); |
|
75 | + $this->assertEquals(null,$result); |
|
76 | 76 | |
77 | 77 | |
78 | - } |
|
78 | + } |
|
79 | 79 | |
80 | - public function testcreate_list_query() |
|
81 | - { |
|
82 | - $lead = new Lead(); |
|
80 | + public function testcreate_list_query() |
|
81 | + { |
|
82 | + $lead = new Lead(); |
|
83 | 83 | |
84 | - //test with empty string params |
|
85 | - $expected = "SELECT leads.*, users.user_name assigned_user_name FROM leads LEFT JOIN users\n ON leads.assigned_user_id=users.id LEFT JOIN email_addr_bean_rel eabl ON eabl.bean_id = leads.id AND eabl.bean_module = 'Leads' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) where leads.deleted=0 "; |
|
86 | - $actual = $lead->create_list_query('',''); |
|
87 | - $this->assertSame($expected,$actual); |
|
84 | + //test with empty string params |
|
85 | + $expected = "SELECT leads.*, users.user_name assigned_user_name FROM leads LEFT JOIN users\n ON leads.assigned_user_id=users.id LEFT JOIN email_addr_bean_rel eabl ON eabl.bean_id = leads.id AND eabl.bean_module = 'Leads' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) where leads.deleted=0 "; |
|
86 | + $actual = $lead->create_list_query('',''); |
|
87 | + $this->assertSame($expected,$actual); |
|
88 | 88 | |
89 | 89 | |
90 | - //test with valid string params |
|
91 | - $expected = "SELECT leads.*, users.user_name assigned_user_name FROM leads LEFT JOIN users\n ON leads.assigned_user_id=users.id LEFT JOIN email_addr_bean_rel eabl ON eabl.bean_id = leads.id AND eabl.bean_module = 'Leads' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) where (users.user_name=\"\") AND leads.deleted=0 ORDER BY leads.id"; |
|
92 | - $actual = $lead->create_list_query('leads.id','users.user_name=""'); |
|
93 | - $this->assertSame($expected,$actual); |
|
90 | + //test with valid string params |
|
91 | + $expected = "SELECT leads.*, users.user_name assigned_user_name FROM leads LEFT JOIN users\n ON leads.assigned_user_id=users.id LEFT JOIN email_addr_bean_rel eabl ON eabl.bean_id = leads.id AND eabl.bean_module = 'Leads' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) where (users.user_name=\"\") AND leads.deleted=0 ORDER BY leads.id"; |
|
92 | + $actual = $lead->create_list_query('leads.id','users.user_name=""'); |
|
93 | + $this->assertSame($expected,$actual); |
|
94 | 94 | |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | - public function testcreate_new_list_query() |
|
98 | - { |
|
97 | + public function testcreate_new_list_query() |
|
98 | + { |
|
99 | 99 | |
100 | - $lead = new Lead(); |
|
100 | + $lead = new Lead(); |
|
101 | 101 | |
102 | - //test with empty string params |
|
103 | - $expected = " SELECT leads.* , ' ' c_accept_status_fields , ' ' call_id , ' ' e_invite_status_fields , ' ' fp_events_leads_1fp_events_ida , ' ' e_accept_status_fields , LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as name , jt3.user_name modified_by_name , jt3.created_by modified_by_name_owner , 'Users' modified_by_name_mod , jt4.user_name created_by_name , jt4.created_by created_by_name_owner , 'Users' created_by_name_mod , jt5.user_name assigned_user_name , jt5.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod, LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as full_name , jt6.name campaign_name , jt6.assigned_user_id campaign_name_owner , 'Campaigns' campaign_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM leads LEFT JOIN users jt3 ON leads.modified_user_id=jt3.id AND jt3.deleted=0\n\n AND jt3.deleted=0 LEFT JOIN users jt4 ON leads.created_by=jt4.id AND jt4.deleted=0\n\n AND jt4.deleted=0 LEFT JOIN users jt5 ON leads.assigned_user_id=jt5.id AND jt5.deleted=0\n\n AND jt5.deleted=0 LEFT JOIN campaigns jt6 ON leads.campaign_id=jt6.id AND jt6.deleted=0\n\n AND jt6.deleted=0 where leads.deleted=0"; |
|
104 | - $actual = $lead->create_new_list_query('',''); |
|
105 | - $this->assertSame($expected,$actual); |
|
102 | + //test with empty string params |
|
103 | + $expected = " SELECT leads.* , ' ' c_accept_status_fields , ' ' call_id , ' ' e_invite_status_fields , ' ' fp_events_leads_1fp_events_ida , ' ' e_accept_status_fields , LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as name , jt3.user_name modified_by_name , jt3.created_by modified_by_name_owner , 'Users' modified_by_name_mod , jt4.user_name created_by_name , jt4.created_by created_by_name_owner , 'Users' created_by_name_mod , jt5.user_name assigned_user_name , jt5.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod, LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as full_name , jt6.name campaign_name , jt6.assigned_user_id campaign_name_owner , 'Campaigns' campaign_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM leads LEFT JOIN users jt3 ON leads.modified_user_id=jt3.id AND jt3.deleted=0\n\n AND jt3.deleted=0 LEFT JOIN users jt4 ON leads.created_by=jt4.id AND jt4.deleted=0\n\n AND jt4.deleted=0 LEFT JOIN users jt5 ON leads.assigned_user_id=jt5.id AND jt5.deleted=0\n\n AND jt5.deleted=0 LEFT JOIN campaigns jt6 ON leads.campaign_id=jt6.id AND jt6.deleted=0\n\n AND jt6.deleted=0 where leads.deleted=0"; |
|
104 | + $actual = $lead->create_new_list_query('',''); |
|
105 | + $this->assertSame($expected,$actual); |
|
106 | 106 | |
107 | 107 | |
108 | - //test with valid string params |
|
109 | - $expected = " SELECT leads.* , ' ' c_accept_status_fields , ' ' call_id , ' ' e_invite_status_fields , ' ' fp_events_leads_1fp_events_ida , ' ' e_accept_status_fields , LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as name , jt3.user_name modified_by_name , jt3.created_by modified_by_name_owner , 'Users' modified_by_name_mod , jt4.user_name created_by_name , jt4.created_by created_by_name_owner , 'Users' created_by_name_mod , jt5.user_name assigned_user_name , jt5.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod, LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as full_name , jt6.name campaign_name , jt6.assigned_user_id campaign_name_owner , 'Campaigns' campaign_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM leads LEFT JOIN users jt3 ON leads.modified_user_id=jt3.id AND jt3.deleted=0\n\n AND jt3.deleted=0 LEFT JOIN users jt4 ON leads.created_by=jt4.id AND jt4.deleted=0\n\n AND jt4.deleted=0 LEFT JOIN users jt5 ON leads.assigned_user_id=jt5.id AND jt5.deleted=0\n\n AND jt5.deleted=0 LEFT JOIN campaigns jt6 ON leads.campaign_id=jt6.id AND jt6.deleted=0\n\n AND jt6.deleted=0 where (users.user_name=\"\") AND leads.deleted=0"; |
|
110 | - $actual = $lead->create_new_list_query('leads.id','users.user_name=""'); |
|
111 | - $this->assertSame($expected,$actual); |
|
108 | + //test with valid string params |
|
109 | + $expected = " SELECT leads.* , ' ' c_accept_status_fields , ' ' call_id , ' ' e_invite_status_fields , ' ' fp_events_leads_1fp_events_ida , ' ' e_accept_status_fields , LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as name , jt3.user_name modified_by_name , jt3.created_by modified_by_name_owner , 'Users' modified_by_name_mod , jt4.user_name created_by_name , jt4.created_by created_by_name_owner , 'Users' created_by_name_mod , jt5.user_name assigned_user_name , jt5.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod, LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as full_name , jt6.name campaign_name , jt6.assigned_user_id campaign_name_owner , 'Campaigns' campaign_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM leads LEFT JOIN users jt3 ON leads.modified_user_id=jt3.id AND jt3.deleted=0\n\n AND jt3.deleted=0 LEFT JOIN users jt4 ON leads.created_by=jt4.id AND jt4.deleted=0\n\n AND jt4.deleted=0 LEFT JOIN users jt5 ON leads.assigned_user_id=jt5.id AND jt5.deleted=0\n\n AND jt5.deleted=0 LEFT JOIN campaigns jt6 ON leads.campaign_id=jt6.id AND jt6.deleted=0\n\n AND jt6.deleted=0 where (users.user_name=\"\") AND leads.deleted=0"; |
|
110 | + $actual = $lead->create_new_list_query('leads.id','users.user_name=""'); |
|
111 | + $this->assertSame($expected,$actual); |
|
112 | 112 | |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | 115 | public function testSaveAndConverted_lead() |
116 | 116 | { |
117 | - $lead = new Lead(); |
|
117 | + $lead = new Lead(); |
|
118 | 118 | |
119 | - $lead->first_name = "firstn"; |
|
120 | - $lead->last_name ="lastnn"; |
|
121 | - $lead->lead_source = "test"; |
|
119 | + $lead->first_name = "firstn"; |
|
120 | + $lead->last_name ="lastnn"; |
|
121 | + $lead->lead_source = "test"; |
|
122 | 122 | |
123 | - $result = $lead->save(); |
|
123 | + $result = $lead->save(); |
|
124 | 124 | |
125 | - //test for record ID to verify that record is saved |
|
126 | - $this->assertTrue(isset($lead->id)); |
|
127 | - $this->assertEquals(36, strlen($lead->id)); |
|
128 | - $this->assertEquals("New", $lead->status); |
|
125 | + //test for record ID to verify that record is saved |
|
126 | + $this->assertTrue(isset($lead->id)); |
|
127 | + $this->assertEquals(36, strlen($lead->id)); |
|
128 | + $this->assertEquals("New", $lead->status); |
|
129 | 129 | |
130 | 130 | |
131 | - //test converted_lead method after saving |
|
132 | - /*$lead->converted_lead("'" . $lead->id . "'" , "'1'", "'1'", "'1'"); |
|
131 | + //test converted_lead method after saving |
|
132 | + /*$lead->converted_lead("'" . $lead->id . "'" , "'1'", "'1'", "'1'"); |
|
133 | 133 | |
134 | 134 | //retrieve back to test if attributes are updated in db |
135 | 135 | $lead = $lead->retrieve($lead->id); |
@@ -140,244 +140,244 @@ discard block |
||
140 | 140 | $this->assertEquals("1", $lead->opportunity_id); |
141 | 141 | */ |
142 | 142 | |
143 | - $this->markTestSkipped("converted_lead: Error in query, id's not properly escaped "); |
|
143 | + $this->markTestSkipped("converted_lead: Error in query, id's not properly escaped "); |
|
144 | 144 | |
145 | 145 | |
146 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
147 | - $lead->mark_deleted($lead->id); |
|
148 | - $result = $lead->retrieve($lead->id); |
|
149 | - $this->assertEquals(null,$result); |
|
146 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
147 | + $lead->mark_deleted($lead->id); |
|
148 | + $result = $lead->retrieve($lead->id); |
|
149 | + $this->assertEquals(null,$result); |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | 154 | |
155 | - public function testfill_in_additional_list_fields() |
|
156 | - { |
|
157 | - $lead = new Lead(); |
|
155 | + public function testfill_in_additional_list_fields() |
|
156 | + { |
|
157 | + $lead = new Lead(); |
|
158 | 158 | |
159 | - $lead->first_name = "firstn"; |
|
160 | - $lead->last_name ="lastn"; |
|
159 | + $lead->first_name = "firstn"; |
|
160 | + $lead->last_name ="lastn"; |
|
161 | 161 | |
162 | - $lead->fill_in_additional_list_fields(); |
|
162 | + $lead->fill_in_additional_list_fields(); |
|
163 | 163 | |
164 | - $this->assertEquals("firstn lastn", $lead->name ); |
|
164 | + $this->assertEquals("firstn lastn", $lead->name ); |
|
165 | 165 | |
166 | - } |
|
166 | + } |
|
167 | 167 | |
168 | 168 | |
169 | - public function testfill_in_additional_detail_fields() |
|
170 | - { |
|
169 | + public function testfill_in_additional_detail_fields() |
|
170 | + { |
|
171 | 171 | |
172 | - $lead = new Lead(); |
|
172 | + $lead = new Lead(); |
|
173 | 173 | |
174 | - $lead->first_name = "firstn"; |
|
175 | - $lead->last_name ="lastn"; |
|
174 | + $lead->first_name = "firstn"; |
|
175 | + $lead->last_name ="lastn"; |
|
176 | 176 | |
177 | - $lead->fill_in_additional_detail_fields(); |
|
177 | + $lead->fill_in_additional_detail_fields(); |
|
178 | 178 | |
179 | - $this->assertEquals("firstn lastn", $lead->name ); |
|
179 | + $this->assertEquals("firstn lastn", $lead->name ); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | |
183 | - } |
|
183 | + } |
|
184 | 184 | |
185 | - public function testget_list_view_data(){ |
|
185 | + public function testget_list_view_data(){ |
|
186 | 186 | |
187 | - $lead = new Lead(); |
|
187 | + $lead = new Lead(); |
|
188 | 188 | |
189 | - $expected = array ( |
|
190 | - 'NAME' => ' ', |
|
191 | - 'DELETED' => 0, |
|
192 | - 'FULL_NAME' => ' ', |
|
193 | - 'DO_NOT_CALL' => '0', |
|
194 | - 'CONVERTED' => '0', |
|
195 | - 'ENCODED_NAME' => ' ', |
|
196 | - 'EMAIL1' => '', |
|
197 | - 'EMAIL1_LINK' => '<a href=\'javascript:void(0);\' onclick=\'SUGAR.quickCompose.init({"fullComposeUrl":"contact_id=\\u0026parent_type=Leads\\u0026parent_id=\\u0026parent_name=+\\u0026to_addrs_ids=\\u0026to_addrs_names=\\u0026to_addrs_emails=\\u0026to_email_addrs=+%26nbsp%3B%26lt%3B%26gt%3B\\u0026return_module=Leads\\u0026return_action=ListView\\u0026return_id=","composePackage":{"contact_id":"","parent_type":"Leads","parent_id":"","parent_name":" ","to_addrs_ids":"","to_addrs_names":"","to_addrs_emails":"","to_email_addrs":" \\u003C\\u003E","return_module":"Leads","return_action":"ListView","return_id":""}});\' class=\'\'>', |
|
198 | - 'ACC_NAME_FROM_ACCOUNTS' => NULL, |
|
199 | - ); |
|
189 | + $expected = array ( |
|
190 | + 'NAME' => ' ', |
|
191 | + 'DELETED' => 0, |
|
192 | + 'FULL_NAME' => ' ', |
|
193 | + 'DO_NOT_CALL' => '0', |
|
194 | + 'CONVERTED' => '0', |
|
195 | + 'ENCODED_NAME' => ' ', |
|
196 | + 'EMAIL1' => '', |
|
197 | + 'EMAIL1_LINK' => '<a href=\'javascript:void(0);\' onclick=\'SUGAR.quickCompose.init({"fullComposeUrl":"contact_id=\\u0026parent_type=Leads\\u0026parent_id=\\u0026parent_name=+\\u0026to_addrs_ids=\\u0026to_addrs_names=\\u0026to_addrs_emails=\\u0026to_email_addrs=+%26nbsp%3B%26lt%3B%26gt%3B\\u0026return_module=Leads\\u0026return_action=ListView\\u0026return_id=","composePackage":{"contact_id":"","parent_type":"Leads","parent_id":"","parent_name":" ","to_addrs_ids":"","to_addrs_names":"","to_addrs_emails":"","to_email_addrs":" \\u003C\\u003E","return_module":"Leads","return_action":"ListView","return_id":""}});\' class=\'\'>', |
|
198 | + 'ACC_NAME_FROM_ACCOUNTS' => NULL, |
|
199 | + ); |
|
200 | 200 | |
201 | - $actual = $lead->get_list_view_data(); |
|
201 | + $actual = $lead->get_list_view_data(); |
|
202 | 202 | |
203 | - //$this->assertSame($expected, $actual); |
|
204 | - $this->assertEquals($expected['NAME'], $actual['NAME']); |
|
205 | - $this->assertEquals($expected['DELETED'], $actual['DELETED']); |
|
206 | - $this->assertEquals($expected['FULL_NAME'], $actual['FULL_NAME']); |
|
207 | - $this->assertEquals($expected['DO_NOT_CALL'], $actual['DO_NOT_CALL']); |
|
208 | - $this->assertEquals($expected['EMAIL1_LINK'], $actual['EMAIL1_LINK']); |
|
209 | - |
|
210 | - } |
|
203 | + //$this->assertSame($expected, $actual); |
|
204 | + $this->assertEquals($expected['NAME'], $actual['NAME']); |
|
205 | + $this->assertEquals($expected['DELETED'], $actual['DELETED']); |
|
206 | + $this->assertEquals($expected['FULL_NAME'], $actual['FULL_NAME']); |
|
207 | + $this->assertEquals($expected['DO_NOT_CALL'], $actual['DO_NOT_CALL']); |
|
208 | + $this->assertEquals($expected['EMAIL1_LINK'], $actual['EMAIL1_LINK']); |
|
209 | + |
|
210 | + } |
|
211 | 211 | |
212 | 212 | |
213 | 213 | public function testget_linked_fields() |
214 | 214 | { |
215 | - $lead = new Lead(); |
|
216 | - |
|
217 | - $expected = array ( |
|
218 | - 'created_by_link', |
|
219 | - 'modified_user_link', |
|
220 | - 'assigned_user_link', |
|
221 | - 'email_addresses_primary', |
|
222 | - 'email_addresses', |
|
223 | - 'reports_to_link', |
|
224 | - 'reportees', |
|
225 | - 'contacts', |
|
226 | - 'accounts', |
|
227 | - 'contact', |
|
228 | - 'opportunity', |
|
229 | - 'campaign_leads', |
|
230 | - 'tasks', |
|
231 | - 'notes', |
|
232 | - 'meetings', |
|
233 | - 'calls', |
|
234 | - 'emails', |
|
235 | - 'campaigns', |
|
236 | - 'prospect_lists', |
|
237 | - 'fp_events_leads_1', |
|
238 | - 'SecurityGroups', |
|
239 | - ); |
|
240 | - $actual = $lead->get_linked_fields(); |
|
241 | - $this->assertTrue(is_array($actual)); |
|
215 | + $lead = new Lead(); |
|
216 | + |
|
217 | + $expected = array ( |
|
218 | + 'created_by_link', |
|
219 | + 'modified_user_link', |
|
220 | + 'assigned_user_link', |
|
221 | + 'email_addresses_primary', |
|
222 | + 'email_addresses', |
|
223 | + 'reports_to_link', |
|
224 | + 'reportees', |
|
225 | + 'contacts', |
|
226 | + 'accounts', |
|
227 | + 'contact', |
|
228 | + 'opportunity', |
|
229 | + 'campaign_leads', |
|
230 | + 'tasks', |
|
231 | + 'notes', |
|
232 | + 'meetings', |
|
233 | + 'calls', |
|
234 | + 'emails', |
|
235 | + 'campaigns', |
|
236 | + 'prospect_lists', |
|
237 | + 'fp_events_leads_1', |
|
238 | + 'SecurityGroups', |
|
239 | + ); |
|
240 | + $actual = $lead->get_linked_fields(); |
|
241 | + $this->assertTrue(is_array($actual)); |
|
242 | 242 | sort($expected); |
243 | 243 | $actualKeys = array_keys($actual); |
244 | 244 | sort($actualKeys); |
245 | - $this->assertSame($expected ,$actualKeys); |
|
245 | + $this->assertSame($expected ,$actualKeys); |
|
246 | 246 | |
247 | 247 | } |
248 | 248 | |
249 | - public function testbuild_generic_where_clause () |
|
250 | - { |
|
249 | + public function testbuild_generic_where_clause () |
|
250 | + { |
|
251 | 251 | |
252 | - $lead = new Lead(); |
|
252 | + $lead = new Lead(); |
|
253 | 253 | |
254 | - //test with empty string params |
|
255 | - $expected = "leads.last_name like '%' or leads.account_name like '%' or leads.first_name like '%' or ea.email_address like '%'"; |
|
256 | - $actual = $lead->build_generic_where_clause(""); |
|
257 | - $this->assertSame($expected,$actual); |
|
254 | + //test with empty string params |
|
255 | + $expected = "leads.last_name like '%' or leads.account_name like '%' or leads.first_name like '%' or ea.email_address like '%'"; |
|
256 | + $actual = $lead->build_generic_where_clause(""); |
|
257 | + $this->assertSame($expected,$actual); |
|
258 | 258 | |
259 | 259 | |
260 | - //test with valid string params |
|
261 | - $expected = "leads.last_name like '%' or leads.account_name like '%' or leads.first_name like '%' or ea.email_address like '%'"; |
|
262 | - $actual = $lead->build_generic_where_clause("123"); |
|
263 | - $this->assertSame($expected,$actual); |
|
260 | + //test with valid string params |
|
261 | + $expected = "leads.last_name like '%' or leads.account_name like '%' or leads.first_name like '%' or ea.email_address like '%'"; |
|
262 | + $actual = $lead->build_generic_where_clause("123"); |
|
263 | + $this->assertSame($expected,$actual); |
|
264 | 264 | |
265 | - } |
|
265 | + } |
|
266 | 266 | |
267 | - public function testset_notification_body() |
|
268 | - { |
|
267 | + public function testset_notification_body() |
|
268 | + { |
|
269 | 269 | |
270 | - $lead = new Lead(); |
|
270 | + $lead = new Lead(); |
|
271 | 271 | |
272 | - //test with attributes preset and verify template variables are set accordingly |
|
272 | + //test with attributes preset and verify template variables are set accordingly |
|
273 | 273 | |
274 | - $lead->first_name = "firstn"; |
|
275 | - $lead->last_name ="lastn"; |
|
276 | - $lead->salutation = "Mr"; |
|
277 | - $lead->lead_source = "Email"; |
|
278 | - $lead->status = "New"; |
|
279 | - $lead->description = "tes description"; |
|
274 | + $lead->first_name = "firstn"; |
|
275 | + $lead->last_name ="lastn"; |
|
276 | + $lead->salutation = "Mr"; |
|
277 | + $lead->lead_source = "Email"; |
|
278 | + $lead->status = "New"; |
|
279 | + $lead->description = "tes description"; |
|
280 | 280 | |
281 | - $result = $lead->set_notification_body(new Sugar_Smarty(), $lead); |
|
281 | + $result = $lead->set_notification_body(new Sugar_Smarty(), $lead); |
|
282 | 282 | |
283 | - $this->assertEquals("Mr firstn lastn" ,$result->_tpl_vars['LEAD_NAME']); |
|
284 | - $this->assertEquals($lead->lead_source ,$result->_tpl_vars['LEAD_SOURCE']); |
|
285 | - $this->assertEquals($lead->status ,$result->_tpl_vars['LEAD_STATUS']); |
|
286 | - $this->assertEquals($lead->description ,$result->_tpl_vars['LEAD_DESCRIPTION']); |
|
283 | + $this->assertEquals("Mr firstn lastn" ,$result->_tpl_vars['LEAD_NAME']); |
|
284 | + $this->assertEquals($lead->lead_source ,$result->_tpl_vars['LEAD_SOURCE']); |
|
285 | + $this->assertEquals($lead->status ,$result->_tpl_vars['LEAD_STATUS']); |
|
286 | + $this->assertEquals($lead->description ,$result->_tpl_vars['LEAD_DESCRIPTION']); |
|
287 | 287 | |
288 | - } |
|
288 | + } |
|
289 | 289 | |
290 | - public function testbean_implements() |
|
291 | - { |
|
292 | - $lead = new Lead(); |
|
290 | + public function testbean_implements() |
|
291 | + { |
|
292 | + $lead = new Lead(); |
|
293 | 293 | |
294 | - $this->assertEquals(false, $lead->bean_implements('')); //test with blank value |
|
295 | - $this->assertEquals(false, $lead->bean_implements('test')); //test with invalid value |
|
296 | - $this->assertEquals(true, $lead->bean_implements('ACL')); //test with valid value |
|
294 | + $this->assertEquals(false, $lead->bean_implements('')); //test with blank value |
|
295 | + $this->assertEquals(false, $lead->bean_implements('test')); //test with invalid value |
|
296 | + $this->assertEquals(true, $lead->bean_implements('ACL')); //test with valid value |
|
297 | 297 | |
298 | - } |
|
298 | + } |
|
299 | 299 | |
300 | - public function testlistviewACLHelper() |
|
301 | - { |
|
302 | - $lead = new Lead(); |
|
300 | + public function testlistviewACLHelper() |
|
301 | + { |
|
302 | + $lead = new Lead(); |
|
303 | 303 | |
304 | - $expected = array("MAIN"=>"a", "ACCOUNT"=>"a", "OPPORTUNITY"=>"a", "CONTACT"=>"a" ); |
|
305 | - $actual = $lead->listviewACLHelper(); |
|
306 | - $this->assertSame($expected,$actual); |
|
304 | + $expected = array("MAIN"=>"a", "ACCOUNT"=>"a", "OPPORTUNITY"=>"a", "CONTACT"=>"a" ); |
|
305 | + $actual = $lead->listviewACLHelper(); |
|
306 | + $this->assertSame($expected,$actual); |
|
307 | 307 | |
308 | - } |
|
308 | + } |
|
309 | 309 | |
310 | 310 | |
311 | - public function testconvertCustomFieldsForm() |
|
312 | - { |
|
313 | - $lead = new Lead(); |
|
311 | + public function testconvertCustomFieldsForm() |
|
312 | + { |
|
313 | + $lead = new Lead(); |
|
314 | 314 | |
315 | - $form = ""; |
|
316 | - $prefix = ""; |
|
317 | - $tempBean = new Contact(); |
|
315 | + $form = ""; |
|
316 | + $prefix = ""; |
|
317 | + $tempBean = new Contact(); |
|
318 | 318 | |
319 | - $result = $lead->convertCustomFieldsForm($form, $tempBean, $prefix); |
|
319 | + $result = $lead->convertCustomFieldsForm($form, $tempBean, $prefix); |
|
320 | 320 | |
321 | - $this->assertEquals(true,$result); |
|
322 | - $this->assertgreaterThanOrEqual("", $form); //no filed with source = custom_fields |
|
321 | + $this->assertEquals(true,$result); |
|
322 | + $this->assertgreaterThanOrEqual("", $form); //no filed with source = custom_fields |
|
323 | 323 | |
324 | - } |
|
324 | + } |
|
325 | 325 | |
326 | 326 | |
327 | - public function testget_unlinked_email_query() |
|
328 | - { |
|
329 | - $lead = new Lead(); |
|
327 | + public function testget_unlinked_email_query() |
|
328 | + { |
|
329 | + $lead = new Lead(); |
|
330 | 330 | |
331 | - $expected = "SELECT emails.id FROM emails JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Leads' and\n eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n where eear.deleted=0 and eear.email_id not in\n (select eb.email_id from emails_beans eb where eb.bean_module ='Leads' and eb.bean_id = '')\n ) derivedemails on derivedemails.email_id = emails.id"; |
|
332 | - $actual = $lead->get_unlinked_email_query(); |
|
333 | - $this->assertSame($expected,$actual); |
|
331 | + $expected = "SELECT emails.id FROM emails JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Leads' and\n eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n where eear.deleted=0 and eear.email_id not in\n (select eb.email_id from emails_beans eb where eb.bean_module ='Leads' and eb.bean_id = '')\n ) derivedemails on derivedemails.email_id = emails.id"; |
|
332 | + $actual = $lead->get_unlinked_email_query(); |
|
333 | + $this->assertSame($expected,$actual); |
|
334 | 334 | |
335 | - } |
|
335 | + } |
|
336 | 336 | |
337 | 337 | |
338 | 338 | public function testget_old_related_calls() |
339 | 339 | { |
340 | - $lead = new Lead(); |
|
340 | + $lead = new Lead(); |
|
341 | 341 | |
342 | - $expected = array ( |
|
343 | - "select" => "SELECT calls.id ", |
|
344 | - "from" => "FROM calls ", |
|
345 | - "where" => " WHERE calls.parent_id = '' \n AND calls.parent_type = 'Leads' AND calls.id NOT IN ( SELECT call_id FROM calls_leads ) ", |
|
346 | - "join" => "", |
|
347 | - "join_tables" => array (""), |
|
348 | - ); |
|
342 | + $expected = array ( |
|
343 | + "select" => "SELECT calls.id ", |
|
344 | + "from" => "FROM calls ", |
|
345 | + "where" => " WHERE calls.parent_id = '' \n AND calls.parent_type = 'Leads' AND calls.id NOT IN ( SELECT call_id FROM calls_leads ) ", |
|
346 | + "join" => "", |
|
347 | + "join_tables" => array (""), |
|
348 | + ); |
|
349 | 349 | |
350 | - $actual = $lead->get_old_related_calls(); |
|
351 | - $this->assertSame($expected,$actual); |
|
350 | + $actual = $lead->get_old_related_calls(); |
|
351 | + $this->assertSame($expected,$actual); |
|
352 | 352 | |
353 | 353 | } |
354 | 354 | |
355 | 355 | |
356 | 356 | public function testgetActivitiesOptions() |
357 | - { |
|
358 | - $lead = new Lead(); |
|
357 | + { |
|
358 | + $lead = new Lead(); |
|
359 | 359 | |
360 | - $expected = array( "copy"=>"Copy", "move"=>"Move", "donothing"=>"Do Nothing"); |
|
361 | - $actual = $lead->getActivitiesOptions(); |
|
362 | - $this->assertSame($expected,$actual); |
|
360 | + $expected = array( "copy"=>"Copy", "move"=>"Move", "donothing"=>"Do Nothing"); |
|
361 | + $actual = $lead->getActivitiesOptions(); |
|
362 | + $this->assertSame($expected,$actual); |
|
363 | 363 | |
364 | 364 | } |
365 | 365 | |
366 | 366 | |
367 | 367 | public function testget_old_related_meetings() |
368 | 368 | { |
369 | - $lead = new Lead(); |
|
370 | - |
|
371 | - $expected = array ( |
|
372 | - "select" => "SELECT meetings.id ", |
|
373 | - "from" => "FROM meetings ", |
|
374 | - "where" => " WHERE meetings.parent_id = '' \n AND meetings.parent_type = 'Leads' AND meetings.id NOT IN ( SELECT meeting_id FROM meetings_leads ) ", |
|
375 | - "join" => "", |
|
376 | - "join_tables" => array (""), |
|
377 | - ); |
|
369 | + $lead = new Lead(); |
|
370 | + |
|
371 | + $expected = array ( |
|
372 | + "select" => "SELECT meetings.id ", |
|
373 | + "from" => "FROM meetings ", |
|
374 | + "where" => " WHERE meetings.parent_id = '' \n AND meetings.parent_type = 'Leads' AND meetings.id NOT IN ( SELECT meeting_id FROM meetings_leads ) ", |
|
375 | + "join" => "", |
|
376 | + "join_tables" => array (""), |
|
377 | + ); |
|
378 | 378 | |
379 | - $actual = $lead->get_old_related_meetings(); |
|
380 | - $this->assertSame($expected,$actual); |
|
379 | + $actual = $lead->get_old_related_meetings(); |
|
380 | + $this->assertSame($expected,$actual); |
|
381 | 381 | |
382 | 382 | } |
383 | 383 |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | //execute the contructor and check for the Object type and attributes |
10 | 10 | $lead = new Lead(); |
11 | 11 | |
12 | - $this->assertInstanceOf('Lead',$lead); |
|
13 | - $this->assertInstanceOf('Person',$lead); |
|
14 | - $this->assertInstanceOf('SugarBean',$lead); |
|
12 | + $this->assertInstanceOf('Lead', $lead); |
|
13 | + $this->assertInstanceOf('Person', $lead); |
|
14 | + $this->assertInstanceOf('SugarBean', $lead); |
|
15 | 15 | |
16 | 16 | $this->assertAttributeEquals('Leads', 'module_dir', $lead); |
17 | 17 | $this->assertAttributeEquals('Lead', 'object_name', $lead); |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | |
32 | 32 | //test without pre settting attributes |
33 | 33 | $result = $lead->get_account(); |
34 | - $this->assertEquals(null,$result); |
|
34 | + $this->assertEquals(null, $result); |
|
35 | 35 | |
36 | 36 | |
37 | 37 | //test with required attributes preset |
38 | - $lead->account_id =1; |
|
38 | + $lead->account_id = 1; |
|
39 | 39 | $result = $lead->get_account(); |
40 | - $this->assertEquals(null,$result); |
|
40 | + $this->assertEquals(null, $result); |
|
41 | 41 | |
42 | 42 | |
43 | 43 | } |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | |
50 | 50 | //test without pre settting attributes |
51 | 51 | $result = $lead->get_opportunity(); |
52 | - $this->assertEquals(null,$result); |
|
52 | + $this->assertEquals(null, $result); |
|
53 | 53 | |
54 | 54 | |
55 | 55 | //test with required attributes preset |
56 | - $lead->opportunity_id =1; |
|
56 | + $lead->opportunity_id = 1; |
|
57 | 57 | $result = $lead->get_opportunity(); |
58 | - $this->assertEquals(null,$result); |
|
58 | + $this->assertEquals(null, $result); |
|
59 | 59 | |
60 | 60 | } |
61 | 61 | |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | |
67 | 67 | //test without pre settting attributes |
68 | 68 | $result = $lead->get_contact(); |
69 | - $this->assertEquals(null,$result); |
|
69 | + $this->assertEquals(null, $result); |
|
70 | 70 | |
71 | 71 | |
72 | 72 | //test with required attributes preset |
73 | - $lead->contact_id =1; |
|
73 | + $lead->contact_id = 1; |
|
74 | 74 | $result = $lead->get_contact(); |
75 | - $this->assertEquals(null,$result); |
|
75 | + $this->assertEquals(null, $result); |
|
76 | 76 | |
77 | 77 | |
78 | 78 | } |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | |
84 | 84 | //test with empty string params |
85 | 85 | $expected = "SELECT leads.*, users.user_name assigned_user_name FROM leads LEFT JOIN users\n ON leads.assigned_user_id=users.id LEFT JOIN email_addr_bean_rel eabl ON eabl.bean_id = leads.id AND eabl.bean_module = 'Leads' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) where leads.deleted=0 "; |
86 | - $actual = $lead->create_list_query('',''); |
|
87 | - $this->assertSame($expected,$actual); |
|
86 | + $actual = $lead->create_list_query('', ''); |
|
87 | + $this->assertSame($expected, $actual); |
|
88 | 88 | |
89 | 89 | |
90 | 90 | //test with valid string params |
91 | 91 | $expected = "SELECT leads.*, users.user_name assigned_user_name FROM leads LEFT JOIN users\n ON leads.assigned_user_id=users.id LEFT JOIN email_addr_bean_rel eabl ON eabl.bean_id = leads.id AND eabl.bean_module = 'Leads' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) where (users.user_name=\"\") AND leads.deleted=0 ORDER BY leads.id"; |
92 | - $actual = $lead->create_list_query('leads.id','users.user_name=""'); |
|
93 | - $this->assertSame($expected,$actual); |
|
92 | + $actual = $lead->create_list_query('leads.id', 'users.user_name=""'); |
|
93 | + $this->assertSame($expected, $actual); |
|
94 | 94 | |
95 | 95 | } |
96 | 96 | |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | |
102 | 102 | //test with empty string params |
103 | 103 | $expected = " SELECT leads.* , ' ' c_accept_status_fields , ' ' call_id , ' ' e_invite_status_fields , ' ' fp_events_leads_1fp_events_ida , ' ' e_accept_status_fields , LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as name , jt3.user_name modified_by_name , jt3.created_by modified_by_name_owner , 'Users' modified_by_name_mod , jt4.user_name created_by_name , jt4.created_by created_by_name_owner , 'Users' created_by_name_mod , jt5.user_name assigned_user_name , jt5.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod, LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as full_name , jt6.name campaign_name , jt6.assigned_user_id campaign_name_owner , 'Campaigns' campaign_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM leads LEFT JOIN users jt3 ON leads.modified_user_id=jt3.id AND jt3.deleted=0\n\n AND jt3.deleted=0 LEFT JOIN users jt4 ON leads.created_by=jt4.id AND jt4.deleted=0\n\n AND jt4.deleted=0 LEFT JOIN users jt5 ON leads.assigned_user_id=jt5.id AND jt5.deleted=0\n\n AND jt5.deleted=0 LEFT JOIN campaigns jt6 ON leads.campaign_id=jt6.id AND jt6.deleted=0\n\n AND jt6.deleted=0 where leads.deleted=0"; |
104 | - $actual = $lead->create_new_list_query('',''); |
|
105 | - $this->assertSame($expected,$actual); |
|
104 | + $actual = $lead->create_new_list_query('', ''); |
|
105 | + $this->assertSame($expected, $actual); |
|
106 | 106 | |
107 | 107 | |
108 | 108 | //test with valid string params |
109 | 109 | $expected = " SELECT leads.* , ' ' c_accept_status_fields , ' ' call_id , ' ' e_invite_status_fields , ' ' fp_events_leads_1fp_events_ida , ' ' e_accept_status_fields , LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as name , jt3.user_name modified_by_name , jt3.created_by modified_by_name_owner , 'Users' modified_by_name_mod , jt4.user_name created_by_name , jt4.created_by created_by_name_owner , 'Users' created_by_name_mod , jt5.user_name assigned_user_name , jt5.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod, LTRIM(RTRIM(CONCAT(IFNULL(leads.first_name,''),' ',IFNULL(leads.last_name,'')))) as full_name , jt6.name campaign_name , jt6.assigned_user_id campaign_name_owner , 'Campaigns' campaign_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM leads LEFT JOIN users jt3 ON leads.modified_user_id=jt3.id AND jt3.deleted=0\n\n AND jt3.deleted=0 LEFT JOIN users jt4 ON leads.created_by=jt4.id AND jt4.deleted=0\n\n AND jt4.deleted=0 LEFT JOIN users jt5 ON leads.assigned_user_id=jt5.id AND jt5.deleted=0\n\n AND jt5.deleted=0 LEFT JOIN campaigns jt6 ON leads.campaign_id=jt6.id AND jt6.deleted=0\n\n AND jt6.deleted=0 where (users.user_name=\"\") AND leads.deleted=0"; |
110 | - $actual = $lead->create_new_list_query('leads.id','users.user_name=""'); |
|
111 | - $this->assertSame($expected,$actual); |
|
110 | + $actual = $lead->create_new_list_query('leads.id', 'users.user_name=""'); |
|
111 | + $this->assertSame($expected, $actual); |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $lead = new Lead(); |
118 | 118 | |
119 | 119 | $lead->first_name = "firstn"; |
120 | - $lead->last_name ="lastnn"; |
|
120 | + $lead->last_name = "lastnn"; |
|
121 | 121 | $lead->lead_source = "test"; |
122 | 122 | |
123 | 123 | $result = $lead->save(); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | //mark the record as deleted and verify that this record cannot be retrieved anymore. |
147 | 147 | $lead->mark_deleted($lead->id); |
148 | 148 | $result = $lead->retrieve($lead->id); |
149 | - $this->assertEquals(null,$result); |
|
149 | + $this->assertEquals(null, $result); |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | $lead = new Lead(); |
158 | 158 | |
159 | 159 | $lead->first_name = "firstn"; |
160 | - $lead->last_name ="lastn"; |
|
160 | + $lead->last_name = "lastn"; |
|
161 | 161 | |
162 | 162 | $lead->fill_in_additional_list_fields(); |
163 | 163 | |
164 | - $this->assertEquals("firstn lastn", $lead->name ); |
|
164 | + $this->assertEquals("firstn lastn", $lead->name); |
|
165 | 165 | |
166 | 166 | } |
167 | 167 | |
@@ -172,21 +172,21 @@ discard block |
||
172 | 172 | $lead = new Lead(); |
173 | 173 | |
174 | 174 | $lead->first_name = "firstn"; |
175 | - $lead->last_name ="lastn"; |
|
175 | + $lead->last_name = "lastn"; |
|
176 | 176 | |
177 | 177 | $lead->fill_in_additional_detail_fields(); |
178 | 178 | |
179 | - $this->assertEquals("firstn lastn", $lead->name ); |
|
179 | + $this->assertEquals("firstn lastn", $lead->name); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | |
183 | 183 | } |
184 | 184 | |
185 | - public function testget_list_view_data(){ |
|
185 | + public function testget_list_view_data() { |
|
186 | 186 | |
187 | 187 | $lead = new Lead(); |
188 | 188 | |
189 | - $expected = array ( |
|
189 | + $expected = array( |
|
190 | 190 | 'NAME' => ' ', |
191 | 191 | 'DELETED' => 0, |
192 | 192 | 'FULL_NAME' => ' ', |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | { |
215 | 215 | $lead = new Lead(); |
216 | 216 | |
217 | - $expected = array ( |
|
217 | + $expected = array( |
|
218 | 218 | 'created_by_link', |
219 | 219 | 'modified_user_link', |
220 | 220 | 'assigned_user_link', |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | sort($expected); |
243 | 243 | $actualKeys = array_keys($actual); |
244 | 244 | sort($actualKeys); |
245 | - $this->assertSame($expected ,$actualKeys); |
|
245 | + $this->assertSame($expected, $actualKeys); |
|
246 | 246 | |
247 | 247 | } |
248 | 248 | |
249 | - public function testbuild_generic_where_clause () |
|
249 | + public function testbuild_generic_where_clause() |
|
250 | 250 | { |
251 | 251 | |
252 | 252 | $lead = new Lead(); |
@@ -254,13 +254,13 @@ discard block |
||
254 | 254 | //test with empty string params |
255 | 255 | $expected = "leads.last_name like '%' or leads.account_name like '%' or leads.first_name like '%' or ea.email_address like '%'"; |
256 | 256 | $actual = $lead->build_generic_where_clause(""); |
257 | - $this->assertSame($expected,$actual); |
|
257 | + $this->assertSame($expected, $actual); |
|
258 | 258 | |
259 | 259 | |
260 | 260 | //test with valid string params |
261 | 261 | $expected = "leads.last_name like '%' or leads.account_name like '%' or leads.first_name like '%' or ea.email_address like '%'"; |
262 | 262 | $actual = $lead->build_generic_where_clause("123"); |
263 | - $this->assertSame($expected,$actual); |
|
263 | + $this->assertSame($expected, $actual); |
|
264 | 264 | |
265 | 265 | } |
266 | 266 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | //test with attributes preset and verify template variables are set accordingly |
273 | 273 | |
274 | 274 | $lead->first_name = "firstn"; |
275 | - $lead->last_name ="lastn"; |
|
275 | + $lead->last_name = "lastn"; |
|
276 | 276 | $lead->salutation = "Mr"; |
277 | 277 | $lead->lead_source = "Email"; |
278 | 278 | $lead->status = "New"; |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | |
281 | 281 | $result = $lead->set_notification_body(new Sugar_Smarty(), $lead); |
282 | 282 | |
283 | - $this->assertEquals("Mr firstn lastn" ,$result->_tpl_vars['LEAD_NAME']); |
|
284 | - $this->assertEquals($lead->lead_source ,$result->_tpl_vars['LEAD_SOURCE']); |
|
285 | - $this->assertEquals($lead->status ,$result->_tpl_vars['LEAD_STATUS']); |
|
286 | - $this->assertEquals($lead->description ,$result->_tpl_vars['LEAD_DESCRIPTION']); |
|
283 | + $this->assertEquals("Mr firstn lastn", $result->_tpl_vars['LEAD_NAME']); |
|
284 | + $this->assertEquals($lead->lead_source, $result->_tpl_vars['LEAD_SOURCE']); |
|
285 | + $this->assertEquals($lead->status, $result->_tpl_vars['LEAD_STATUS']); |
|
286 | + $this->assertEquals($lead->description, $result->_tpl_vars['LEAD_DESCRIPTION']); |
|
287 | 287 | |
288 | 288 | } |
289 | 289 | |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | { |
302 | 302 | $lead = new Lead(); |
303 | 303 | |
304 | - $expected = array("MAIN"=>"a", "ACCOUNT"=>"a", "OPPORTUNITY"=>"a", "CONTACT"=>"a" ); |
|
304 | + $expected = array("MAIN"=>"a", "ACCOUNT"=>"a", "OPPORTUNITY"=>"a", "CONTACT"=>"a"); |
|
305 | 305 | $actual = $lead->listviewACLHelper(); |
306 | - $this->assertSame($expected,$actual); |
|
306 | + $this->assertSame($expected, $actual); |
|
307 | 307 | |
308 | 308 | } |
309 | 309 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | |
319 | 319 | $result = $lead->convertCustomFieldsForm($form, $tempBean, $prefix); |
320 | 320 | |
321 | - $this->assertEquals(true,$result); |
|
321 | + $this->assertEquals(true, $result); |
|
322 | 322 | $this->assertgreaterThanOrEqual("", $form); //no filed with source = custom_fields |
323 | 323 | |
324 | 324 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | $expected = "SELECT emails.id FROM emails JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Leads' and\n eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n where eear.deleted=0 and eear.email_id not in\n (select eb.email_id from emails_beans eb where eb.bean_module ='Leads' and eb.bean_id = '')\n ) derivedemails on derivedemails.email_id = emails.id"; |
332 | 332 | $actual = $lead->get_unlinked_email_query(); |
333 | - $this->assertSame($expected,$actual); |
|
333 | + $this->assertSame($expected, $actual); |
|
334 | 334 | |
335 | 335 | } |
336 | 336 | |
@@ -339,16 +339,16 @@ discard block |
||
339 | 339 | { |
340 | 340 | $lead = new Lead(); |
341 | 341 | |
342 | - $expected = array ( |
|
342 | + $expected = array( |
|
343 | 343 | "select" => "SELECT calls.id ", |
344 | 344 | "from" => "FROM calls ", |
345 | 345 | "where" => " WHERE calls.parent_id = '' \n AND calls.parent_type = 'Leads' AND calls.id NOT IN ( SELECT call_id FROM calls_leads ) ", |
346 | 346 | "join" => "", |
347 | - "join_tables" => array (""), |
|
347 | + "join_tables" => array(""), |
|
348 | 348 | ); |
349 | 349 | |
350 | 350 | $actual = $lead->get_old_related_calls(); |
351 | - $this->assertSame($expected,$actual); |
|
351 | + $this->assertSame($expected, $actual); |
|
352 | 352 | |
353 | 353 | } |
354 | 354 | |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | { |
358 | 358 | $lead = new Lead(); |
359 | 359 | |
360 | - $expected = array( "copy"=>"Copy", "move"=>"Move", "donothing"=>"Do Nothing"); |
|
360 | + $expected = array("copy"=>"Copy", "move"=>"Move", "donothing"=>"Do Nothing"); |
|
361 | 361 | $actual = $lead->getActivitiesOptions(); |
362 | - $this->assertSame($expected,$actual); |
|
362 | + $this->assertSame($expected, $actual); |
|
363 | 363 | |
364 | 364 | } |
365 | 365 | |
@@ -368,16 +368,16 @@ discard block |
||
368 | 368 | { |
369 | 369 | $lead = new Lead(); |
370 | 370 | |
371 | - $expected = array ( |
|
371 | + $expected = array( |
|
372 | 372 | "select" => "SELECT meetings.id ", |
373 | 373 | "from" => "FROM meetings ", |
374 | 374 | "where" => " WHERE meetings.parent_id = '' \n AND meetings.parent_type = 'Leads' AND meetings.id NOT IN ( SELECT meeting_id FROM meetings_leads ) ", |
375 | 375 | "join" => "", |
376 | - "join_tables" => array (""), |
|
376 | + "join_tables" => array(""), |
|
377 | 377 | ); |
378 | 378 | |
379 | 379 | $actual = $lead->get_old_related_meetings(); |
380 | - $this->assertSame($expected,$actual); |
|
380 | + $this->assertSame($expected, $actual); |
|
381 | 381 | |
382 | 382 | } |
383 | 383 |
@@ -4,92 +4,92 @@ |
||
4 | 4 | class OAuthKeyTest extends PHPUnit_Framework_TestCase{ |
5 | 5 | |
6 | 6 | |
7 | - public function testOAuthKey() |
|
8 | - { |
|
7 | + public function testOAuthKey() |
|
8 | + { |
|
9 | 9 | |
10 | - //execute the contructor and check for the Object type and attributes |
|
11 | - $oauthKey = new OAuthKey(); |
|
10 | + //execute the contructor and check for the Object type and attributes |
|
11 | + $oauthKey = new OAuthKey(); |
|
12 | 12 | |
13 | - $this->assertInstanceOf('OAuthKey',$oauthKey); |
|
14 | - $this->assertInstanceOf('Basic',$oauthKey); |
|
15 | - $this->assertInstanceOf('SugarBean',$oauthKey); |
|
13 | + $this->assertInstanceOf('OAuthKey',$oauthKey); |
|
14 | + $this->assertInstanceOf('Basic',$oauthKey); |
|
15 | + $this->assertInstanceOf('SugarBean',$oauthKey); |
|
16 | 16 | |
17 | - $this->assertAttributeEquals('OAuthKeys', 'module_dir', $oauthKey); |
|
18 | - $this->assertAttributeEquals('OAuthKey', 'object_name', $oauthKey); |
|
19 | - $this->assertAttributeEquals('oauth_consumer', 'table_name', $oauthKey); |
|
17 | + $this->assertAttributeEquals('OAuthKeys', 'module_dir', $oauthKey); |
|
18 | + $this->assertAttributeEquals('OAuthKey', 'object_name', $oauthKey); |
|
19 | + $this->assertAttributeEquals('oauth_consumer', 'table_name', $oauthKey); |
|
20 | 20 | |
21 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $oauthKey); |
|
21 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $oauthKey); |
|
22 | 22 | |
23 | 23 | |
24 | - } |
|
24 | + } |
|
25 | 25 | |
26 | - public function testMain() |
|
27 | - { |
|
28 | - error_reporting(E_ERROR | E_PARSE); |
|
26 | + public function testMain() |
|
27 | + { |
|
28 | + error_reporting(E_ERROR | E_PARSE); |
|
29 | 29 | |
30 | - $oauthKey = new OAuthKey(); |
|
30 | + $oauthKey = new OAuthKey(); |
|
31 | 31 | |
32 | - //preset required attributes |
|
33 | - $oauthKey->name = "test"; |
|
34 | - $oauthKey->c_key = "key"; |
|
35 | - $oauthKey->c_secret = "secret"; |
|
32 | + //preset required attributes |
|
33 | + $oauthKey->name = "test"; |
|
34 | + $oauthKey->c_key = "key"; |
|
35 | + $oauthKey->c_secret = "secret"; |
|
36 | 36 | |
37 | - $oauthKey->save(); |
|
37 | + $oauthKey->save(); |
|
38 | 38 | |
39 | - //test getByKey method |
|
40 | - $this->getByKey($oauthKey->c_key); |
|
39 | + //test getByKey method |
|
40 | + $this->getByKey($oauthKey->c_key); |
|
41 | 41 | |
42 | - //test fetchKey method |
|
43 | - $this->fetchKey($oauthKey->c_key); |
|
42 | + //test fetchKey method |
|
43 | + $this->fetchKey($oauthKey->c_key); |
|
44 | 44 | |
45 | - //test mark_deleted method |
|
46 | - $this->mark_deleted($oauthKey->id); |
|
45 | + //test mark_deleted method |
|
46 | + $this->mark_deleted($oauthKey->id); |
|
47 | 47 | |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | - public function getByKey($key) |
|
51 | - { |
|
50 | + public function getByKey($key) |
|
51 | + { |
|
52 | 52 | |
53 | - $oauthKey = new OAuthKey(); |
|
53 | + $oauthKey = new OAuthKey(); |
|
54 | 54 | |
55 | - //test with a invalid id |
|
56 | - $result = $oauthKey->getByKey(""); |
|
57 | - $this->assertEquals(false, $result); |
|
55 | + //test with a invalid id |
|
56 | + $result = $oauthKey->getByKey(""); |
|
57 | + $this->assertEquals(false, $result); |
|
58 | 58 | |
59 | 59 | |
60 | - //test with a valid id |
|
61 | - $result = $oauthKey->getByKey($key); |
|
62 | - $this->assertInstanceOf("OAuthKey", $result); |
|
60 | + //test with a valid id |
|
61 | + $result = $oauthKey->getByKey($key); |
|
62 | + $this->assertInstanceOf("OAuthKey", $result); |
|
63 | 63 | |
64 | 64 | |
65 | - } |
|
65 | + } |
|
66 | 66 | |
67 | - public function fetchKey($key) |
|
68 | - { |
|
67 | + public function fetchKey($key) |
|
68 | + { |
|
69 | 69 | |
70 | - //test with a invalid id |
|
71 | - $result = OAuthKey::fetchKey(""); |
|
72 | - $this->assertEquals(false, $result); |
|
70 | + //test with a invalid id |
|
71 | + $result = OAuthKey::fetchKey(""); |
|
72 | + $this->assertEquals(false, $result); |
|
73 | 73 | |
74 | 74 | |
75 | - //test with a valid id |
|
76 | - $result = OAuthKey::fetchKey($key); |
|
77 | - $this->assertInstanceOf("OAuthKey", $result); |
|
75 | + //test with a valid id |
|
76 | + $result = OAuthKey::fetchKey($key); |
|
77 | + $this->assertInstanceOf("OAuthKey", $result); |
|
78 | 78 | |
79 | - } |
|
79 | + } |
|
80 | 80 | |
81 | - public function mark_deleted($id) |
|
82 | - { |
|
81 | + public function mark_deleted($id) |
|
82 | + { |
|
83 | 83 | |
84 | - $oauthKey = new OAuthKey(); |
|
84 | + $oauthKey = new OAuthKey(); |
|
85 | 85 | |
86 | 86 | |
87 | - $oauthKey->mark_deleted($id); |
|
87 | + $oauthKey->mark_deleted($id); |
|
88 | 88 | |
89 | - //verify that record is deleted |
|
90 | - $result = $oauthKey->getByKey($id); |
|
91 | - $this->assertEquals(false, $result); |
|
89 | + //verify that record is deleted |
|
90 | + $result = $oauthKey->getByKey($id); |
|
91 | + $this->assertEquals(false, $result); |
|
92 | 92 | |
93 | - } |
|
93 | + } |
|
94 | 94 | |
95 | 95 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -class OAuthKeyTest extends PHPUnit_Framework_TestCase{ |
|
4 | +class OAuthKeyTest extends PHPUnit_Framework_TestCase { |
|
5 | 5 | |
6 | 6 | |
7 | 7 | public function testOAuthKey() |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | //execute the contructor and check for the Object type and attributes |
11 | 11 | $oauthKey = new OAuthKey(); |
12 | 12 | |
13 | - $this->assertInstanceOf('OAuthKey',$oauthKey); |
|
14 | - $this->assertInstanceOf('Basic',$oauthKey); |
|
15 | - $this->assertInstanceOf('SugarBean',$oauthKey); |
|
13 | + $this->assertInstanceOf('OAuthKey', $oauthKey); |
|
14 | + $this->assertInstanceOf('Basic', $oauthKey); |
|
15 | + $this->assertInstanceOf('SugarBean', $oauthKey); |
|
16 | 16 | |
17 | 17 | $this->assertAttributeEquals('OAuthKeys', 'module_dir', $oauthKey); |
18 | 18 | $this->assertAttributeEquals('OAuthKey', 'object_name', $oauthKey); |
@@ -2,60 +2,60 @@ |
||
2 | 2 | |
3 | 3 | class AOS_ProductsTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - public function testAOS_Products(){ |
|
5 | + public function testAOS_Products(){ |
|
6 | 6 | |
7 | - //execute the contructor and check for the Object type and attributes |
|
8 | - $aosProducts = new AOS_Products(); |
|
9 | - $this->assertInstanceOf('AOS_Products',$aosProducts); |
|
10 | - $this->assertInstanceOf('Basic',$aosProducts); |
|
11 | - $this->assertInstanceOf('SugarBean',$aosProducts); |
|
7 | + //execute the contructor and check for the Object type and attributes |
|
8 | + $aosProducts = new AOS_Products(); |
|
9 | + $this->assertInstanceOf('AOS_Products',$aosProducts); |
|
10 | + $this->assertInstanceOf('Basic',$aosProducts); |
|
11 | + $this->assertInstanceOf('SugarBean',$aosProducts); |
|
12 | 12 | |
13 | - $this->assertAttributeEquals('AOS_Products', 'module_dir', $aosProducts); |
|
14 | - $this->assertAttributeEquals('AOS_Products', 'object_name', $aosProducts); |
|
15 | - $this->assertAttributeEquals('aos_products', 'table_name', $aosProducts); |
|
16 | - $this->assertAttributeEquals(true, 'new_schema', $aosProducts); |
|
17 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aosProducts); |
|
18 | - $this->assertAttributeEquals(true, 'importable', $aosProducts); |
|
19 | - |
|
20 | - } |
|
13 | + $this->assertAttributeEquals('AOS_Products', 'module_dir', $aosProducts); |
|
14 | + $this->assertAttributeEquals('AOS_Products', 'object_name', $aosProducts); |
|
15 | + $this->assertAttributeEquals('aos_products', 'table_name', $aosProducts); |
|
16 | + $this->assertAttributeEquals(true, 'new_schema', $aosProducts); |
|
17 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aosProducts); |
|
18 | + $this->assertAttributeEquals(true, 'importable', $aosProducts); |
|
19 | + |
|
20 | + } |
|
21 | 21 | |
22 | - public function testsave(){ |
|
22 | + public function testsave(){ |
|
23 | 23 | |
24 | - error_reporting(E_ERROR | E_PARSE); |
|
24 | + error_reporting(E_ERROR | E_PARSE); |
|
25 | 25 | |
26 | - $aosProducts = new AOS_Products(); |
|
26 | + $aosProducts = new AOS_Products(); |
|
27 | 27 | |
28 | - $aosProducts->name = "test"; |
|
29 | - $aosProducts->category = 1; |
|
30 | - $aosProducts->product_image='test img'; |
|
31 | - $_POST['deleteAttachment'] = '1'; |
|
28 | + $aosProducts->name = "test"; |
|
29 | + $aosProducts->category = 1; |
|
30 | + $aosProducts->product_image='test img'; |
|
31 | + $_POST['deleteAttachment'] = '1'; |
|
32 | 32 | |
33 | - $aosProducts->save(); |
|
33 | + $aosProducts->save(); |
|
34 | 34 | |
35 | 35 | |
36 | - //test for record ID to verify that record is saved |
|
37 | - $this->assertTrue(isset($aosProducts->id)); |
|
38 | - $this->assertEquals(36, strlen($aosProducts->id)); |
|
39 | - $this->assertEquals('', $aosProducts->product_image); |
|
36 | + //test for record ID to verify that record is saved |
|
37 | + $this->assertTrue(isset($aosProducts->id)); |
|
38 | + $this->assertEquals(36, strlen($aosProducts->id)); |
|
39 | + $this->assertEquals('', $aosProducts->product_image); |
|
40 | 40 | |
41 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
42 | - $aosProducts->mark_deleted($aosProducts->id); |
|
43 | - $result = $aosProducts->retrieve($aosProducts->id); |
|
44 | - $this->assertEquals(null,$result); |
|
41 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
42 | + $aosProducts->mark_deleted($aosProducts->id); |
|
43 | + $result = $aosProducts->retrieve($aosProducts->id); |
|
44 | + $this->assertEquals(null,$result); |
|
45 | 45 | |
46 | 46 | } |
47 | 47 | |
48 | - public function testgetCustomersPurchasedProductsQuery() { |
|
48 | + public function testgetCustomersPurchasedProductsQuery() { |
|
49 | 49 | |
50 | - $aosProducts = new AOS_Products(); |
|
51 | - $aosProducts->id = 1; |
|
50 | + $aosProducts = new AOS_Products(); |
|
51 | + $aosProducts->id = 1; |
|
52 | 52 | |
53 | - //execute the method and verify that it retunrs expected results |
|
54 | - $expected = "\n SELECT * FROM (\n SELECT\n aos_quotes.*,\n accounts.id AS account_id,\n accounts.name AS billing_account,\n \n opportunity_id AS opportunity,\n billing_contact_id AS billing_contact,\n '' AS created_by_name,\n '' AS modified_by_name,\n '' AS assigned_user_name\n FROM\n aos_products\n\n JOIN aos_products_quotes ON aos_products_quotes.product_id = aos_products.id AND aos_products.id = '1' AND aos_products_quotes.deleted = 0 AND aos_products.deleted = 0\n JOIN aos_quotes ON aos_quotes.id = aos_products_quotes.parent_id AND aos_quotes.stage = 'Closed Accepted' AND aos_quotes.deleted = 0\n JOIN accounts ON accounts.id = aos_quotes.billing_account_id -- AND accounts.deleted = 0\n\n GROUP BY accounts.id\n ) AS aos_quotes\n\n "; |
|
55 | - $actual = $aosProducts->getCustomersPurchasedProductsQuery(); |
|
56 | - $this->assertSame($expected,$actual); |
|
53 | + //execute the method and verify that it retunrs expected results |
|
54 | + $expected = "\n SELECT * FROM (\n SELECT\n aos_quotes.*,\n accounts.id AS account_id,\n accounts.name AS billing_account,\n \n opportunity_id AS opportunity,\n billing_contact_id AS billing_contact,\n '' AS created_by_name,\n '' AS modified_by_name,\n '' AS assigned_user_name\n FROM\n aos_products\n\n JOIN aos_products_quotes ON aos_products_quotes.product_id = aos_products.id AND aos_products.id = '1' AND aos_products_quotes.deleted = 0 AND aos_products.deleted = 0\n JOIN aos_quotes ON aos_quotes.id = aos_products_quotes.parent_id AND aos_quotes.stage = 'Closed Accepted' AND aos_quotes.deleted = 0\n JOIN accounts ON accounts.id = aos_quotes.billing_account_id -- AND accounts.deleted = 0\n\n GROUP BY accounts.id\n ) AS aos_quotes\n\n "; |
|
55 | + $actual = $aosProducts->getCustomersPurchasedProductsQuery(); |
|
56 | + $this->assertSame($expected,$actual); |
|
57 | 57 | |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | } |
61 | 61 | ?> |
@@ -2,13 +2,13 @@ discard block |
||
2 | 2 | |
3 | 3 | class AOS_ProductsTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - public function testAOS_Products(){ |
|
5 | + public function testAOS_Products() { |
|
6 | 6 | |
7 | 7 | //execute the contructor and check for the Object type and attributes |
8 | 8 | $aosProducts = new AOS_Products(); |
9 | - $this->assertInstanceOf('AOS_Products',$aosProducts); |
|
10 | - $this->assertInstanceOf('Basic',$aosProducts); |
|
11 | - $this->assertInstanceOf('SugarBean',$aosProducts); |
|
9 | + $this->assertInstanceOf('AOS_Products', $aosProducts); |
|
10 | + $this->assertInstanceOf('Basic', $aosProducts); |
|
11 | + $this->assertInstanceOf('SugarBean', $aosProducts); |
|
12 | 12 | |
13 | 13 | $this->assertAttributeEquals('AOS_Products', 'module_dir', $aosProducts); |
14 | 14 | $this->assertAttributeEquals('AOS_Products', 'object_name', $aosProducts); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | } |
21 | 21 | |
22 | - public function testsave(){ |
|
22 | + public function testsave() { |
|
23 | 23 | |
24 | 24 | error_reporting(E_ERROR | E_PARSE); |
25 | 25 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | $aosProducts->name = "test"; |
29 | 29 | $aosProducts->category = 1; |
30 | - $aosProducts->product_image='test img'; |
|
30 | + $aosProducts->product_image = 'test img'; |
|
31 | 31 | $_POST['deleteAttachment'] = '1'; |
32 | 32 | |
33 | 33 | $aosProducts->save(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | //mark the record as deleted and verify that this record cannot be retrieved anymore. |
42 | 42 | $aosProducts->mark_deleted($aosProducts->id); |
43 | 43 | $result = $aosProducts->retrieve($aosProducts->id); |
44 | - $this->assertEquals(null,$result); |
|
44 | + $this->assertEquals(null, $result); |
|
45 | 45 | |
46 | 46 | } |
47 | 47 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | //execute the method and verify that it retunrs expected results |
54 | 54 | $expected = "\n SELECT * FROM (\n SELECT\n aos_quotes.*,\n accounts.id AS account_id,\n accounts.name AS billing_account,\n \n opportunity_id AS opportunity,\n billing_contact_id AS billing_contact,\n '' AS created_by_name,\n '' AS modified_by_name,\n '' AS assigned_user_name\n FROM\n aos_products\n\n JOIN aos_products_quotes ON aos_products_quotes.product_id = aos_products.id AND aos_products.id = '1' AND aos_products_quotes.deleted = 0 AND aos_products.deleted = 0\n JOIN aos_quotes ON aos_quotes.id = aos_products_quotes.parent_id AND aos_quotes.stage = 'Closed Accepted' AND aos_quotes.deleted = 0\n JOIN accounts ON accounts.id = aos_quotes.billing_account_id -- AND accounts.deleted = 0\n\n GROUP BY accounts.id\n ) AS aos_quotes\n\n "; |
55 | 55 | $actual = $aosProducts->getCustomersPurchasedProductsQuery(); |
56 | - $this->assertSame($expected,$actual); |
|
56 | + $this->assertSame($expected, $actual); |
|
57 | 57 | |
58 | 58 | } |
59 | 59 |