@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | { |
6 | 6 | |
7 | 7 | |
8 | - public function testexecute(){ |
|
8 | + public function testexecute() { |
|
9 | 9 | |
10 | 10 | $SugarApplication = new SugarApplication(); |
11 | 11 | |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | try { |
14 | 14 | $SugarApplication->execute(); |
15 | 15 | |
16 | - } catch (Exception $e) { |
|
17 | - $this->assertStringStartsWith('Cannot modify header information',$e->getMessage()); |
|
16 | + }catch (Exception $e) { |
|
17 | + $this->assertStringStartsWith('Cannot modify header information', $e->getMessage()); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | - public function testloadUser(){ |
|
23 | + public function testloadUser() { |
|
24 | 24 | |
25 | 25 | //cannot test this method as it uses die which stops execution of php unit as well |
26 | 26 | /* |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | } |
44 | 44 | |
45 | - public function testACLFilter(){ |
|
45 | + public function testACLFilter() { |
|
46 | 46 | |
47 | 47 | $SugarApplication = new SugarApplication(); |
48 | 48 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | } |
102 | 102 | |
103 | - public function testpreProcess(){ |
|
103 | + public function testpreProcess() { |
|
104 | 104 | |
105 | 105 | $SugarApplication = new SugarApplication(); |
106 | 106 | $SugarApplication->controller = new SugarController(); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | |
121 | - public function testhandleOfflineClient(){ |
|
121 | + public function testhandleOfflineClient() { |
|
122 | 122 | $SugarApplication = new SugarApplication(); |
123 | 123 | |
124 | 124 | //execute the method and test if it works and does not throws an exception. |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | |
136 | - public function testhandleAccessControl(){ |
|
136 | + public function testhandleAccessControl() { |
|
137 | 137 | |
138 | 138 | $SugarApplication = new SugarApplication(); |
139 | 139 | $SugarApplication->controller = new SugarController(); |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | $result = $SugarApplication->handleAccessControl(); |
142 | 142 | |
143 | 143 | //check that it returns Null |
144 | - $this->assertEquals(NULL,$result); |
|
144 | + $this->assertEquals(NULL, $result); |
|
145 | 145 | |
146 | 146 | //check that controller->hasAccess is true i-e default setting. |
147 | - $this->assertEquals(True,$SugarApplication->controller->hasAccess); |
|
147 | + $this->assertEquals(True, $SugarApplication->controller->hasAccess); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | SugarApplication::preLoadLanguages(); |
156 | 156 | |
157 | 157 | //check that method call got the current_language global variable set. |
158 | - $this->assertTrue(isset($GLOBALS['current_language'] )); |
|
158 | + $this->assertTrue(isset($GLOBALS['current_language'])); |
|
159 | 159 | |
160 | 160 | //check that method call got the app_strings global variable set. |
161 | - $this->assertTrue(is_array($GLOBALS['app_strings']) && count($GLOBALS['app_strings']) > 0 ); |
|
161 | + $this->assertTrue(is_array($GLOBALS['app_strings']) && count($GLOBALS['app_strings']) > 0); |
|
162 | 162 | |
163 | 163 | } |
164 | 164 | catch (Exception $e) { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | } |
169 | 169 | |
170 | - public function testloadLanguages(){ |
|
170 | + public function testloadLanguages() { |
|
171 | 171 | |
172 | 172 | $SugarApplication = new SugarApplication(); |
173 | 173 | $SugarApplication->controller = new SugarController(); |
@@ -176,16 +176,16 @@ discard block |
||
176 | 176 | $SugarApplication->loadLanguages(); |
177 | 177 | |
178 | 178 | //check that method call got the current_language global variable set. |
179 | - $this->assertTrue(isset($GLOBALS['current_language'] )); |
|
179 | + $this->assertTrue(isset($GLOBALS['current_language'])); |
|
180 | 180 | |
181 | 181 | //check that method call got the app_strings global variable set. |
182 | - $this->assertTrue(is_array($GLOBALS['app_strings']) && count($GLOBALS['app_strings']) > 0 ); |
|
182 | + $this->assertTrue(is_array($GLOBALS['app_strings']) && count($GLOBALS['app_strings']) > 0); |
|
183 | 183 | |
184 | 184 | //check that method call got the app_list_strings global variable set. |
185 | - $this->assertTrue(is_array($GLOBALS['app_list_strings']) && count($GLOBALS['app_list_strings']) > 0 ); |
|
185 | + $this->assertTrue(is_array($GLOBALS['app_list_strings']) && count($GLOBALS['app_list_strings']) > 0); |
|
186 | 186 | |
187 | 187 | //check that method call got the mod_strings global variable set. |
188 | - $this->assertTrue(is_array($GLOBALS['mod_strings']) && count($GLOBALS['mod_strings']) > 0 ); |
|
188 | + $this->assertTrue(is_array($GLOBALS['mod_strings']) && count($GLOBALS['mod_strings']) > 0); |
|
189 | 189 | |
190 | 190 | } |
191 | 191 | catch (Exception $e) { |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | |
211 | - public function testloadDisplaySettings(){ |
|
211 | + public function testloadDisplaySettings() { |
|
212 | 212 | |
213 | 213 | $SugarApplication = new SugarApplication(); |
214 | 214 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | } |
226 | 226 | |
227 | - public function testloadLicense(){ |
|
227 | + public function testloadLicense() { |
|
228 | 228 | |
229 | 229 | $SugarApplication = new SugarApplication(); |
230 | 230 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | } |
243 | 243 | |
244 | - public function testloadGlobals(){ |
|
244 | + public function testloadGlobals() { |
|
245 | 245 | |
246 | 246 | $SugarApplication = new SugarApplication(); |
247 | 247 | $SugarApplication->controller = new SugarController(); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | |
263 | - public function teststartSession(){ |
|
263 | + public function teststartSession() { |
|
264 | 264 | |
265 | 265 | $SugarApplication = new SugarApplication(); |
266 | 266 | $SugarApplication->controller = new SugarController(); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | |
282 | - public function testendSession(){ |
|
282 | + public function testendSession() { |
|
283 | 283 | |
284 | 284 | |
285 | 285 | $SugarApplication = new SugarApplication(); |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | //there should be one more array element after method execution. |
329 | 329 | $user_error_message_count = count($_SESSION['user_error_message']); |
330 | 330 | SugarApplication::appendErrorMessage('some error'); |
331 | - $this->assertGreaterThan($user_error_message_count , count($_SESSION['user_error_message'])); |
|
331 | + $this->assertGreaterThan($user_error_message_count, count($_SESSION['user_error_message'])); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | public function testgetErrorMessages() |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | public function testsetCookie( ) |
344 | 344 | { |
345 | 345 | //execute the method and check that the method adds the key value pair to cookies array. |
346 | - SugarApplication::setCookie('key','value'); |
|
347 | - $this->assertEquals('value' , $_COOKIE['key'] ); |
|
346 | + SugarApplication::setCookie('key', 'value'); |
|
347 | + $this->assertEquals('value', $_COOKIE['key']); |
|
348 | 348 | |
349 | 349 | } |
350 | 350 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | //execute the method and check if it works and doesn't throws an exception |
14 | 14 | try { |
15 | 15 | $SugarView->init(); |
16 | - } catch (Exception $e) { |
|
16 | + }catch (Exception $e) { |
|
17 | 17 | $this->fail(); |
18 | 18 | } |
19 | 19 | |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | $renderedContent = ob_get_contents(); |
42 | 42 | ob_end_clean(); |
43 | 43 | |
44 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
44 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
45 | 45 | |
46 | - } catch (Exception $e) { |
|
46 | + }catch (Exception $e) { |
|
47 | 47 | $this->fail(); |
48 | 48 | } |
49 | 49 | |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | //execute the method and check if it works and doesn't throws an exception |
58 | 58 | try { |
59 | 59 | $errors = $SugarView->displayErrors(); |
60 | - $this->assertSame(NULL,$errors); |
|
61 | - } catch (Exception $e) { |
|
60 | + $this->assertSame(NULL, $errors); |
|
61 | + }catch (Exception $e) { |
|
62 | 62 | $this->fail(); |
63 | 63 | } |
64 | 64 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | try { |
78 | 78 | $SugarView->preDisplay(); |
79 | 79 | |
80 | - } catch (Exception $e) { |
|
80 | + }catch (Exception $e) { |
|
81 | 81 | $this->fail(); |
82 | 82 | } |
83 | 83 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | try { |
97 | 97 | $SugarView->display(); |
98 | 98 | |
99 | - } catch (Exception $e) { |
|
99 | + }catch (Exception $e) { |
|
100 | 100 | $this->fail(); |
101 | 101 | } |
102 | 102 | |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | $renderedContent = ob_get_contents(); |
122 | 122 | ob_end_clean(); |
123 | 123 | |
124 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
124 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
125 | 125 | |
126 | - } catch (Exception $e) { |
|
126 | + }catch (Exception $e) { |
|
127 | 127 | $this->fail(); |
128 | 128 | } |
129 | 129 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | try { |
138 | 138 | $SugarView->getModuleMenuHTML(); |
139 | 139 | |
140 | - } catch (Exception $e) { |
|
140 | + }catch (Exception $e) { |
|
141 | 141 | $this->fail(); |
142 | 142 | } |
143 | 143 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | try { |
156 | 156 | $SugarView->includeClassicFile('config.php'); |
157 | 157 | |
158 | - } catch (Exception $e) { |
|
158 | + }catch (Exception $e) { |
|
159 | 159 | $this->fail(); |
160 | 160 | } |
161 | 161 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | //check if it returns any text i-e JS code |
171 | 171 | $js = SugarView::getJavascriptValidation(); |
172 | - $this->assertGreaterThan(0,strlen($js)); |
|
172 | + $this->assertGreaterThan(0, strlen($js)); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | $renderedContent = ob_get_contents(); |
189 | 189 | ob_end_clean(); |
190 | 190 | |
191 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
191 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
192 | 192 | |
193 | - } catch (Exception $e) { |
|
193 | + }catch (Exception $e) { |
|
194 | 194 | $this->fail(); |
195 | 195 | } |
196 | 196 | |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | $renderedContent = ob_get_contents(); |
213 | 213 | ob_end_clean(); |
214 | 214 | |
215 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
215 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
216 | 216 | |
217 | - } catch (Exception $e) { |
|
217 | + }catch (Exception $e) { |
|
218 | 218 | $this->fail(); |
219 | 219 | } |
220 | 220 | |
@@ -257,15 +257,15 @@ discard block |
||
257 | 257 | |
258 | 258 | //first execute the method with default value |
259 | 259 | $moduleTitle = $SugarView->getModuleTitle(); |
260 | - $this->assertGreaterThan(0,strlen($moduleTitle)); |
|
260 | + $this->assertGreaterThan(0, strlen($moduleTitle)); |
|
261 | 261 | |
262 | 262 | //second execute the method with true value |
263 | 263 | $moduleTitle = $SugarView->getModuleTitle(true); |
264 | - $this->assertGreaterThan(0,strlen($moduleTitle)); |
|
264 | + $this->assertGreaterThan(0, strlen($moduleTitle)); |
|
265 | 265 | |
266 | 266 | //third execute the method with false value |
267 | 267 | $moduleTitle = $SugarView->getModuleTitle(false); |
268 | - $this->assertGreaterThan(0,strlen($moduleTitle)); |
|
268 | + $this->assertGreaterThan(0, strlen($moduleTitle)); |
|
269 | 269 | |
270 | 270 | } |
271 | 271 | |
@@ -277,15 +277,15 @@ discard block |
||
277 | 277 | |
278 | 278 | //first execute the method with missing attributes. it should return Null. |
279 | 279 | $metaDataFile = $SugarView->getMetaDataFile(); |
280 | - $this->assertEquals(NULL,$metaDataFile); |
|
280 | + $this->assertEquals(NULL, $metaDataFile); |
|
281 | 281 | |
282 | 282 | |
283 | 283 | //second execute the method with valid attributes set. it should return a file path string. |
284 | - $SugarView->type ='detail' ; |
|
284 | + $SugarView->type = 'detail'; |
|
285 | 285 | $SugarView->module = 'Users'; |
286 | 286 | |
287 | 287 | $metaDataFile = $SugarView->getMetaDataFile(); |
288 | - $this->assertGreaterThan(0,strlen($metaDataFile)); |
|
288 | + $this->assertGreaterThan(0, strlen($metaDataFile)); |
|
289 | 289 | |
290 | 290 | } |
291 | 291 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | |
299 | 299 | //execute the method. it should return a title string. |
300 | 300 | $browserTitle = $SugarView->getBrowserTitle(); |
301 | - $this->assertGreaterThan(0,strlen($browserTitle)); |
|
301 | + $this->assertGreaterThan(0, strlen($browserTitle)); |
|
302 | 302 | |
303 | 303 | } |
304 | 304 | |
@@ -310,12 +310,12 @@ discard block |
||
310 | 310 | |
311 | 311 | //execute the method. it should return a string. |
312 | 312 | $breadCrumbSymbol = $SugarView->getBreadCrumbSymbol(); |
313 | - $this->assertGreaterThan(0,strlen($breadCrumbSymbol)); |
|
313 | + $this->assertGreaterThan(0, strlen($breadCrumbSymbol)); |
|
314 | 314 | |
315 | 315 | } |
316 | 316 | |
317 | 317 | |
318 | - public function testcheckPostMaxSizeError(){ |
|
318 | + public function testcheckPostMaxSizeError() { |
|
319 | 319 | |
320 | 320 | $SugarView = new SugarView(); |
321 | 321 |
@@ -2,77 +2,77 @@ |
||
2 | 2 | |
3 | 3 | |
4 | 4 | |
5 | -class ViewFactoryTest extends PHPUnit_Framework_TestCase{ |
|
5 | +class ViewFactoryTest extends PHPUnit_Framework_TestCase { |
|
6 | 6 | |
7 | - public function testloadView(){ |
|
7 | + public function testloadView() { |
|
8 | 8 | error_reporting(E_ERROR | E_WARNING | E_PARSE); |
9 | 9 | |
10 | 10 | //check with invalid input. must return sugaview instance |
11 | - $view = ViewFactory::loadView('default',''); |
|
12 | - $this->assertInstanceOf('SugarView',$view); |
|
11 | + $view = ViewFactory::loadView('default', ''); |
|
12 | + $this->assertInstanceOf('SugarView', $view); |
|
13 | 13 | |
14 | 14 | //check with a valid module without a specific view, must return sugarview instance |
15 | - $view = ViewFactory::loadView('default','Users'); |
|
16 | - $this->assertInstanceOf('SugarView',$view); |
|
15 | + $view = ViewFactory::loadView('default', 'Users'); |
|
16 | + $this->assertInstanceOf('SugarView', $view); |
|
17 | 17 | |
18 | 18 | //check with a valid module and specific view, must reutern speciifc view instance |
19 | - $view = ViewFactory::loadView('list','Users'); |
|
20 | - $this->assertInstanceOf('UsersViewList',$view); |
|
19 | + $view = ViewFactory::loadView('list', 'Users'); |
|
20 | + $this->assertInstanceOf('UsersViewList', $view); |
|
21 | 21 | |
22 | 22 | } |
23 | 23 | |
24 | - public function test_loadConfig(){ |
|
24 | + public function test_loadConfig() { |
|
25 | 25 | //check with a invalid module, method must not change the view options. |
26 | - $view = ViewFactory::loadView('default',''); |
|
26 | + $view = ViewFactory::loadView('default', ''); |
|
27 | 27 | $options = $view->options; |
28 | 28 | ViewFactory::_loadConfig($view, 'default'); |
29 | - $this->assertSame($options,$view->options); |
|
29 | + $this->assertSame($options, $view->options); |
|
30 | 30 | |
31 | 31 | |
32 | 32 | //check with a valid module which does not implement it's own view config. method must not change the view options. |
33 | - $view = ViewFactory::loadView('detail','Users'); |
|
33 | + $view = ViewFactory::loadView('detail', 'Users'); |
|
34 | 34 | $options = $view->options; |
35 | 35 | ViewFactory::_loadConfig($view, 'detail'); |
36 | - $this->assertSame($options,$view->options); |
|
36 | + $this->assertSame($options, $view->options); |
|
37 | 37 | |
38 | 38 | |
39 | 39 | //check with a valid module which implement it's own view config. method still must not change the view options because it needs. |
40 | - $view = ViewFactory::loadView('area_detail_map','jjwg_Areas'); |
|
40 | + $view = ViewFactory::loadView('area_detail_map', 'jjwg_Areas'); |
|
41 | 41 | $view->module = 'jjwg_Areas'; |
42 | 42 | $options = $view->options; |
43 | 43 | ViewFactory::_loadConfig($view, 'area_detail_map'); |
44 | - $this->assertSame($options,$view->options); |
|
44 | + $this->assertSame($options, $view->options); |
|
45 | 45 | |
46 | 46 | |
47 | 47 | } |
48 | 48 | |
49 | - public function test_buildFromFile(){ |
|
49 | + public function test_buildFromFile() { |
|
50 | 50 | |
51 | 51 | //checck with valid values and test if it returns correct view instance |
52 | 52 | $type = 'list'; |
53 | 53 | $target_module = 'Users'; |
54 | 54 | $bean = Null; |
55 | - $view = ViewFactory::_buildFromFile('modules/' . $target_module . '/views/view.'.$type.'.php', $bean, array(), $type, $target_module); |
|
56 | - $this->assertInstanceOf('UsersViewList',$view); |
|
55 | + $view = ViewFactory::_buildFromFile('modules/'.$target_module.'/views/view.'.$type.'.php', $bean, array(), $type, $target_module); |
|
56 | + $this->assertInstanceOf('UsersViewList', $view); |
|
57 | 57 | |
58 | 58 | //checck with valid values and test if it returns correct view instance |
59 | 59 | $type = 'detail'; |
60 | 60 | $target_module = 'Users'; |
61 | 61 | $bean = Null; |
62 | - $view = ViewFactory::_buildFromFile('modules/' . $target_module . '/views/view.'.$type.'.php', $bean, array(), $type, $target_module); |
|
63 | - $this->assertInstanceOf('UsersViewDetail',$view); |
|
62 | + $view = ViewFactory::_buildFromFile('modules/'.$target_module.'/views/view.'.$type.'.php', $bean, array(), $type, $target_module); |
|
63 | + $this->assertInstanceOf('UsersViewDetail', $view); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
67 | - public function test_buildClass(){ |
|
67 | + public function test_buildClass() { |
|
68 | 68 | |
69 | 69 | //checck with valid values and test if it returns correct view instance |
70 | 70 | $view = ViewFactory::_buildClass('UsersViewList', Null, array()); |
71 | - $this->assertInstanceOf('UsersViewList',$view); |
|
71 | + $this->assertInstanceOf('UsersViewList', $view); |
|
72 | 72 | |
73 | 73 | //checck with valid values and test if it returns correct view instance |
74 | 74 | $view = ViewFactory::_buildClass('UsersViewDetail', Null, array()); |
75 | - $this->assertInstanceOf('UsersViewDetail',$view); |
|
75 | + $this->assertInstanceOf('UsersViewDetail', $view); |
|
76 | 76 | |
77 | 77 | } |
78 | 78 | } |
@@ -3,56 +3,56 @@ discard block |
||
3 | 3 | class ViewMetadataTest extends PHPUnit_Framework_TestCase |
4 | 4 | { |
5 | 5 | |
6 | - public function testdisplayCheckBoxes(){ |
|
6 | + public function testdisplayCheckBoxes() { |
|
7 | 7 | |
8 | 8 | $view = new ViewMetadata(); |
9 | 9 | |
10 | 10 | //check with empty values array. it should return html sting |
11 | 11 | ob_start(); |
12 | 12 | $values = Array(); |
13 | - $view->displayCheckBoxes('test',$values); |
|
13 | + $view->displayCheckBoxes('test', $values); |
|
14 | 14 | $renderedContent1 = ob_get_contents(); |
15 | 15 | ob_end_clean(); |
16 | - $this->assertGreaterThan(0,strlen($renderedContent1)); |
|
16 | + $this->assertGreaterThan(0, strlen($renderedContent1)); |
|
17 | 17 | |
18 | 18 | |
19 | 19 | //check with prefilled values array. it should return html sting longer than earlier |
20 | 20 | ob_start(); |
21 | - $values = Array('option1','option2'); |
|
22 | - $view->displayCheckBoxes('test',$values); |
|
21 | + $values = Array('option1', 'option2'); |
|
22 | + $view->displayCheckBoxes('test', $values); |
|
23 | 23 | $renderedContent2 = ob_get_contents(); |
24 | 24 | ob_end_clean(); |
25 | - $this->assertGreaterThan(strlen($renderedContent1),strlen($renderedContent2)); |
|
25 | + $this->assertGreaterThan(strlen($renderedContent1), strlen($renderedContent2)); |
|
26 | 26 | |
27 | 27 | } |
28 | 28 | |
29 | - public function testdisplaySelect(){ |
|
29 | + public function testdisplaySelect() { |
|
30 | 30 | |
31 | 31 | $view = new ViewMetadata(); |
32 | 32 | |
33 | 33 | //check with empty values array. it should return html sting |
34 | 34 | ob_start(); |
35 | 35 | $values = Array(); |
36 | - $view->displaySelect('test',$values); |
|
36 | + $view->displaySelect('test', $values); |
|
37 | 37 | $renderedContent1 = ob_get_contents(); |
38 | 38 | ob_end_clean(); |
39 | - $this->assertGreaterThan(0,strlen($renderedContent1)); |
|
39 | + $this->assertGreaterThan(0, strlen($renderedContent1)); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | //check with prefilled values array. it should return html sting longer than earlier |
43 | 43 | ob_start(); |
44 | - $values = Array('option1','option2'); |
|
45 | - $view->displaySelect('test',$values); |
|
44 | + $values = Array('option1', 'option2'); |
|
45 | + $view->displaySelect('test', $values); |
|
46 | 46 | $renderedContent2 = ob_get_contents(); |
47 | 47 | ob_end_clean(); |
48 | - $this->assertGreaterThan(strlen($renderedContent1),strlen($renderedContent2)); |
|
48 | + $this->assertGreaterThan(strlen($renderedContent1), strlen($renderedContent2)); |
|
49 | 49 | |
50 | 50 | |
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | - public function testdisplayTextBoxes(){ |
|
55 | + public function testdisplayTextBoxes() { |
|
56 | 56 | |
57 | 57 | $view = new ViewMetadata(); |
58 | 58 | |
@@ -62,35 +62,35 @@ discard block |
||
62 | 62 | $view->displayTextBoxes($values); |
63 | 63 | $renderedContent1 = ob_get_contents(); |
64 | 64 | ob_end_clean(); |
65 | - $this->assertGreaterThan(0,strlen($renderedContent1)); |
|
65 | + $this->assertGreaterThan(0, strlen($renderedContent1)); |
|
66 | 66 | |
67 | 67 | |
68 | 68 | //check with prefilled values array. it should return html sting longer than earlier |
69 | 69 | ob_start(); |
70 | - $values = Array('option1','option2'); |
|
70 | + $values = Array('option1', 'option2'); |
|
71 | 71 | $view->displayTextBoxes($values); |
72 | 72 | $renderedContent2 = ob_get_contents(); |
73 | 73 | ob_end_clean(); |
74 | - $this->assertGreaterThan(strlen($renderedContent1),strlen($renderedContent2)); |
|
74 | + $this->assertGreaterThan(strlen($renderedContent1), strlen($renderedContent2)); |
|
75 | 75 | |
76 | 76 | |
77 | 77 | } |
78 | 78 | |
79 | 79 | |
80 | - public function testprintValue(){ |
|
80 | + public function testprintValue() { |
|
81 | 81 | |
82 | 82 | $view = new ViewMetadata(); |
83 | 83 | |
84 | 84 | ob_start(); |
85 | - $values = Array('option1','option2'); |
|
85 | + $values = Array('option1', 'option2'); |
|
86 | 86 | $view->printValue($values); |
87 | 87 | $renderedContent = ob_get_contents(); |
88 | 88 | ob_end_clean(); |
89 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
89 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
90 | 90 | |
91 | 91 | } |
92 | 92 | |
93 | - public function testdisplay(){ |
|
93 | + public function testdisplay() { |
|
94 | 94 | error_reporting(E_ERROR | E_PARSE); |
95 | 95 | |
96 | 96 | $view = new ViewMetadata(); |
@@ -100,21 +100,21 @@ discard block |
||
100 | 100 | $view->display(); |
101 | 101 | $renderedContent = ob_get_contents(); |
102 | 102 | ob_end_clean(); |
103 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
103 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
104 | 104 | |
105 | 105 | |
106 | 106 | //test with REQUEST parameters set |
107 | - $_REQUEST['modules'] = Array('Calls','Meetings'); |
|
107 | + $_REQUEST['modules'] = Array('Calls', 'Meetings'); |
|
108 | 108 | ob_start(); |
109 | 109 | $view->display(); |
110 | 110 | $renderedContent = ob_get_contents(); |
111 | 111 | ob_end_clean(); |
112 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
112 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
113 | 113 | |
114 | 114 | } |
115 | 115 | |
116 | 116 | |
117 | - public function testgetModules(){ |
|
117 | + public function testgetModules() { |
|
118 | 118 | |
119 | 119 | //execute the method and test if it returns a array. |
120 | 120 | $modules = VardefBrowser::getModules(); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | - public function testfindFieldsWithAttributes(){ |
|
125 | + public function testfindFieldsWithAttributes() { |
|
126 | 126 | |
127 | 127 | //check with emptty attributes array |
128 | 128 | $attributes = Array(); |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | $this->assertTrue(is_array($fields3)); |
141 | 141 | |
142 | 142 | //check that all three arrays returned, are not same. |
143 | - $this->assertNotSame($fields1,$fields2); |
|
144 | - $this->assertNotSame($fields1,$fields3); |
|
145 | - $this->assertNotSame($fields2,$fields3); |
|
143 | + $this->assertNotSame($fields1, $fields2); |
|
144 | + $this->assertNotSame($fields1, $fields3); |
|
145 | + $this->assertNotSame($fields2, $fields3); |
|
146 | 146 | |
147 | 147 | } |
148 | 148 | |
149 | - public function testfindVardefs(){ |
|
149 | + public function testfindVardefs() { |
|
150 | 150 | |
151 | 151 | //check with empty modules array |
152 | 152 | $modules = Array(); |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | $this->assertTrue(is_array($defs2)); |
161 | 161 | |
162 | 162 | //check that two arrays returned, are not same. |
163 | - $this->assertNotSame($defs1,$defs2); |
|
163 | + $this->assertNotSame($defs1, $defs2); |
|
164 | 164 | |
165 | 165 | } |
166 | 166 | |
167 | 167 | |
168 | - public function testfindFieldAttributes(){ |
|
168 | + public function testfindFieldAttributes() { |
|
169 | 169 | |
170 | 170 | //check with emptty attributes array |
171 | 171 | $attributes = Array(); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | //check with emptty attributes array and prefilled modules array. |
177 | 177 | $attributes = Array(); |
178 | 178 | $modules = Array('Users'); |
179 | - $fields2 = VardefBrowser::findFieldAttributes($attributes,$modules,true,true); |
|
179 | + $fields2 = VardefBrowser::findFieldAttributes($attributes, $modules, true, true); |
|
180 | 180 | $this->assertTrue(is_array($fields2)); |
181 | 181 | |
182 | 182 | |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | |
188 | 188 | |
189 | 189 | //check that all three arrays returned, are not same. |
190 | - $this->assertNotSame($fields1,$fields2); |
|
191 | - $this->assertNotSame($fields1,$fields3); |
|
192 | - $this->assertNotSame($fields2,$fields3); |
|
190 | + $this->assertNotSame($fields1, $fields2); |
|
191 | + $this->assertNotSame($fields1, $fields3); |
|
192 | + $this->assertNotSame($fields2, $fields3); |
|
193 | 193 | |
194 | 194 | } |
195 | 195 |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | { |
8 | 8 | //execute the contructor and check for the Object type and type attribute |
9 | 9 | $view = new ViewAjaxUI(); |
10 | - $this->assertInstanceOf('ViewAjaxUI',$view); |
|
11 | - $this->assertInstanceOf('SugarView',$view); |
|
12 | - $this->assertTrue( is_array($view->options)); |
|
10 | + $this->assertInstanceOf('ViewAjaxUI', $view); |
|
11 | + $this->assertInstanceOf('SugarView', $view); |
|
12 | + $this->assertTrue(is_array($view->options)); |
|
13 | 13 | |
14 | 14 | } |
15 | 15 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | try { |
23 | 23 | $view->display(); |
24 | 24 | |
25 | - } catch (Exception $e) { |
|
26 | - $this->assertStringStartsWith('Cannot modify header information',$e->getMessage()); |
|
25 | + }catch (Exception $e) { |
|
26 | + $this->assertStringStartsWith('Cannot modify header information', $e->getMessage()); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | } |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | { |
8 | 8 | //execute the contructor and check for the Object type and type attribute |
9 | 9 | $view = new ViewList(); |
10 | - $this->assertInstanceOf('ViewList',$view); |
|
11 | - $this->assertInstanceOf('SugarView',$view); |
|
12 | - $this->assertAttributeEquals('list','type', $view); |
|
10 | + $this->assertInstanceOf('ViewList', $view); |
|
11 | + $this->assertInstanceOf('SugarView', $view); |
|
12 | + $this->assertAttributeEquals('list', 'type', $view); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | try { |
22 | 22 | $view->oldSearch(); |
23 | 23 | |
24 | - } catch (Exception $e) { |
|
24 | + }catch (Exception $e) { |
|
25 | 25 | $this->fail(); |
26 | 26 | } |
27 | 27 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | try { |
36 | 36 | $view->newSearch(); |
37 | 37 | |
38 | - } catch (Exception $e) { |
|
38 | + }catch (Exception $e) { |
|
39 | 39 | $this->fail(); |
40 | 40 | } |
41 | 41 | |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | $view->listViewPrepare(); |
54 | 54 | $renderedContent = ob_get_contents(); |
55 | 55 | ob_end_clean(); |
56 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
56 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
57 | 57 | |
58 | 58 | |
59 | 59 | //test with some REQUEST parameters preset. it should return some html and set the REQUEST key we provided in current_query_by_page REQUEST Param. |
60 | 60 | $view = new ViewList(); |
61 | 61 | $view->module = "Users"; |
62 | - $GLOBALS['module']= "Users"; |
|
63 | - $_REQUEST["Users2_USER_offset"]= 1; |
|
62 | + $GLOBALS['module'] = "Users"; |
|
63 | + $_REQUEST["Users2_USER_offset"] = 1; |
|
64 | 64 | $_REQUEST['current_query_by_page'] = base64_encode(serialize(Array("key"=>"value"))); |
65 | 65 | $view->bean = New User(); |
66 | 66 | |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | $view->listViewPrepare(); |
69 | 69 | $renderedContent = ob_get_contents(); |
70 | 70 | ob_end_clean(); |
71 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
72 | - $this->assertEquals('value',$_REQUEST['key']); |
|
71 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
72 | + $this->assertEquals('value', $_REQUEST['key']); |
|
73 | 73 | |
74 | 74 | } |
75 | 75 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $view->listViewProcess(); |
86 | 86 | $renderedContent = ob_get_contents(); |
87 | 87 | ob_end_clean(); |
88 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
88 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
89 | 89 | |
90 | 90 | } |
91 | 91 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $view1 = new ViewList(); |
96 | 96 | $view1->module = "Users"; |
97 | 97 | $view1->prepareSearchForm(); |
98 | - $this->assertInstanceOf('SearchForm',$view1->searchForm); |
|
98 | + $this->assertInstanceOf('SearchForm', $view1->searchForm); |
|
99 | 99 | |
100 | 100 | |
101 | 101 | //test with REQUEST parameters set. it will set searchform attribute to a searchform object. |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $_REQUEST['searchFormTab'] = 'advanced_search'; |
106 | 106 | $view2->prepareSearchForm(); |
107 | 107 | |
108 | - $this->assertInstanceOf('SearchForm',$view2->searchForm); |
|
108 | + $this->assertInstanceOf('SearchForm', $view2->searchForm); |
|
109 | 109 | |
110 | 110 | } |
111 | 111 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $view->processSearchForm(); |
120 | 120 | $renderedContent = ob_get_contents(); |
121 | 121 | ob_end_clean(); |
122 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
122 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
123 | 123 | |
124 | 124 | |
125 | 125 | //test with use_old_search = true. there is a $view variable which is never set so it doesn't returns anything. |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $view->processSearchForm(); |
132 | 132 | $renderedContent = ob_get_contents(); |
133 | 133 | ob_end_clean(); |
134 | - $this->assertEquals(0,strlen($renderedContent)); |
|
134 | + $this->assertEquals(0, strlen($renderedContent)); |
|
135 | 135 | |
136 | 136 | } |
137 | 137 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | //execute the method and test if it sets the lv attribute to ListViewSmarty object. |
142 | 142 | $view = new ViewList(); |
143 | 143 | $view->preDisplay(); |
144 | - $this->assertInstanceOf('ListViewSmarty',$view->lv); |
|
144 | + $this->assertInstanceOf('ListViewSmarty', $view->lv); |
|
145 | 145 | |
146 | 146 | } |
147 | 147 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $view->display(); |
155 | 155 | $renderedContent1 = ob_get_contents(); |
156 | 156 | ob_end_clean(); |
157 | - $this->assertGreaterThan(0,strlen($renderedContent1)); |
|
157 | + $this->assertGreaterThan(0, strlen($renderedContent1)); |
|
158 | 158 | |
159 | 159 | |
160 | 160 | //test with bean, seed and other arrtibutes set. it shuold return html. |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $view->display(); |
170 | 170 | $renderedContent2 = ob_get_contents(); |
171 | 171 | ob_end_clean(); |
172 | - $this->assertGreaterThan(0,strlen($renderedContent2)); |
|
172 | + $this->assertGreaterThan(0, strlen($renderedContent2)); |
|
173 | 173 | |
174 | 174 | |
175 | 175 |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | { |
8 | 8 | //execute the contructor and check for the Object type and type attribute |
9 | 9 | $view = new ViewDetail(); |
10 | - $this->assertInstanceOf('ViewDetail',$view); |
|
11 | - $this->assertInstanceOf('SugarView',$view); |
|
12 | - $this->assertAttributeEquals('detail','type', $view); |
|
10 | + $this->assertInstanceOf('ViewDetail', $view); |
|
11 | + $this->assertInstanceOf('SugarView', $view); |
|
12 | + $this->assertAttributeEquals('detail', 'type', $view); |
|
13 | 13 | |
14 | 14 | } |
15 | 15 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $view->bean = new User(); |
23 | 23 | $view->ss = new Sugar_Smarty(); |
24 | 24 | $view->preDisplay(); |
25 | - $this->assertInstanceOf('DetailView2',$view->dv); |
|
25 | + $this->assertInstanceOf('DetailView2', $view->dv); |
|
26 | 26 | $this->asserttrue(is_array($view->dv->defs)); |
27 | 27 | |
28 | 28 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $view->bean = new Meeting(); |
33 | 33 | $view->ss = new Sugar_Smarty(); |
34 | 34 | $view->preDisplay(); |
35 | - $this->assertInstanceOf('DetailView2',$view->dv); |
|
35 | + $this->assertInstanceOf('DetailView2', $view->dv); |
|
36 | 36 | $this->asserttrue(is_array($view->dv->defs)); |
37 | 37 | |
38 | 38 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $view->display(); |
55 | 55 | $renderedContent = ob_get_contents(); |
56 | 56 | ob_end_clean(); |
57 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
57 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
58 | 58 | |
59 | 59 | } |
60 | 60 | } |
@@ -15,10 +15,10 @@ |
||
15 | 15 | $renderedContent = ob_get_contents(); |
16 | 16 | ob_end_clean(); |
17 | 17 | |
18 | - $this->assertAttributeEquals('noaccess','type', $view); |
|
19 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
18 | + $this->assertAttributeEquals('noaccess', 'type', $view); |
|
19 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
20 | 20 | |
21 | - $this->assertEquals(False,json_decode($renderedContent)); //check that it doesn't return json. |
|
21 | + $this->assertEquals(False, json_decode($renderedContent)); //check that it doesn't return json. |
|
22 | 22 | |
23 | 23 | } |
24 | 24 | } |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | //execute the contructor and check for the Object type and options attribute |
9 | 9 | $view = new ViewModulelistmenu(); |
10 | 10 | |
11 | - $this->assertInstanceOf('ViewModulelistmenu',$view); |
|
12 | - $this->assertInstanceOf('SugarView',$view); |
|
11 | + $this->assertInstanceOf('ViewModulelistmenu', $view); |
|
12 | + $this->assertInstanceOf('SugarView', $view); |
|
13 | 13 | $this->assertTrue(is_array($view->options)); |
14 | 14 | |
15 | 15 | } |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | $renderedContent = ob_get_contents(); |
26 | 26 | ob_end_clean(); |
27 | 27 | |
28 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
29 | - $this->assertEquals(false,is_array($renderedContent)); |
|
28 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
29 | + $this->assertEquals(false, is_array($renderedContent)); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | ?> |