Completed
Push — CI ( ee6bd7...0f01dd )
by Adam
22:32
created
tests/tests/include/utils/encryptionUtilsTest.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -4,48 +4,48 @@  discard block
 block discarded – undo
4 4
 class encryption_utilsTest extends PHPUnit_Framework_TestCase
5 5
 {
6 6
 	
7
-	public function testsugarEncode(){
7
+	public function testsugarEncode() {
8 8
 
9 9
 		//execute the method and test if it returns expected values
10 10
 		//key param does nothing currently.
11 11
 		
12 12
 		//blank key and data
13
-		$expected ="";
14
-		$actual = sugarEncode("","");
15
-		$this->assertSame($expected,$actual);
13
+		$expected = "";
14
+		$actual = sugarEncode("", "");
15
+		$this->assertSame($expected, $actual);
16 16
 				
17 17
 		//blank key and valid data
18
-		$expected ="RGF0YQ==";
19
-		$actual = sugarEncode("","Data");
20
-		$this->assertSame($expected,$actual);
18
+		$expected = "RGF0YQ==";
19
+		$actual = sugarEncode("", "Data");
20
+		$this->assertSame($expected, $actual);
21 21
 					
22 22
 		//valid key and data
23
-		$expected ="RGF0YQ==";
24
-		$actual = sugarEncode("key","Data");
25
-		$this->assertSame($expected,$actual);
23
+		$expected = "RGF0YQ==";
24
+		$actual = sugarEncode("key", "Data");
25
+		$this->assertSame($expected, $actual);
26 26
 		
27 27
 	}
28 28
 	
29 29
 	
30
-	public function testsugarDecode(){
30
+	public function testsugarDecode() {
31 31
 
32 32
 		//execute the method and test if it returns expected values
33 33
 		//key param does nothing currently.
34 34
 		
35 35
 		//blank key and data
36
-		$expected ="";
37
-		$actual = sugarDecode("","");
38
-		$this->assertSame($expected,$actual);
36
+		$expected = "";
37
+		$actual = sugarDecode("", "");
38
+		$this->assertSame($expected, $actual);
39 39
 		
40 40
 		//blank key and valid data
41
-		$expected ="Data";
42
-		$actual = sugarDecode("","RGF0YQ==");
43
-		$this->assertSame($expected,$actual);
41
+		$expected = "Data";
42
+		$actual = sugarDecode("", "RGF0YQ==");
43
+		$this->assertSame($expected, $actual);
44 44
 			
45 45
 		//valid key and data
46
-		$expected ="Data";
47
-		$actual = sugarDecode("key","RGF0YQ==");
48
-		$this->assertSame($expected,$actual);
46
+		$expected = "Data";
47
+		$actual = sugarDecode("key", "RGF0YQ==");
48
+		$this->assertSame($expected, $actual);
49 49
 		
50 50
 		
51 51
 	}
@@ -57,50 +57,50 @@  discard block
 block discarded – undo
57 57
 		
58 58
 		//test key
59 59
 		$actual = blowfishGetKey('test');
60
-		$this->assertGreaterThanOrEqual(36,strlen($actual));
60
+		$this->assertGreaterThanOrEqual(36, strlen($actual));
61 61
 		//var_dump($actual);
62 62
 		
63 63
 		//default key
64 64
 		$actual = blowfishGetKey('rapelcg_svryq');
65
-		$this->assertGreaterThanOrEqual(36,strlen($actual)); 
65
+		$this->assertGreaterThanOrEqual(36, strlen($actual)); 
66 66
 		
67 67
 	}
68 68
 	
69 69
 	
70
-	public function testblowfishEncode(){
70
+	public function testblowfishEncode() {
71 71
 	
72 72
 		//execute the method and test if it returns expected values
73 73
 		//it won't work with blank key, will throw an error
74 74
 
75 75
 		//valid key and blank data
76
-		$expected ="";
77
-		$actual = blowfishEncode("test","");
78
-		$this->assertSame($expected,$actual);
76
+		$expected = "";
77
+		$actual = blowfishEncode("test", "");
78
+		$this->assertSame($expected, $actual);
79 79
 		
80 80
 		
81 81
 		//valid key and valid data
82
-		$expected ="HI1/88NJJss=";
83
-		$actual = blowfishEncode("test","Data");
84
-		$this->assertSame($expected,$actual);
82
+		$expected = "HI1/88NJJss=";
83
+		$actual = blowfishEncode("test", "Data");
84
+		$this->assertSame($expected, $actual);
85 85
 		
86 86
 	}
87 87
 	
88 88
 	
89
-	public function testblowfishDecode(){
89
+	public function testblowfishDecode() {
90 90
 	
91 91
 		//execute the method and test if it returns expected values
92 92
 		//it won't work with blank key, will throw an error.
93 93
 		
94 94
 		//valid key and blank data
95
-		$expected ="";
96
-		$actual = blowfishDecode("test","");
97
-		$this->assertSame($expected,$actual);
95
+		$expected = "";
96
+		$actual = blowfishDecode("test", "");
97
+		$this->assertSame($expected, $actual);
98 98
 		
99 99
 		
100 100
 		//valid key and valid data
101
-		$expected ="Data";
102
-		$actual = blowfishDecode("test","HI1/88NJJss=");
103
-		$this->assertSame($expected,$actual);
101
+		$expected = "Data";
102
+		$actual = blowfishDecode("test", "HI1/88NJJss=");
103
+		$this->assertSame($expected, $actual);
104 104
 				
105 105
 	}
106 106
 
Please login to merge, or discard this patch.
tests/tests/include/utils/arrayUtilsTest.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -8,80 +8,80 @@  discard block
 block discarded – undo
8 8
 	
9 9
 		//execute the method and test if it returns expected values
10 10
 		
11
-		$tempArray = Array( "Key1" => "value1" , "Key2" => "value2" );
11
+		$tempArray = Array("Key1" => "value1", "Key2" => "value2");
12 12
 		
13 13
 		$expected = "array (\n  'Key1' => 'value1',\n  'Key2' => 'value2',\n)";
14 14
 		$actual = var_export_helper($tempArray);
15
-		$this->assertSame($actual,$expected);
15
+		$this->assertSame($actual, $expected);
16 16
 	
17 17
 	}
18 18
 	
19
-	public function testoverride_value_to_string(){
19
+	public function testoverride_value_to_string() {
20 20
 	
21 21
 		//execute the method and test if it returns expected values
22 22
 		
23 23
 		$expected = "\$array_name['value_name'] = 'value';";
24
-		$actual =  override_value_to_string('array_name', 'value_name', 'value');
25
-		$this->assertSame($actual,$expected);
24
+		$actual = override_value_to_string('array_name', 'value_name', 'value');
25
+		$this->assertSame($actual, $expected);
26 26
 		
27 27
 	}
28 28
 	
29
-	public function testadd_blank_option(){
29
+	public function testadd_blank_option() {
30 30
 	
31 31
 		//execute the method with array not having any blank key value pair. function will return an array with blank key value pair added.
32
-		$tempArray = Array( "Key1" => "value1" , "Key2" => "value2" );
33
-		$expected = Array( "" => "" , "Key1" => "value1" , "Key2" => "value2" );
32
+		$tempArray = Array("Key1" => "value1", "Key2" => "value2");
33
+		$expected = Array("" => "", "Key1" => "value1", "Key2" => "value2");
34 34
 	
35
-		$actual =  add_blank_option($tempArray);
36
-		$this->assertSame($actual,$expected);
35
+		$actual = add_blank_option($tempArray);
36
+		$this->assertSame($actual, $expected);
37 37
 		
38 38
 		
39 39
 		//execute the method with array having a blank key value pair. function will return the same array back without any change.		
40
-		$tempArray = Array("" => "" , "Key1" => "value1" , "Key2" => "value2" );
41
-		$expected = Array( "" => "" , "Key1" => "value1" , "Key2" => "value2" );
40
+		$tempArray = Array("" => "", "Key1" => "value1", "Key2" => "value2");
41
+		$expected = Array("" => "", "Key1" => "value1", "Key2" => "value2");
42 42
 	
43
-		$actual =  add_blank_option($tempArray);
44
-		$this->assertSame($actual,$expected);
43
+		$actual = add_blank_option($tempArray);
44
+		$this->assertSame($actual, $expected);
45 45
 			
46 46
 	}
47 47
 	
48 48
 	
49
-	public function testoverride_value_to_string_recursive(){
49
+	public function testoverride_value_to_string_recursive() {
50 50
 	
51 51
 		//execute the method and test if it returns expected values
52 52
 		
53 53
 		//without keys
54
-		$tempArray = Array( "Key1" => "value1" , "Key2" => "value2" );
54
+		$tempArray = Array("Key1" => "value1", "Key2" => "value2");
55 55
 		$expected = "\$tempArray=array (\n  'Key1' => 'value1',\n  'Key2' => 'value2',\n);";
56
-		$actual =  override_value_to_string_recursive('','tempArray',$tempArray); 
57
-		$this->assertSame($actual,$expected);
56
+		$actual = override_value_to_string_recursive('', 'tempArray', $tempArray); 
57
+		$this->assertSame($actual, $expected);
58 58
 		
59 59
 		//with keys
60 60
 		$tempArray = Array();
61
-		$tempArray["Key1"]["Key2"] = Array( "Key3" => "value" , "Key4" => "value" );
61
+		$tempArray["Key1"]["Key2"] = Array("Key3" => "value", "Key4" => "value");
62 62
 		$expected = "\$tempArray['key1']['key2']=array (\n  'Key1' => \n  array (\n    'Key2' => \n    array (\n      'Key3' => 'value',\n      'Key4' => 'value',\n    ),\n  ),\n);";
63
-		$actual =  override_value_to_string_recursive(array('key1','key2'),'tempArray',$tempArray); 
63
+		$actual = override_value_to_string_recursive(array('key1', 'key2'), 'tempArray', $tempArray); 
64 64
 		//var_dump( nl2br($actual));
65
-		$this->assertSame($actual,$expected);
65
+		$this->assertSame($actual, $expected);
66 66
 		
67 67
 	}
68 68
 	
69
-	public function testoverride_recursive_helper(){
69
+	public function testoverride_recursive_helper() {
70 70
 	
71 71
 		//execute the method and test if it returns expected values
72 72
 		
73 73
 		//without keys
74
-		$tempArray = Array( "Key1" => "value1" , "Key2" => "value2" );
74
+		$tempArray = Array("Key1" => "value1", "Key2" => "value2");
75 75
 		$expected = "=array (\n  'Key1' => 'value1',\n  'Key2' => 'value2',\n);";
76
-		$actual =  override_recursive_helper('','tempArray',$tempArray);
77
-		$this->assertSame($actual,$expected);
76
+		$actual = override_recursive_helper('', 'tempArray', $tempArray);
77
+		$this->assertSame($actual, $expected);
78 78
 		
79 79
 		//with keys
80 80
 		$tempArray = Array();
81
-		$tempArray["Key1"]["Key2"] = Array( "Key3" => "value" , "Key4" => "value" );
81
+		$tempArray["Key1"]["Key2"] = Array("Key3" => "value", "Key4" => "value");
82 82
 		$expected = "['key1']['key2']=array (\n  'Key1' => \n  array (\n    'Key2' => \n    array (\n      'Key3' => 'value',\n      'Key4' => 'value',\n    ),\n  ),\n);";
83
-		$actual =  override_recursive_helper(array('key1','key2'),'tempArray',$tempArray); 
84
-		$this->assertSame($actual,$expected);
83
+		$actual = override_recursive_helper(array('key1', 'key2'), 'tempArray', $tempArray); 
84
+		$this->assertSame($actual, $expected);
85 85
 				
86 86
 		
87 87
 	}
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
 		
93 93
 		//null array
94 94
 		$expected = Null;
95
-		$actual =  override_value_to_string_recursive2( 'tempArray', 'key1','',false);
96
-		$this->assertSame($actual,$expected);
95
+		$actual = override_value_to_string_recursive2('tempArray', 'key1', '', false);
96
+		$this->assertSame($actual, $expected);
97 97
 		
98 98
 		 
99 99
 		//simple array
100
-		$tempArray = Array( "Key1" => "value1" , "Key2" => "value2" );
100
+		$tempArray = Array("Key1" => "value1", "Key2" => "value2");
101 101
 		$expected = "\$['tempArray']['Key1'] = 'value1';\n$['tempArray']['Key2'] = 'value2';\n";
102
-		$actual =  override_value_to_string_recursive2( '', 'tempArray', $tempArray);
103
-		$this->assertSame($actual,$expected);
102
+		$actual = override_value_to_string_recursive2('', 'tempArray', $tempArray);
103
+		$this->assertSame($actual, $expected);
104 104
 		
105 105
 		
106 106
 		//complex array
107 107
 		$tempArray = Array();
108
-		$tempArray["Key1"]["Key2"] = Array( "Key3" => "value" , "Key4" => "value" );
108
+		$tempArray["Key1"]["Key2"] = Array("Key3" => "value", "Key4" => "value");
109 109
 		$expected = "\$tempArray['key1']['Key2']['Key3'] = 'value';\n\$tempArray['key1']['Key2']['Key4'] = 'value';\n";
110
-		$actual =  override_value_to_string_recursive2('tempArray','key1',$tempArray["Key1"]);  
111
-		$this->assertSame($actual,$expected);
110
+		$actual = override_value_to_string_recursive2('tempArray', 'key1', $tempArray["Key1"]);  
111
+		$this->assertSame($actual, $expected);
112 112
 	
113 113
 	}
114 114
 	
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
 		$obj = '';
122 122
 		$expected = '';
123 123
 		$actual = object_to_array_recursive($obj);
124
-		$this->assertSame($actual,$expected);
124
+		$this->assertSame($actual, $expected);
125 125
 		
126 126
 		//test with a valid object
127 127
 		$obj = new TimeDate();
128 128
 		$expected = Array('dbDayFormat' => 'Y-m-d', 'dbTimeFormat' => 'H:i:s', 'allow_cache' => true); 
129 129
 		$actual = object_to_array_recursive($obj);
130 130
 		
131
-		$this->assertSame($actual,$expected);
131
+		$this->assertSame($actual, $expected);
132 132
 		
133 133
 	}
134 134
 
@@ -137,43 +137,43 @@  discard block
 block discarded – undo
137 137
 		//execute the method and test if it returns expected values
138 138
 		
139 139
 		//same simple arrays
140
-		$tempArray1 = Array( "Key1" => "value1" , "Key2" => "value2" );
141
-		$tempArray2 = Array( "Key1" => "value1" , "Key2" => "value2" );
140
+		$tempArray1 = Array("Key1" => "value1", "Key2" => "value2");
141
+		$tempArray2 = Array("Key1" => "value1", "Key2" => "value2");
142 142
 		$expected = Array();
143
-		$actual =  deepArrayDiff( $tempArray1, $tempArray2);
144
-		$this->assertSame($actual,$expected);
143
+		$actual = deepArrayDiff($tempArray1, $tempArray2);
144
+		$this->assertSame($actual, $expected);
145 145
 		
146 146
 		
147 147
 		//different simple arrays
148
-		$tempArray1 = Array( "Key1" => "value1" , "Key2" => "value2" );
149
-		$tempArray2 = Array( "Key1" => "value1" , "Key2" => "value3" );
150
-		$expected = Array( "Key2" => "value2");
151
-		$actual =  deepArrayDiff( $tempArray1, $tempArray2);
152
-		$this->assertSame($actual,$expected);
148
+		$tempArray1 = Array("Key1" => "value1", "Key2" => "value2");
149
+		$tempArray2 = Array("Key1" => "value1", "Key2" => "value3");
150
+		$expected = Array("Key2" => "value2");
151
+		$actual = deepArrayDiff($tempArray1, $tempArray2);
152
+		$this->assertSame($actual, $expected);
153 153
 		
154 154
 
155 155
 		//same complex arrays
156
-		$tempArray1 = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" ));
157
-		$tempArray2 = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" ));
156
+		$tempArray1 = Array("Key1" => Array("Key2" => "value2", "Key3" => "value3"));
157
+		$tempArray2 = Array("Key1" => Array("Key2" => "value2", "Key3" => "value3"));
158 158
 		$expected = Array();
159
-		$actual =  deepArrayDiff( $tempArray1, $tempArray2);
160
-		$this->assertSame($actual,$expected);
159
+		$actual = deepArrayDiff($tempArray1, $tempArray2);
160
+		$this->assertSame($actual, $expected);
161 161
 		
162 162
 		
163 163
 		//complex arrays with different root node
164
-		$tempArray1 = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" ));
165
-		$tempArray2 = Array("Key2" => Array( "Key2" => "value2" , "Key3" => "value3" ));
166
-		$expected = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" ));
167
-		$actual =  deepArrayDiff( $tempArray1, $tempArray2);
168
-		$this->assertSame($actual,$expected);
164
+		$tempArray1 = Array("Key1" => Array("Key2" => "value2", "Key3" => "value3"));
165
+		$tempArray2 = Array("Key2" => Array("Key2" => "value2", "Key3" => "value3"));
166
+		$expected = Array("Key1" => Array("Key2" => "value2", "Key3" => "value3"));
167
+		$actual = deepArrayDiff($tempArray1, $tempArray2);
168
+		$this->assertSame($actual, $expected);
169 169
 		
170 170
 		
171 171
 		//complex arrays with different child node
172
-		$tempArray1 = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" ));
173
-		$tempArray2 = Array("Key1" => Array( "Key2" => "value2" , "Key4" => "value4" ));
174
-		$expected = Array("Key1" => Array( "Key3" => "value3" ));
175
-		$actual =  deepArrayDiff( $tempArray1, $tempArray2);
176
-		$this->assertSame($actual,$expected);
172
+		$tempArray1 = Array("Key1" => Array("Key2" => "value2", "Key3" => "value3"));
173
+		$tempArray2 = Array("Key1" => Array("Key2" => "value2", "Key4" => "value4"));
174
+		$expected = Array("Key1" => Array("Key3" => "value3"));
175
+		$actual = deepArrayDiff($tempArray1, $tempArray2);
176
+		$this->assertSame($actual, $expected);
177 177
 
178 178
 	}
179 179
 	
@@ -183,17 +183,17 @@  discard block
 block discarded – undo
183 183
 		//execute the method and test if it returns expected values
184 184
 		
185 185
 		//add to existing array
186
-		$tempArray = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" ));
187
-		$expected = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" ),"key4" => "value4" );
188
-		setDeepArrayValue( $tempArray, "key4","value4");
189
-		$this->assertSame($tempArray,$expected);
186
+		$tempArray = Array("Key1" => Array("Key2" => "value2", "Key3" => "value3"));
187
+		$expected = Array("Key1" => Array("Key2" => "value2", "Key3" => "value3"), "key4" => "value4");
188
+		setDeepArrayValue($tempArray, "key4", "value4");
189
+		$this->assertSame($tempArray, $expected);
190 190
 		
191 191
 		//add to empty array
192 192
 		$tempArray = Array();
193
-		$expected = Array("key1" => Array( "key2" => Array("key3" => "value3")) );
194
-		setDeepArrayValue( $tempArray, "key1_key2_key3","value3");
193
+		$expected = Array("key1" => Array("key2" => Array("key3" => "value3")));
194
+		setDeepArrayValue($tempArray, "key1_key2_key3", "value3");
195 195
 		//var_dump($tempArray);
196
-		$this->assertSame($tempArray,$expected);
196
+		$this->assertSame($tempArray, $expected);
197 197
 		
198 198
 	}
199 199
 
@@ -202,17 +202,17 @@  discard block
 block discarded – undo
202 202
 		//execute the method and test if it returns expected values
203 203
 		
204 204
 		//try with two different length arrays
205
-		$tempArray1 = Array("v1", "v2" , "v3" );
206
-		$tempArray2 = Array("v4", "v5" );
207
-		$actual = array_merge_values( $tempArray1,  $tempArray2);		
205
+		$tempArray1 = Array("v1", "v2", "v3");
206
+		$tempArray2 = Array("v4", "v5");
207
+		$actual = array_merge_values($tempArray1, $tempArray2);		
208 208
 		$this->assertFalse($actual);
209 209
 		
210 210
 		//try with same length arrays.
211
-		$tempArray1 = Array("v1", "v2" , "v3" );
212
-		$tempArray2 = Array("v4", "v5" , "v6" );
211
+		$tempArray1 = Array("v1", "v2", "v3");
212
+		$tempArray2 = Array("v4", "v5", "v6");
213 213
 		$expected = array("v1v4", "v2v5", "v3v6");
214
-		$actual = array_merge_values( $tempArray1,  $tempArray2);
215
-		$this->assertSame($expected,$actual);
214
+		$actual = array_merge_values($tempArray1, $tempArray2);
215
+		$this->assertSame($expected, $actual);
216 216
 	}
217 217
 	
218 218
 	
@@ -221,19 +221,19 @@  discard block
 block discarded – undo
221 221
 		//execute the method and test if it returns expected value
222 222
 		
223 223
 		//test with invalid input
224
-		$tempArray ="";
225
-		$actual = array_search_insensitive('',$tempArray);
224
+		$tempArray = "";
225
+		$actual = array_search_insensitive('', $tempArray);
226 226
 		$this->assertFalse($actual);
227 227
 		
228 228
 		
229 229
 		//test with invalid needle..
230
-		$tempArray = Array("Key1" => "value1", "Key2" => "value2" , "Key3" => "value3" ,"key4" => "value4" );
230
+		$tempArray = Array("Key1" => "value1", "Key2" => "value2", "Key3" => "value3", "key4" => "value4");
231 231
 		$actual = array_search_insensitive('', $tempArray);
232 232
 		$this->assertFalse($actual);
233 233
 		
234 234
 		
235 235
 		//test with valid needle and haystack.
236
-		$tempArray = Array("Key1" => "value1", "Key2" => "value2" , "Key3" => "value3" ,"key4" => "value4" );
236
+		$tempArray = Array("Key1" => "value1", "Key2" => "value2", "Key3" => "value3", "key4" => "value4");
237 237
 		$actual = array_search_insensitive('value4', $tempArray);
238 238
 		$this->assertTrue($actual);
239 239
 		
@@ -245,17 +245,17 @@  discard block
 block discarded – undo
245 245
     	//execute the method and test if it returns expected values
246 246
     	
247 247
     	//test for a top level key
248
-    	$tempArray = new SugarArray(Array("Key1" => Array("Key2" => "value2" , "Key3" => "value3") ,"key4" => "value4" ));
248
+    	$tempArray = new SugarArray(Array("Key1" => Array("Key2" => "value2", "Key3" => "value3"), "key4" => "value4"));
249 249
     	$expected = "value4";
250 250
     	$actual = $tempArray->get('key4');
251
-    	$this->assertSame($expected,$actual);
251
+    	$this->assertSame($expected, $actual);
252 252
     	
253 253
     	
254 254
     	//test for a child level key with dot notation
255
-    	$tempArray = new SugarArray(Array("key1" => Array("key2" => "value2" , "key3" => "value3") ,"key4" => "value4" ));
255
+    	$tempArray = new SugarArray(Array("key1" => Array("key2" => "value2", "key3" => "value3"), "key4" => "value4"));
256 256
     	$expected = "value3";
257 257
     	$actual = $tempArray->get('key1.key3');   	
258
-    	$this->assertSame($expected,$actual);
258
+    	$this->assertSame($expected, $actual);
259 259
     	
260 260
     }
261 261
 
@@ -264,17 +264,17 @@  discard block
 block discarded – undo
264 264
     	//execute the method and test if it returns expected values
265 265
     	
266 266
     	//test for a top level key
267
-    	$haystack = Array("key1" => Array("key2" => "value2" , "key3" => "value3") ,"key4" => "value4" );
267
+    	$haystack = Array("key1" => Array("key2" => "value2", "key3" => "value3"), "key4" => "value4");
268 268
     	$expected = "value4";
269
-    	$actual = SugarArray::staticGet($haystack,"key4");
270
-    	$this->assertSame($expected,$actual);
269
+    	$actual = SugarArray::staticGet($haystack, "key4");
270
+    	$this->assertSame($expected, $actual);
271 271
     	 
272 272
     	 
273 273
     	//test for a child level key with dot notation
274
-    	$haystack = Array("key1" => Array("key2" => "value2" , "key3" => "value3") ,"key4" => "value4" );
274
+    	$haystack = Array("key1" => Array("key2" => "value2", "key3" => "value3"), "key4" => "value4");
275 275
     	$expected = "value3";
276
-    	$actual = SugarArray::staticGet($haystack,'key1.key3');
277
-    	$this->assertSame($expected,$actual);
276
+    	$actual = SugarArray::staticGet($haystack, 'key1.key3');
277
+    	$this->assertSame($expected, $actual);
278 278
     	
279 279
     	
280 280
     }
