@@ -3,18 +3,18 @@ discard block |
||
3 | 3 | class ViewPopupTest extends PHPUnit_Framework_TestCase |
4 | 4 | { |
5 | 5 | |
6 | - public function testViewPopup(){ |
|
6 | + public function testViewPopup() { |
|
7 | 7 | |
8 | 8 | //execute the contructor and check for the Object type and type attribute |
9 | 9 | $view = new ViewPopup(); |
10 | - $this->assertInstanceOf('ViewPopup',$view); |
|
11 | - $this->assertInstanceOf('SugarView',$view); |
|
12 | - $this->assertAttributeEquals('list','type', $view); |
|
10 | + $this->assertInstanceOf('ViewPopup', $view); |
|
11 | + $this->assertInstanceOf('SugarView', $view); |
|
12 | + $this->assertAttributeEquals('list', 'type', $view); |
|
13 | 13 | |
14 | 14 | unset($view); |
15 | 15 | } |
16 | 16 | |
17 | - public function testdisplay(){ |
|
17 | + public function testdisplay() { |
|
18 | 18 | |
19 | 19 | //error_reporting(E_ERROR | E_PARSE |E_ALL); |
20 | 20 | |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | $view = new ViewPopup(); |
23 | 23 | $view->module = "Accounts"; |
24 | 24 | |
25 | - try{ |
|
25 | + try { |
|
26 | 26 | $view->bean = new Account(); |
27 | 27 | } |
28 | - Catch(Exception $e){ |
|
29 | - $this->assertStringStartsWith('mysqli_query()',$e->getMessage()); |
|
28 | + Catch (Exception $e) { |
|
29 | + $this->assertStringStartsWith('mysqli_query()', $e->getMessage()); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | ob_start(); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $renderedContent = ob_get_contents(); |
37 | 37 | ob_end_clean(); |
38 | 38 | |
39 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
39 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
40 | 40 | |
41 | 41 | } |
42 | 42 | } |
@@ -2,17 +2,17 @@ |
||
2 | 2 | |
3 | 3 | class ViewJsonTest extends PHPUnit_Framework_TestCase |
4 | 4 | { |
5 | - function testViewJson(){ |
|
5 | + function testViewJson() { |
|
6 | 6 | |
7 | 7 | //execute the contructor and check for the Object type and type attribute |
8 | 8 | $view = new ViewJson(); |
9 | - $this->assertInstanceOf('ViewJson',$view); |
|
10 | - $this->assertInstanceOf('SugarView',$view); |
|
11 | - $this->assertAttributeEquals('detail','type', $view); |
|
9 | + $this->assertInstanceOf('ViewJson', $view); |
|
10 | + $this->assertInstanceOf('SugarView', $view); |
|
11 | + $this->assertAttributeEquals('detail', 'type', $view); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | //incomplete test. this method uses exit() so it cannot be tested. |
15 | - function testdisplay(){ |
|
15 | + function testdisplay() { |
|
16 | 16 | |
17 | 17 | /* |
18 | 18 | setup required paramerers and execute the method. |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | class ViewHtmlTest extends PHPUnit_Framework_TestCase |
4 | 4 | { |
5 | 5 | |
6 | - public function testViewHtml(){ |
|
6 | + public function testViewHtml() { |
|
7 | 7 | |
8 | 8 | //execute the contructor and check for the Object type |
9 | 9 | $view = new ViewHtml(); |
10 | - $this->assertInstanceOf('ViewHtml',$view); |
|
11 | - $this->assertInstanceOf('SugarView',$view); |
|
10 | + $this->assertInstanceOf('ViewHtml', $view); |
|
11 | + $this->assertInstanceOf('SugarView', $view); |
|
12 | 12 | |
13 | 13 | |
14 | 14 | } |
15 | 15 | |
16 | - public function testdisplay(){ |
|
16 | + public function testdisplay() { |
|
17 | 17 | |
18 | 18 | $view = new ViewHtml(); |
19 | 19 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | try { |
22 | 22 | $view->display(); |
23 | 23 | |
24 | - } catch (Exception $e) { |
|
24 | + }catch (Exception $e) { |
|
25 | 25 | $this->fail(); |
26 | 26 | } |
27 | 27 | } |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -class ViewSugarpdfTest extends PHPUnit_Framework_TestCase{ |
|
4 | +class ViewSugarpdfTest extends PHPUnit_Framework_TestCase { |
|
5 | 5 | |
6 | 6 | |
7 | - function testViewSugarpdf(){ |
|
7 | + function testViewSugarpdf() { |
|
8 | 8 | error_reporting(E_ERROR | E_WARNING | E_PARSE); |
9 | 9 | |
10 | 10 | //execute the method without request parameters and test if it works. it should output some headers and throw headers output exception. |
11 | 11 | try { |
12 | 12 | $view = new ViewSugarpdf(); |
13 | 13 | |
14 | - } catch (Exception $e) { |
|
15 | - $this->assertStringStartsWith('Cannot modify header information',$e->getMessage()); |
|
14 | + }catch (Exception $e) { |
|
15 | + $this->assertStringStartsWith('Cannot modify header information', $e->getMessage()); |
|
16 | 16 | |
17 | 17 | } |
18 | - $this->assertEquals(Null,$view); |
|
18 | + $this->assertEquals(Null, $view); |
|
19 | 19 | |
20 | 20 | |
21 | 21 | |
@@ -23,22 +23,22 @@ discard block |
||
23 | 23 | $_REQUEST["sugarpdf"] = 'someValue'; |
24 | 24 | $view = new ViewSugarpdf(); |
25 | 25 | $view->module = "Users"; |
26 | - $this->assertInstanceOf('ViewSugarpdf',$view); |
|
27 | - $this->assertInstanceOf('SugarView',$view); |
|
28 | - $this->assertAttributeEquals('sugarpdf','type', $view); |
|
29 | - $this->assertAttributeEquals('someValue','sugarpdf', $view); |
|
30 | - $this->assertAttributeEquals(NULL,'sugarpdfBean', $view); |
|
26 | + $this->assertInstanceOf('ViewSugarpdf', $view); |
|
27 | + $this->assertInstanceOf('SugarView', $view); |
|
28 | + $this->assertAttributeEquals('sugarpdf', 'type', $view); |
|
29 | + $this->assertAttributeEquals('someValue', 'sugarpdf', $view); |
|
30 | + $this->assertAttributeEquals(NULL, 'sugarpdfBean', $view); |
|
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | 35 | //Incomplete test. SugarpdfFactory::loadSugarpdf throws fatal error. error needs to be resolved before testing. |
36 | - function testpreDisplay(){ |
|
36 | + function testpreDisplay() { |
|
37 | 37 | $this->markTestIncomplete('Can Not be implemented'); |
38 | 38 | } |
39 | 39 | |
40 | 40 | //Incomplete test. SugarpdfFactory::loadSugarpdf throws fatal error. error needs to be resolved before testing. |
41 | - function testdisplay(){ |
|
41 | + function testdisplay() { |
|
42 | 42 | $this->markTestIncomplete('Can Not be implemented'); |
43 | 43 | } |
44 | 44 |
@@ -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 ViewImportvcard(); |
10 | - $this->assertInstanceOf('ViewImportvcard',$view); |
|
11 | - $this->assertInstanceOf('SugarView',$view); |
|
12 | - $this->assertAttributeEquals('edit','type', $view); |
|
10 | + $this->assertInstanceOf('ViewImportvcard', $view); |
|
11 | + $this->assertInstanceOf('SugarView', $view); |
|
12 | + $this->assertAttributeEquals('edit', 'type', $view); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $view->display(); |
26 | 26 | $renderedContent = ob_get_contents(); |
27 | 27 | ob_end_clean(); |
28 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
28 | + $this->assertGreaterThan(0, strlen($renderedContent)); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | } |
@@ -7,24 +7,24 @@ discard block |
||
7 | 7 | { |
8 | 8 | //test for invalid input |
9 | 9 | $sugarmodule = new SugarModule(''); |
10 | - $this->assertAttributeEquals(null,'_moduleName', $sugarmodule); |
|
10 | + $this->assertAttributeEquals(null, '_moduleName', $sugarmodule); |
|
11 | 11 | |
12 | 12 | //test for valid input |
13 | 13 | $sugarmodule_user = SugarModule::get('User'); |
14 | - $this->assertAttributeEquals('User','_moduleName', $sugarmodule_user); |
|
14 | + $this->assertAttributeEquals('User', '_moduleName', $sugarmodule_user); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | public function testget() |
18 | 18 | { |
19 | 19 | //test for invalid input |
20 | 20 | $sugarmodule = SugarModule::get(''); |
21 | - $this->assertInstanceOf('SugarModule',$sugarmodule); |
|
22 | - $this->assertAttributeEquals(null,'_moduleName', $sugarmodule); |
|
21 | + $this->assertInstanceOf('SugarModule', $sugarmodule); |
|
22 | + $this->assertAttributeEquals(null, '_moduleName', $sugarmodule); |
|
23 | 23 | |
24 | 24 | //test for valid input |
25 | 25 | $sugarmodule_user = SugarModule::get('User'); |
26 | - $this->assertInstanceOf('SugarModule',$sugarmodule_user); |
|
27 | - $this->assertAttributeEquals('User','_moduleName', $sugarmodule_user); |
|
26 | + $this->assertInstanceOf('SugarModule', $sugarmodule_user); |
|
27 | + $this->assertAttributeEquals('User', '_moduleName', $sugarmodule_user); |
|
28 | 28 | |
29 | 29 | } |
30 | 30 | |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | //test for invalid input |
34 | 34 | $sugarmodule = new SugarModule(''); |
35 | 35 | $result = $sugarmodule->moduleImplements('Basic'); |
36 | - $this->assertEquals( false, $result); |
|
36 | + $this->assertEquals(false, $result); |
|
37 | 37 | |
38 | 38 | //test for invalid input |
39 | 39 | $sugarmodule_user = new SugarModule('Users'); |
40 | 40 | $result = $sugarmodule_user->moduleImplements('SugarModule'); |
41 | - $this->assertFalse( $result); |
|
41 | + $this->assertFalse($result); |
|
42 | 42 | |
43 | 43 | //test for valid input |
44 | 44 | $sugarmodule_user = new SugarModule('Users'); |
45 | 45 | $result = $sugarmodule_user->moduleImplements('Basic'); |
46 | - $this->assertEquals( true, $result); |
|
46 | + $this->assertEquals(true, $result); |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | //test for invalid input |
54 | 54 | $sugarmodule = new SugarModule(''); |
55 | 55 | $result = $sugarmodule->loadBean(); |
56 | - $this->assertFalse( $result); |
|
56 | + $this->assertFalse($result); |
|
57 | 57 | |
58 | 58 | //test for valid input |
59 | 59 | $sugarmodule_user = new SugarModule('Users'); |
60 | 60 | $result = $sugarmodule_user->loadBean(); |
61 | - $this->assertInstanceOf('User',$result); |
|
61 | + $this->assertInstanceOf('User', $result); |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | } |
@@ -4,16 +4,16 @@ |
||
4 | 4 | class ControllerFactoryTest extends PHPUnit_Framework_TestCase |
5 | 5 | { |
6 | 6 | |
7 | - public function testgetController(){ |
|
7 | + public function testgetController() { |
|
8 | 8 | |
9 | 9 | //execute the method with invalid input |
10 | 10 | $controller = ControllerFactory::getController(''); |
11 | - $this->assertInstanceOf('SugarController',$controller); |
|
11 | + $this->assertInstanceOf('SugarController', $controller); |
|
12 | 12 | |
13 | 13 | //execute the method with valid input and check if it returns correct instance |
14 | 14 | $controller = ControllerFactory::getController('Users'); |
15 | - $this->assertInstanceOf('UsersController',$controller); |
|
16 | - $this->assertInstanceOf('SugarController',$controller); |
|
15 | + $this->assertInstanceOf('UsersController', $controller); |
|
16 | + $this->assertInstanceOf('SugarController', $controller); |
|
17 | 17 | |
18 | 18 | } |
19 | 19 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | class SugarControllerTest extends PHPUnit_Framework_TestCase |
5 | 5 | { |
6 | 6 | |
7 | - public function testsetup(){ |
|
7 | + public function testsetup() { |
|
8 | 8 | |
9 | 9 | |
10 | 10 | $SugarController = new SugarController(); |
@@ -12,27 +12,27 @@ discard block |
||
12 | 12 | |
13 | 13 | //first test with empty parameter and check for default values being used |
14 | 14 | $SugarController->setup(''); |
15 | - $this->assertAttributeEquals($default_module,'module', $SugarController); |
|
16 | - $this->assertAttributeEquals(null,'target_module', $SugarController); |
|
15 | + $this->assertAttributeEquals($default_module, 'module', $SugarController); |
|
16 | + $this->assertAttributeEquals(null, 'target_module', $SugarController); |
|
17 | 17 | |
18 | 18 | //secondly test with module name and check for correct assignment. |
19 | 19 | $SugarController->setup('Users'); |
20 | - $this->assertAttributeEquals('Users','module', $SugarController); |
|
21 | - $this->assertAttributeEquals(null,'target_module', $SugarController); |
|
20 | + $this->assertAttributeEquals('Users', 'module', $SugarController); |
|
21 | + $this->assertAttributeEquals(null, 'target_module', $SugarController); |
|
22 | 22 | |
23 | 23 | |
24 | 24 | } |
25 | 25 | |
26 | - public function testsetModule(){ |
|
26 | + public function testsetModule() { |
|
27 | 27 | $SugarController = new SugarController(); |
28 | 28 | |
29 | 29 | //first test with empty parameter |
30 | 30 | $SugarController->setModule(''); |
31 | - $this->assertAttributeEquals('','module', $SugarController); |
|
31 | + $this->assertAttributeEquals('', 'module', $SugarController); |
|
32 | 32 | |
33 | 33 | //secondly test with module name and check for correct assignment. |
34 | 34 | $SugarController->setModule('Users'); |
35 | - $this->assertAttributeEquals('Users','module', $SugarController); |
|
35 | + $this->assertAttributeEquals('Users', 'module', $SugarController); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | //first test with empty parameter and check for null. Default is Home but Home has no bean |
44 | 44 | $SugarController->setModule(''); |
45 | 45 | $SugarController->loadBean(); |
46 | - $this->assertEquals(null,$SugarController->bean ); |
|
46 | + $this->assertEquals(null, $SugarController->bean); |
|
47 | 47 | |
48 | 48 | //secondly test with module name and check for correct bean class loaded. |
49 | 49 | $SugarController->setModule('Users'); |
50 | 50 | $SugarController->loadBean(); |
51 | - $this->assertInstanceOf('User',$SugarController->bean); |
|
51 | + $this->assertInstanceOf('User', $SugarController->bean); |
|
52 | 52 | |
53 | 53 | } |
54 | 54 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | //execute the method and check if it works and doesn't throws an exception |
61 | 61 | try { |
62 | 62 | $SugarController->execute(); |
63 | - } catch (Exception $e) { |
|
63 | + }catch (Exception $e) { |
|
64 | 64 | $this->fail(); |
65 | 65 | } |
66 | 66 | |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | |
72 | - public function testprocess(){ |
|
72 | + public function testprocess() { |
|
73 | 73 | |
74 | 74 | $SugarController = new SugarController(); |
75 | 75 | |
76 | 76 | //execute the method and check if it works and doesn't throws an exception |
77 | 77 | try { |
78 | 78 | $SugarController->process(); |
79 | - } catch (Exception $e) { |
|
79 | + }catch (Exception $e) { |
|
80 | 80 | $this->fail(); |
81 | 81 | } |
82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | |
88 | - public function testpre_save(){ |
|
88 | + public function testpre_save() { |
|
89 | 89 | |
90 | 90 | $SugarController = new SugarController(); |
91 | 91 | $SugarController->setModule('Users'); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | //Fail if it throws any other exception. |
96 | 96 | try { |
97 | 97 | $SugarController->pre_save(); |
98 | - } catch (Exception $e) { |
|
98 | + }catch (Exception $e) { |
|
99 | 99 | $this->assertStringStartsWith('mysqli_query()', $e->getMessage()); |
100 | 100 | } |
101 | 101 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | |
107 | - public function testaction_save(){ |
|
107 | + public function testaction_save() { |
|
108 | 108 | |
109 | 109 | $SugarController = new SugarController(); |
110 | 110 | $SugarController->setModule('Users'); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | //Fail if it throws any other exception. |
115 | 115 | try { |
116 | 116 | $SugarController->action_save(); |
117 | - } catch (Exception $e) { |
|
117 | + }catch (Exception $e) { |
|
118 | 118 | $this->assertStringStartsWith('mysqli_query()', $e->getMessage()); |
119 | 119 | } |
120 | 120 | |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | $SugarController = new SugarController(); |
129 | 129 | |
130 | 130 | //first check with default value of attribute |
131 | - $this->assertAttributeEquals('classic','view', $SugarController); |
|
131 | + $this->assertAttributeEquals('classic', 'view', $SugarController); |
|
132 | 132 | |
133 | 133 | //secondly check for attribute value change on method execution. |
134 | 134 | $SugarController->action_spot(); |
135 | - $this->assertAttributeEquals('spot','view', $SugarController); |
|
135 | + $this->assertAttributeEquals('spot', 'view', $SugarController); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -140,11 +140,11 @@ discard block |
||
140 | 140 | |
141 | 141 | //first check with a invalid value |
142 | 142 | $action = SugarController::getActionFilename(''); |
143 | - $this->assertEquals('',$action ); |
|
143 | + $this->assertEquals('', $action); |
|
144 | 144 | |
145 | 145 | //secondly check with a valid value |
146 | 146 | $action = SugarController::getActionFilename('editview'); |
147 | - $this->assertEquals('EditView',$action ); |
|
147 | + $this->assertEquals('EditView', $action); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | //execute the method and test it it returns expected contents |
11 | 11 | |
12 | 12 | $user = new User('1'); |
13 | - $expected = array ( |
|
13 | + $expected = array( |
|
14 | 14 | 'Home' => 'Home', |
15 | 15 | 'Accounts' => 'Accounts', |
16 | 16 | 'Contacts' => 'Contacts', |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | ); |
49 | 49 | |
50 | 50 | $actual = query_module_access_list($user); |
51 | - $this->assertSame($expected,$actual); |
|
51 | + $this->assertSame($expected, $actual); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | $expected = "0"; |
63 | 63 | $actual = query_user_has_roles('1'); |
64 | - $this->assertSame($expected,$actual); |
|
64 | + $this->assertSame($expected, $actual); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $expected = Array(); |
73 | 73 | $actual = get_user_allowed_modules('1'); |
74 | - $this->assertSame($expected,$actual); |
|
74 | + $this->assertSame($expected, $actual); |
|
75 | 75 | |
76 | 76 | } |
77 | 77 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | //execute the method and test it it returns expected contents |
81 | 81 | |
82 | - $expected = array ( |
|
82 | + $expected = array( |
|
83 | 83 | 'Bugs' => 'Bugs', |
84 | 84 | 'Reminders' => 'Reminders', |
85 | 85 | 'Reminders_Invitees' => 'Reminders_Invitees', |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | ); |
89 | 89 | |
90 | 90 | $allowed = query_module_access_list(new User('1')); |
91 | - $actual = get_user_disallowed_modules('1',$allowed); |
|
91 | + $actual = get_user_disallowed_modules('1', $allowed); |
|
92 | 92 | |
93 | - $this->assertSame($expected,$actual); |
|
93 | + $this->assertSame($expected, $actual); |
|
94 | 94 | |
95 | 95 | |
96 | 96 | } |
@@ -98,17 +98,17 @@ discard block |
||
98 | 98 | public function testquery_client_ip() |
99 | 99 | { |
100 | 100 | //test without setting any server parameters |
101 | - $this->assertSame(Null,query_client_ip()); |
|
101 | + $this->assertSame(Null, query_client_ip()); |
|
102 | 102 | |
103 | 103 | //test with server params set |
104 | 104 | $_SERVER['REMOTE_ADDR'] = "1.1.1.3"; |
105 | - $this->assertSame("1.1.1.3",query_client_ip()); |
|
105 | + $this->assertSame("1.1.1.3", query_client_ip()); |
|
106 | 106 | |
107 | 107 | $_SERVER['HTTP_FROM'] = "1.1.1.2"; |
108 | - $this->assertSame("1.1.1.2",query_client_ip()); |
|
108 | + $this->assertSame("1.1.1.2", query_client_ip()); |
|
109 | 109 | |
110 | 110 | $_SERVER['HTTP_CLIENT_IP'] = "1.1.1.1"; |
111 | - $this->assertSame("1.1.1.1",query_client_ip()); |
|
111 | + $this->assertSame("1.1.1.1", query_client_ip()); |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | public function testget_val_array() |
117 | 117 | { |
118 | 118 | //execute the method and test it it returns expected contents |
119 | - $tempArray = Array("key1"=>"val1","key2"=>"val2","key3"=>"val3"); |
|
120 | - $expected = Array("key1"=>"key1","key2"=>"key2","key3"=>"key3"); |
|
119 | + $tempArray = Array("key1"=>"val1", "key2"=>"val2", "key3"=>"val3"); |
|
120 | + $expected = Array("key1"=>"key1", "key2"=>"key2", "key3"=>"key3"); |
|
121 | 121 | $actual = get_val_array($tempArray); |
122 | - $this->assertSame($expected,$actual); |
|
122 | + $this->assertSame($expected, $actual); |
|
123 | 123 | |
124 | 124 | } |
125 | 125 |