Please login to merge, or discard this patch.
tests/tests/include/utils/mvcUtilsTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
 		//test without setting REQUEST param
25 25
 		$expected = "javascript:void window.open('index.php?','printwin','menubar=1,status=0,resizable=1,scrollbars=1,toolbar=0,location=1')";
26 26
 		$actual = getPrintLink();
27
-		$this->assertSame($expected,$actual);
27
+		$this->assertSame($expected, $actual);
28 28
 		
29 29
 		
30 30
 		//test with required REQUEST param set
31 31
 		$_REQUEST['action'] = "ajaxui";
32 32
 		$expected = "javascript:SUGAR.ajaxUI.print();";
33 33
 		$actual = getPrintLink();
34
-		$this->assertSame($expected,$actual);
34
+		$this->assertSame($expected, $actual);
35 35
 
36 36
 	}
37 37
 	
Please login to merge, or discard this patch.
tests/tests/modules/AOS_Product_Categories/AOS_Product_CategoriesTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@  discard block
 block discarded – undo
2 2
 
3 3
 class AOS_Product_CategoriesTest extends PHPUnit_Framework_TestCase {
4 4
 	
5
-	public function testAOS_Product_Categories(){	
5
+	public function testAOS_Product_Categories() {	
6 6
 		
7 7
 		//execute the contructor and check for the Object type and  attributes
8 8
 		$aosProductCategories = new AOS_Product_Categories();
9
-		$this->assertInstanceOf('AOS_Product_Categories',$aosProductCategories);
10
-		$this->assertInstanceOf('Basic',$aosProductCategories);
11
-		$this->assertInstanceOf('SugarBean',$aosProductCategories);
9
+		$this->assertInstanceOf('AOS_Product_Categories', $aosProductCategories);
10
+		$this->assertInstanceOf('Basic', $aosProductCategories);
11
+		$this->assertInstanceOf('SugarBean', $aosProductCategories);
12 12
 			
13 13
 		$this->assertAttributeEquals('AOS_Product_Categories', 'module_dir', $aosProductCategories);
14 14
 		$this->assertAttributeEquals('AOS_Product_Categories', 'object_name', $aosProductCategories);
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	}
21 21
 
22 22
   
23
-    public function testsave(){
23
+    public function testsave() {
24 24
  
25 25
     	error_reporting(E_ERROR | E_PARSE);
26 26
     	
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     	//mark the record as deleted and verify that this record cannot be retrieved anymore.
40 40
     	$aosProductCategories->mark_deleted($aosProductCategories->id);
41 41
     	$result = $aosProductCategories->retrieve($aosProductCategories->id);
42
-    	$this->assertEquals(null,$result);
42
+    	$this->assertEquals(null, $result);
43 43
     	
44 44
     }
45 45
     
Please login to merge, or discard this patch.
tests/tests/modules/AOS_Contracts/AOS_ContractsTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@  discard block
 block discarded – undo
2 2
 
3 3
 class AOS_ContractsTest extends PHPUnit_Framework_TestCase {
4 4
 	
5
-	public function testAOS_Contracts(){
5
+	public function testAOS_Contracts() {
6 6
 
7 7
 		//execute the contructor and check for the Object type and attributes
8 8
 		$aosContracts = new AOS_Contracts();
9
-		$this->assertInstanceOf('AOS_Contracts',$aosContracts);
10
-		$this->assertInstanceOf('Basic',$aosContracts);
11
-		$this->assertInstanceOf('SugarBean',$aosContracts);
9
+		$this->assertInstanceOf('AOS_Contracts', $aosContracts);
10
+		$this->assertInstanceOf('Basic', $aosContracts);
11
+		$this->assertInstanceOf('SugarBean', $aosContracts);
12 12
 			
13 13
 		$this->assertAttributeEquals('AOS_Contracts', 'module_dir', $aosContracts);
14 14
 		$this->assertAttributeEquals('AOS_Contracts', 'object_name', $aosContracts);
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		
22 22
 	}
23 23
 	
24
-	public function testsaveAndDelete(){
24
+	public function testsaveAndDelete() {
25 25
 	
26 26
 		error_reporting(E_ERROR | E_PARSE);
27 27
 		
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 		//mark the record as deleted and verify that this record cannot be retrieved anymore.
40 40
 		$aosContracts->mark_deleted($aosContracts->id);
41 41
 		$result = $aosContracts->retrieve($aosContracts->id);
42
-		$this->assertEquals(null,$result);
42
+		$this->assertEquals(null, $result);
43 43
 		
44 44
 	}
45 45
 	
46 46
 	
47
-	public function testCreateReminderAndCreateLinkAndDeleteCall(){
47
+	public function testCreateReminderAndCreateLinkAndDeleteCall() {
48 48
 
49 49
 		$call = new call();
50 50
 		
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		//delete the call and verify that this record cannot be retrieved anymore.		
74 74
 		$aosContracts->deleteCall();
75 75
 		$call->retrieve($aosContracts->call_id);
76
-		$this->assertEquals(null,$result);
76
+		$this->assertEquals(null, $result);
77 77
 		
78 78
 	}
79 79
 	
Please login to merge, or discard this patch.
tests/tests/modules/FP_Event_Locations/FP_Event_LocationsTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,14 +2,14 @@
 block discarded – undo
2 2
 
3 3
 class FP_Event_LocationsTest extends PHPUnit_Framework_TestCase {
4 4
 	
5
-	public function testFP_Event_Locations(){	
5
+	public function testFP_Event_Locations() {	
6 6
 
7 7
 		
8 8
 		//execute the contructor and check for the Object type and  attributes
9 9
 		$fpEventLoc = new FP_Event_Locations();
10
-		$this->assertInstanceOf('FP_Event_Locations',$fpEventLoc);
11
-		$this->assertInstanceOf('Basic',$fpEventLoc);
12
-		$this->assertInstanceOf('SugarBean',$fpEventLoc);
10
+		$this->assertInstanceOf('FP_Event_Locations', $fpEventLoc);
11
+		$this->assertInstanceOf('Basic', $fpEventLoc);
12
+		$this->assertInstanceOf('SugarBean', $fpEventLoc);
13 13
 		
14 14
 		$this->assertAttributeEquals('FP_Event_Locations', 'module_dir', $fpEventLoc);
15 15
 		$this->assertAttributeEquals('FP_Event_Locations', 'object_name', $fpEventLoc);
Please login to merge, or discard this patch.
tests/tests/modules/Alerts/AlertTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@  discard block
 block discarded – undo
4 4
 class AlertTest extends PHPUnit_Framework_TestCase {
5 5
 
6 6
 
7
-    public function testAlert(){
7
+    public function testAlert() {
8 8
 
9 9
     	//execute the contructor and check for the Object type and type attribute
10 10
     	$alert = new Alert();
11
-    	$this->assertInstanceOf('Alert',$alert);
12
-    	$this->assertInstanceOf('Basic',$alert);
13
-    	$this->assertInstanceOf('SugarBean',$alert);
11
+    	$this->assertInstanceOf('Alert', $alert);
12
+    	$this->assertInstanceOf('Basic', $alert);
13
+    	$this->assertInstanceOf('SugarBean', $alert);
14 14
     	
15 15
     	$this->assertAttributeEquals('Alerts', 'module_dir', $alert);
16 16
     	$this->assertAttributeEquals('Alert', 'object_name', $alert);
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     	    	
22 22
     }
23 23
 
24
-    public function testbean_implements(){
24
+    public function testbean_implements() {
25 25
 
26 26
     	error_reporting(E_ERROR | E_PARSE);
27 27
     	
Please login to merge, or discard this patch.
tests/tests/modules/SecurityGroups/SecurityGroupTest.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@  discard block
 block discarded – undo
4 4
 class SecurityGroupTest extends PHPUnit_Framework_TestCase {
5 5
 
6 6
 
7
-	public function testSecurityGroup(){
7
+	public function testSecurityGroup() {
8 8
 
9 9
 		//execute the contructor and check for the Object type and  attributes
10 10
 		$securityGroup = new SecurityGroup();
11 11
 		
12
-		$this->assertInstanceOf('SecurityGroup',$securityGroup);
13
-		$this->assertInstanceOf('Basic',$securityGroup);
14
-		$this->assertInstanceOf('SugarBean',$securityGroup);
12
+		$this->assertInstanceOf('SecurityGroup', $securityGroup);
13
+		$this->assertInstanceOf('Basic', $securityGroup);
14
+		$this->assertInstanceOf('SugarBean', $securityGroup);
15 15
 			
16 16
 		$this->assertAttributeEquals('securitygroups', 'table_name', $securityGroup);
17 17
 		$this->assertAttributeEquals('SecurityGroups', 'module_dir', $securityGroup);
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
 		
29 29
 		//test with securitygroups module
30 30
 		$expected = " securitygroups.id in (\n                select secg.id from securitygroups secg\n                inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n                    and secu.user_id = '1'\n                where secg.deleted = 0\n            )";
31
-		$actual = $securityGroup->getGroupWhere("securitygroups","SecurityGroups",1);
32
-		$this->assertSame($expected,$actual);
31
+		$actual = $securityGroup->getGroupWhere("securitygroups", "SecurityGroups", 1);
32
+		$this->assertSame($expected, $actual);
33 33
 		
34 34
 		
35 35
 		//test with //test with securitygroups module module
36 36
 		$expected = " EXISTS (SELECT  1\n                  FROM    securitygroups secg\n                          INNER JOIN securitygroups_users secu \n                            ON secg.id = secu.securitygroup_id \n                               AND secu.deleted = 0 \n                               AND secu.user_id = '1'\n                          INNER JOIN securitygroups_records secr \n                            ON secg.id = secr.securitygroup_id \n                               AND secr.deleted = 0 \n                               AND secr.module = 'Users'\n                       WHERE   secr.record_id = users.id\n                               AND secg.deleted = 0) ";
37
-		$actual = $securityGroup->getGroupWhere("users","Users",1);
38
-		$this->assertSame($expected,$actual);
37
+		$actual = $securityGroup->getGroupWhere("users", "Users", 1);
38
+		$this->assertSame($expected, $actual);
39 39
 				
40 40
 	}
41 41
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		$expected = " users.id in (\n            select sec.user_id from securitygroups_users sec\n            inner join securitygroups_users secu on sec.securitygroup_id = secu.securitygroup_id and secu.deleted = 0\n                and secu.user_id = '1'\n            where sec.deleted = 0\n        )";
47 47
 		$actual = $securityGroup->getGroupUsersWhere(1);
48 48
 	
49
-		$this->assertSame($expected,$actual);
49
+		$this->assertSame($expected, $actual);
50 50
 		
51 51
 	}
52 52
 
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 		
58 58
 		//test with securitygroups module
59 59
 		$expected = " LEFT JOIN (select distinct secg.id from securitygroups secg\n    inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n            and secu.user_id = '1'\n    where secg.deleted = 0\n) securitygroup_join on securitygroup_join.id = securitygroups.id ";
60
-		$actual = $securityGroup->getGroupJoin("securitygroups","SecurityGroups",1);
61
-		$this->assertSame($expected,$actual);
60
+		$actual = $securityGroup->getGroupJoin("securitygroups", "SecurityGroups", 1);
61
+		$this->assertSame($expected, $actual);
62 62
 		
63 63
 		
64 64
 		//test with //test with securitygroups module
65 65
 		$expected = " LEFT JOIN (select distinct secr.record_id as id from securitygroups secg\n    inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0\n            and secu.user_id = '1'\n    inner join securitygroups_records secr on secg.id = secr.securitygroup_id and secr.deleted = 0\n             and secr.module = 'Users'\n    where secg.deleted = 0\n) securitygroup_join on securitygroup_join.id = users.id ";
66
-		$actual = $securityGroup->getGroupJoin("users","Users",1);
67
-		$this->assertSame($expected,$actual);
66
+		$actual = $securityGroup->getGroupJoin("users", "Users", 1);
67
+		$this->assertSame($expected, $actual);
68 68
 				
69 69
 	}
70 70
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		
77 77
 		$expected = " LEFT JOIN (\n            select distinct sec.user_id as id from securitygroups_users sec\n            inner join securitygroups_users secu on sec.securitygroup_id = secu.securitygroup_id and secu.deleted = 0\n                and secu.user_id = '1'\n            where sec.deleted = 0\n        ) securitygroup_join on securitygroup_join.id = users.id ";
78 78
 		$actual = $securityGroup->getGroupUsersJoin(1);
79
-		$this->assertSame($expected,$actual);
79
+		$this->assertSame($expected, $actual);
80 80
 
81 81
 	}
82 82
 
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
 		
87 87
 		//test for listview
88 88
 		$result = SecurityGroup::groupHasAccess('', '[SELECT_ID_LIST]');
89
-		$this->assertEquals(True,$result);
89
+		$this->assertEquals(True, $result);
90 90
 		
91 91
 		
92 92
 		//test with invalid values
93 93
 		$result = SecurityGroup::groupHasAccess('', '');
94
-		$this->assertEquals(false,$result);
94
+		$this->assertEquals(false, $result);
95 95
 		
96 96
 		
97 97
 		//test with valid values
98 98
 		$result = SecurityGroup::groupHasAccess('Users', '1');
99
-		$this->assertEquals(false,$result);
99
+		$this->assertEquals(false, $result);
100 100
 				
101 101
 	}
102 102
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 			
115 115
 		//execute the method and test if it works and does not throws an exception.
116 116
 		try {
117
-			SecurityGroup::inherit($account,false);
117
+			SecurityGroup::inherit($account, false);
118 118
 			$this->assertTrue(true);
119 119
 		}
120 120
 		catch (Exception $e) {
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		
137 137
 		//execute the method and test if it works and does not throws an exception.
138 138
 		try {
139
-			SecurityGroup::assign_default_groups($account,false);
139
+			SecurityGroup::assign_default_groups($account, false);
140 140
 			$this->assertTrue(true);
141 141
 		}
142 142
 		catch (Exception $e) {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		
158 158
 		//execute the method and test if it works and does not throws an exception.
159 159
 		try {
160
-			SecurityGroup::inherit_creator($account,false);
160
+			SecurityGroup::inherit_creator($account, false);
161 161
 			$this->assertTrue(true);
162 162
 		}
163 163
 		catch (Exception $e) {
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 		
181 181
 		//execute the method and test if it works and does not throws an exception.
182 182
 		try {
183
-			SecurityGroup::inherit_assigned($account,false);
183
+			SecurityGroup::inherit_assigned($account, false);
184 184
 			$this->assertTrue(true);
185 185
 		}
186 186
 		catch (Exception $e) {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		
203 203
 		//execute the method and test if it works and does not throws an exception.
204 204
 		try {
205
-			SecurityGroup::inherit_parent($account,false);
205
+			SecurityGroup::inherit_parent($account, false);
206 206
 			$this->assertTrue(true);
207 207
 		}
208 208
 		catch (Exception $e) {
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
 		//execute the method and test if it works and does not throws an exception.
226 226
 		try {
227
-			SecurityGroup::inherit_parentQuery($account, "Accounts", 1, 1 , $account->module_dir);
227
+			SecurityGroup::inherit_parentQuery($account, "Accounts", 1, 1, $account->module_dir);
228 228
 			$this->assertTrue(true);
229 229
 		}
230 230
 		catch (Exception $e) {
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 
292 292
 		
293 293
 		//execute removeDefaultGroup method for each default group			
294
-		foreach($result as $key=>$value){			
294
+		foreach ($result as $key=>$value) {			
295 295
 			$securityGroup->removeDefaultGroup($key);
296 296
 		}
297 297
 		
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		
318 318
 		$securityGroup = new SecurityGroup();
319 319
 			
320
-		$expected = array (
320
+		$expected = array(
321 321
             'Meetings',
322 322
             'Cases',
323 323
             'AOS_Products',
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
         $actualKeys = array_keys($actual);
360 360
         sort($expected);
361 361
         sort($actualKeys);
362
-		$this->assertSame($expected,$actualKeys);
362
+		$this->assertSame($expected, $actualKeys);
363 363
 		
364 364
 	}
365 365
 
@@ -374,12 +374,12 @@  discard block
 block discarded – undo
374 374
 		
375 375
 		$securityGroup = new SecurityGroup();
376 376
 		
377
-		$result = $securityGroup->getLinkName("Accounts","Contacts");
378
-		$this->assertEquals("contacts",$result);
377
+		$result = $securityGroup->getLinkName("Accounts", "Contacts");
378
+		$this->assertEquals("contacts", $result);
379 379
 		
380 380
 		
381
-		$result = $securityGroup->getLinkName("SecurityGroups","ACLRoles");
382
-		$this->assertEquals("aclroles",$result);
381
+		$result = $securityGroup->getLinkName("SecurityGroups", "ACLRoles");
382
+		$this->assertEquals("aclroles", $result);
383 383
 		
384 384
 		error_reporting(E_ALL);
385 385
 		//error_reporting(E_ERROR | E_PARSE);
Please login to merge, or discard this patch.
tests/tests/modules/Releases/ReleaseTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 		//execute the contructor and check for the Object type and  attributes
9 9
 		$release = new Release();
10 10
 		
11
-		$this->assertInstanceOf('Release',$release);
12
-		$this->assertInstanceOf('SugarBean',$release);
11
+		$this->assertInstanceOf('Release', $release);
12
+		$this->assertInstanceOf('SugarBean', $release);
13 13
 		 
14 14
 		$this->assertAttributeEquals('releases', 'table_name', $release);
15 15
 		$this->assertAttributeEquals('Releases', 'module_dir', $release);
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 		$release = new Release();
27 27
 		
28 28
 		//test without setting name
29
-		$this->assertEquals(Null,$release->get_summary_text());
29
+		$this->assertEquals(Null, $release->get_summary_text());
30 30
 		
31 31
 		//test with name set
32 32
 		$release->name = "test";
33
-		$this->assertEquals('test',$release->get_summary_text());
33
+		$this->assertEquals('test', $release->get_summary_text());
34 34
 	}
35 35
 
36 36
 	public function testget_releases()
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$this->assertTrue(is_array($result));
43 43
 
44 44
 		//test with custom params
45
-		$result = $release->get_releases(true,'Hidden','name is not null');
45
+		$result = $release->get_releases(true, 'Hidden', 'name is not null');
46 46
 		$this->assertTrue(is_array($result));
47 47
 		
48 48
 	}
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
 		
78 78
 	}
79 79
 
80
-	public function testget_list_view_data(){
80
+	public function testget_list_view_data() {
81 81
 
82 82
 		$release = new Release();
83 83
 		
84 84
 		$release->name = "test";
85 85
 		$release->status = "Hidden";
86 86
 		
87
-		$expected = array (
87
+		$expected = array(
88 88
 				    'NAME' => 'test',
89 89
 				    'STATUS' => 'Hidden',
90 90
 				    'ENCODED_NAME' => 'test',
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 
101
-	public function testbuild_generic_where_clause () {
101
+	public function testbuild_generic_where_clause() {
102 102
 
103 103
 		$release = new Release();
104 104
 
105 105
 		//test with empty string params
106 106
 		$expected = "name like '%'";
107 107
 		$actual = $release->build_generic_where_clause('');
108
-		$this->assertSame($expected,$actual);
108
+		$this->assertSame($expected, $actual);
109 109
 		
110 110
 			
111 111
 		//test with valid string params
112 112
 		$expected = "name like '%'";
113 113
 		$actual = $release->build_generic_where_clause('test');
114
-		$this->assertSame($expected,$actual);
114
+		$this->assertSame($expected, $actual);
115 115
 	
116 116
 	}
117 117
 
Please login to merge, or discard this patch.