Completed
Push — CI ( ee6bd7...0f01dd )
by Adam
22:32
created
tests/tests/include/MVC/Controller/SugarControllerTest.php 2 patches
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -4,166 +4,166 @@
 block discarded – undo
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
-		$SugarController = new SugarController();
11
-		$default_module = $SugarController->module;
10
+        $SugarController = new SugarController();
11
+        $default_module = $SugarController->module;
12 12
 		
13
-		//first test with empty parameter and check for default values being used
14
-		$SugarController->setup('');
15
-		$this->assertAttributeEquals($default_module,'module', $SugarController);
16
-		$this->assertAttributeEquals(null,'target_module', $SugarController);
17
-
18
-		//secondly test with module name and check for correct assignment. 
19
-		$SugarController->setup('Users');
20
-		$this->assertAttributeEquals('Users','module', $SugarController);
21
-		$this->assertAttributeEquals(null,'target_module', $SugarController);
13
+        //first test with empty parameter and check for default values being used
14
+        $SugarController->setup('');
15
+        $this->assertAttributeEquals($default_module,'module', $SugarController);
16
+        $this->assertAttributeEquals(null,'target_module', $SugarController);
17
+
18
+        //secondly test with module name and check for correct assignment. 
19
+        $SugarController->setup('Users');
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(){
27
-		$SugarController = new SugarController();
26
+    public function testsetModule(){
27
+        $SugarController = new SugarController();
28 28
 		
29
-		//first test with empty parameter
30
-		$SugarController->setModule('');
31
-		$this->assertAttributeEquals('','module', $SugarController);
29
+        //first test with empty parameter
30
+        $SugarController->setModule('');
31
+        $this->assertAttributeEquals('','module', $SugarController);
32 32
 		
33
-		//secondly test with module name and check for correct assignment.
34
-		$SugarController->setModule('Users');
35
-		$this->assertAttributeEquals('Users','module', $SugarController);		
36
-	}
33
+        //secondly test with module name and check for correct assignment.
34
+        $SugarController->setModule('Users');
35
+        $this->assertAttributeEquals('Users','module', $SugarController);		
36
+    }
37 37
 
38 38
 
39
-	public function testloadBean()
40
-	{
41
-		$SugarController = new SugarController();
39
+    public function testloadBean()
40
+    {
41
+        $SugarController = new SugarController();
42 42
 		
43
-		//first test with empty parameter and check for null. Default is Home but Home has no bean
44
-		$SugarController->setModule('');
45
-		$SugarController->loadBean();
46
-		$this->assertEquals(null,$SugarController->bean );
43
+        //first test with empty parameter and check for null. Default is Home but Home has no bean
44
+        $SugarController->setModule('');
45
+        $SugarController->loadBean();
46
+        $this->assertEquals(null,$SugarController->bean );
47 47
 		
48
-		//secondly test with module name and check for correct bean class loaded.
49
-		$SugarController->setModule('Users');
50
-		$SugarController->loadBean();
51
-		$this->assertInstanceOf('User',$SugarController->bean);
48
+        //secondly test with module name and check for correct bean class loaded.
49
+        $SugarController->setModule('Users');
50
+        $SugarController->loadBean();
51
+        $this->assertInstanceOf('User',$SugarController->bean);
52 52
 		
53
-	}
53
+    }
54 54
 
55 55
 
56
-	public function testexecute()
56
+    public function testexecute()
57 57
     {
58
-    	$SugarController = new SugarController();
58
+        $SugarController = new SugarController();
59 59
     	
60
-    	//execute the method and check if it works and doesn't throws an exception
61
-    	try {
62
-    		$SugarController->execute();
63
-    	} catch (Exception $e) {
64
-    		$this->fail();
65
-    	}
60
+        //execute the method and check if it works and doesn't throws an exception
61
+        try {
62
+            $SugarController->execute();
63
+        } catch (Exception $e) {
64
+            $this->fail();
65
+        }
66 66
     	
67
-    	$this->assertTrue(TRUE);
67
+        $this->assertTrue(TRUE);
68 68
     	
69
-	}
69
+    }
70 70
 
71 71
 
72
-	public function testprocess(){
72
+    public function testprocess(){
73 73
 
74
-		$SugarController = new SugarController();
74
+        $SugarController = new SugarController();
75 75
 		 
76
-		//execute the method and check if it works and doesn't throws an exception
77
-		try {
78
-			$SugarController->process();
79
-		} catch (Exception $e) {
80
-			$this->fail();
81
-		}
76
+        //execute the method and check if it works and doesn't throws an exception
77
+        try {
78
+            $SugarController->process();
79
+        } catch (Exception $e) {
80
+            $this->fail();
81
+        }
82 82
 		 
83
-		$this->assertTrue(TRUE);		
83
+        $this->assertTrue(TRUE);		
84 84
 		
85
-	}
85
+    }
86 86
 
87 87
 
88
-	public function testpre_save(){
88
+    public function testpre_save(){
89 89
 
90
-		$SugarController = new SugarController();
91
-		$SugarController->setModule('Users');
92
-		$SugarController->loadBean();
90
+        $SugarController = new SugarController();
91
+        $SugarController->setModule('Users');
92
+        $SugarController->loadBean();
93 93
 	
94
-		//execute the method and check if it either works or throws an mysql exception.
95
-		//Fail if it throws any other exception.
96
-		try {
97
-			$SugarController->pre_save();
98
-		} catch (Exception $e) {
99
-			$this->assertStringStartsWith('mysqli_query()', $e->getMessage());
100
-		}
94
+        //execute the method and check if it either works or throws an mysql exception.
95
+        //Fail if it throws any other exception.
96
+        try {
97
+            $SugarController->pre_save();
98
+        } catch (Exception $e) {
99
+            $this->assertStringStartsWith('mysqli_query()', $e->getMessage());
100
+        }
101 101
 			
102
-		$this->assertTrue(TRUE);		
102
+        $this->assertTrue(TRUE);		
103 103
 		
104
-	}
104
+    }
105 105
 
106 106
 
107
-	public function testaction_save(){
107
+    public function testaction_save(){
108 108
 		
109
-		$SugarController = new SugarController();
110
-		$SugarController->setModule('Users');
111
-		$SugarController->loadBean();
109
+        $SugarController = new SugarController();
110
+        $SugarController->setModule('Users');
111
+        $SugarController->loadBean();
112 112
 		
113
-		//execute the method and check if it either works or throws an mysql exception.
114
-		//Fail if it throws any other exception.
115
-		try {
116
-			$SugarController->action_save();
117
-		} catch (Exception $e) {
118
-			$this->assertStringStartsWith('mysqli_query()', $e->getMessage());
119
-		}
113
+        //execute the method and check if it either works or throws an mysql exception.
114
+        //Fail if it throws any other exception.
115
+        try {
116
+            $SugarController->action_save();
117
+        } catch (Exception $e) {
118
+            $this->assertStringStartsWith('mysqli_query()', $e->getMessage());
119
+        }
120 120
 			
121
-		$this->assertTrue(TRUE);
121
+        $this->assertTrue(TRUE);
122 122
 		
123
-	}
123
+    }
124 124
 
125 125
 
126 126
     public function testaction_spot()
127 127
     {
128
-    	$SugarController = new SugarController();
128
+        $SugarController = new SugarController();
129 129
     	
130
-    	//first check with default value of attribute
131
-    	$this->assertAttributeEquals('classic','view', $SugarController);
130
+        //first check with default value of attribute
131
+        $this->assertAttributeEquals('classic','view', $SugarController);
132 132
     	
133
-    	//secondly check for attribute value change on method execution.
134
-    	$SugarController->action_spot();
135
-    	$this->assertAttributeEquals('spot','view', $SugarController);
133
+        //secondly check for attribute value change on method execution.
134
+        $SugarController->action_spot();
135
+        $this->assertAttributeEquals('spot','view', $SugarController);
136 136
     }
137 137
 
138 138
 
139
-	public function testgetActionFilename() {
139
+    public function testgetActionFilename() {
140 140
 
141
-		//first check with a invalid value
142
-		$action = SugarController::getActionFilename('');
143
-		$this->assertEquals('',$action );
141
+        //first check with a invalid value
142
+        $action = SugarController::getActionFilename('');
143
+        $this->assertEquals('',$action );
144 144
 		
145
-		//secondly check with a valid value
146
-		$action = SugarController::getActionFilename('editview');
147
-		$this->assertEquals('EditView',$action );
145
+        //secondly check with a valid value
146
+        $action = SugarController::getActionFilename('editview');
147
+        $this->assertEquals('EditView',$action );
148 148
 		
149
-	}
149
+    }
150 150
 
151 151
 
152 152
     public function testcheckEntryPointRequiresAuth()
153 153
     {
154
-    	$SugarController = new SugarController();
154
+        $SugarController = new SugarController();
155 155
     	
156
-    	//check with a invalid value
157
-    	$result = $SugarController->checkEntryPointRequiresAuth('');
158
-    	$this->assertTrue($result);
156
+        //check with a invalid value
157
+        $result = $SugarController->checkEntryPointRequiresAuth('');
158
+        $this->assertTrue($result);
159 159
     	
160
-    	//cehck with a valid True value
161
-    	$result = $SugarController->checkEntryPointRequiresAuth('download');
162
-    	$this->assertTrue($result);
160
+        //cehck with a valid True value
161
+        $result = $SugarController->checkEntryPointRequiresAuth('download');
162
+        $this->assertTrue($result);
163 163
 
164
-    	//cehck with a valid False value
165
-    	$result = $SugarController->checkEntryPointRequiresAuth('GeneratePassword');
166
-    	$this->assertFalse($result);
164
+        //cehck with a valid False value
165
+        $result = $SugarController->checkEntryPointRequiresAuth('GeneratePassword');
166
+        $this->assertFalse($result);
167 167
     	
168 168
     }
169 169
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
tests/tests/include/utils/securityUtilsTest.php 2 patches
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -4,123 +4,123 @@
 block discarded – undo
4 4
 class security_utilsTest extends PHPUnit_Framework_TestCase
5 5
 {
6 6
 	
7
-	public function testquery_module_access_list()
8
-	{
7
+    public function testquery_module_access_list()
8
+    {
9 9
 
10
-		//execute the method and test it it returns expected contents
10
+        //execute the method and test it it returns expected contents
11 11
 		
12
-		$user = new User('1');
13
-		$expected = array (
14
-				'Home' => 'Home',
15
-				'Accounts' => 'Accounts',
16
-				'Contacts' => 'Contacts',
17
-				'Opportunities' => 'Opportunities',
18
-				'Leads' => 'Leads',
19
-				'AOS_Quotes' => 'AOS_Quotes',
20
-				'Calendar' => 'Calendar',
21
-				'Documents' => 'Documents',
22
-				'Emails' => 'Emails',
23
-				'Campaigns' => 'Campaigns',
24
-				'Calls' => 'Calls',
25
-				'Meetings' => 'Meetings',
26
-				'Tasks' => 'Tasks',
27
-				'Notes' => 'Notes',
28
-				'AOS_Invoices' => 'AOS_Invoices',
29
-				'AOS_Contracts' => 'AOS_Contracts',
30
-				'Cases' => 'Cases',
31
-				'Prospects' => 'Prospects',
32
-				'ProspectLists' => 'ProspectLists',
33
-				'Project' => 'Project',
34
-				'AM_ProjectTemplates' => 'AM_ProjectTemplates',
35
-				'FP_events' => 'FP_events',
36
-				'FP_Event_Locations' => 'FP_Event_Locations',
37
-				'AOS_Products' => 'AOS_Products',
38
-				'AOS_Product_Categories' => 'AOS_Product_Categories',
39
-				'AOS_PDF_Templates' => 'AOS_PDF_Templates',
40
-				'jjwg_Maps' => 'jjwg_Maps',
41
-				'jjwg_Markers' => 'jjwg_Markers',
42
-				'jjwg_Areas' => 'jjwg_Areas',
43
-				'jjwg_Address_Cache' => 'jjwg_Address_Cache',
44
-				'AOR_Reports' => 'AOR_Reports',
45
-				'AOW_WorkFlow' => 'AOW_WorkFlow',
46
-				'AOK_KnowledgeBase' => 'AOK_KnowledgeBase',
47
-				'AOK_Knowledge_Base_Categories' => 'AOK_Knowledge_Base_Categories',
48
-		);		
12
+        $user = new User('1');
13
+        $expected = array (
14
+                'Home' => 'Home',
15
+                'Accounts' => 'Accounts',
16
+                'Contacts' => 'Contacts',
17
+                'Opportunities' => 'Opportunities',
18
+                'Leads' => 'Leads',
19
+                'AOS_Quotes' => 'AOS_Quotes',
20
+                'Calendar' => 'Calendar',
21
+                'Documents' => 'Documents',
22
+                'Emails' => 'Emails',
23
+                'Campaigns' => 'Campaigns',
24
+                'Calls' => 'Calls',
25
+                'Meetings' => 'Meetings',
26
+                'Tasks' => 'Tasks',
27
+                'Notes' => 'Notes',
28
+                'AOS_Invoices' => 'AOS_Invoices',
29
+                'AOS_Contracts' => 'AOS_Contracts',
30
+                'Cases' => 'Cases',
31
+                'Prospects' => 'Prospects',
32
+                'ProspectLists' => 'ProspectLists',
33
+                'Project' => 'Project',
34
+                'AM_ProjectTemplates' => 'AM_ProjectTemplates',
35
+                'FP_events' => 'FP_events',
36
+                'FP_Event_Locations' => 'FP_Event_Locations',
37
+                'AOS_Products' => 'AOS_Products',
38
+                'AOS_Product_Categories' => 'AOS_Product_Categories',
39
+                'AOS_PDF_Templates' => 'AOS_PDF_Templates',
40
+                'jjwg_Maps' => 'jjwg_Maps',
41
+                'jjwg_Markers' => 'jjwg_Markers',
42
+                'jjwg_Areas' => 'jjwg_Areas',
43
+                'jjwg_Address_Cache' => 'jjwg_Address_Cache',
44
+                'AOR_Reports' => 'AOR_Reports',
45
+                'AOW_WorkFlow' => 'AOW_WorkFlow',
46
+                'AOK_KnowledgeBase' => 'AOK_KnowledgeBase',
47
+                'AOK_Knowledge_Base_Categories' => 'AOK_Knowledge_Base_Categories',
48
+        );		
49 49
 		
50
-		$actual = query_module_access_list($user);
51
-		$this->assertSame($expected,$actual);
50
+        $actual = query_module_access_list($user);
51
+        $this->assertSame($expected,$actual);
52 52
 		
53 53
 				
54
-	}
54
+    }
55 55
 	
56
-	public function testquery_user_has_roles()
57
-	{
58
-		error_reporting(E_ERROR | E_PARSE);
56
+    public function testquery_user_has_roles()
57
+    {
58
+        error_reporting(E_ERROR | E_PARSE);
59 59
 		
60
-		//execute the method and test it it returns expected contents
60
+        //execute the method and test it it returns expected contents
61 61
 		
62
-		$expected = "0";
63
-		$actual = query_user_has_roles('1');
64
-		$this->assertSame($expected,$actual);
62
+        $expected = "0";
63
+        $actual = query_user_has_roles('1');
64
+        $this->assertSame($expected,$actual);
65 65
 		
66
-	}
66
+    }
67 67
 	
68
-	public function testget_user_allowed_modules()
69
-	{
70
-		//execute the method and test it it returns expected contents
68
+    public function testget_user_allowed_modules()
69
+    {
70
+        //execute the method and test it it returns expected contents
71 71
 		
72
-		$expected = Array();
73
-		$actual = get_user_allowed_modules('1');
74
-		$this->assertSame($expected,$actual);
72
+        $expected = Array();
73
+        $actual = get_user_allowed_modules('1');
74
+        $this->assertSame($expected,$actual);
75 75
 	
76
-	}
76
+    }
77 77
 	
78
-	public function testget_user_disallowed_modules()
79
-	{
80
-		//execute the method and test it it returns expected contents
78
+    public function testget_user_disallowed_modules()
79
+    {
80
+        //execute the method and test it it returns expected contents
81 81
 		
82
-		$expected = array (
83
-				'Bugs' => 'Bugs',
82
+        $expected = array (
83
+                'Bugs' => 'Bugs',
84 84
                 'Reminders' => 'Reminders',
85 85
                 'Reminders_Invitees' => 'Reminders_Invitees',
86
-				'AOR_Scheduled_Reports' => 'AOR_Scheduled_Reports',
87
-				'SecurityGroups' => 'SecurityGroups',
88
-		);
86
+                'AOR_Scheduled_Reports' => 'AOR_Scheduled_Reports',
87
+                'SecurityGroups' => 'SecurityGroups',
88
+        );
89 89
 		
90
-		$allowed = query_module_access_list(new User('1'));
91
-		$actual = get_user_disallowed_modules('1',$allowed);
90
+        $allowed = query_module_access_list(new User('1'));
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
+    }
97 97
 	
98
-	public function testquery_client_ip()
99
-	{
100
-		//test without setting any server parameters
101
-		$this->assertSame(Null,query_client_ip());
98
+    public function testquery_client_ip()
99
+    {
100
+        //test without setting any server parameters
101
+        $this->assertSame(Null,query_client_ip());
102 102
 
103
-		//test with server params set
104
-		$_SERVER['REMOTE_ADDR'] = "1.1.1.3";
105
-		$this->assertSame("1.1.1.3",query_client_ip());
103
+        //test with server params set
104
+        $_SERVER['REMOTE_ADDR'] = "1.1.1.3";
105
+        $this->assertSame("1.1.1.3",query_client_ip());
106 106
 		
107
-		$_SERVER['HTTP_FROM'] = "1.1.1.2";
108
-		$this->assertSame("1.1.1.2",query_client_ip());
107
+        $_SERVER['HTTP_FROM'] = "1.1.1.2";
108
+        $this->assertSame("1.1.1.2",query_client_ip());
109 109
 		
110
-		$_SERVER['HTTP_CLIENT_IP'] = "1.1.1.1";
111
-		$this->assertSame("1.1.1.1",query_client_ip());
110
+        $_SERVER['HTTP_CLIENT_IP'] = "1.1.1.1";
111
+        $this->assertSame("1.1.1.1",query_client_ip());
112 112
 		
113
-	}
113
+    }
114 114
 	
115 115
 	
116
-	public function testget_val_array()
117
-	{
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");
121
-		$actual = get_val_array($tempArray);
122
-		$this->assertSame($expected,$actual);
116
+    public function testget_val_array()
117
+    {
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");
121
+        $actual = get_val_array($tempArray);
122
+        $this->assertSame($expected,$actual);
123 123
 		
124
-	}
124
+    }
125 125
 	
126 126
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	
Please login to merge, or discard this patch.
tests/tests/include/utils/fileUtilsTest.php 3 patches
Indentation   +387 added lines, -387 removed lines patch added patch discarded remove patch
@@ -15,28 +15,28 @@  discard block
 block discarded – undo
15 15
 
16 16
 
17 17
     public function testclean_path()
18
-	{
19
-		//execute the method and test if it returns expected values
18
+    {
19
+        //execute the method and test if it returns expected values
20 20
 		
21
-		//invalid path
22
-		$expected = "";
23
-		$path = "";
24
-		$actual = clean_path($path);
25
-		$this->assertSame($expected,$actual);
21
+        //invalid path
22
+        $expected = "";
23
+        $path = "";
24
+        $actual = clean_path($path);
25
+        $this->assertSame($expected,$actual);
26 26
 		
27 27
 
28
-		//a simple valid path
29
-		$expected = "/SuiteCRM-develop/include/utils";
30
-		$path = '\SuiteCRM-develop\include\utils';
31
-		$actual = clean_path($path);
32
-		$this->assertSame($expected,$actual);
28
+        //a simple valid path
29
+        $expected = "/SuiteCRM-develop/include/utils";
30
+        $path = '\SuiteCRM-develop\include\utils';
31
+        $actual = clean_path($path);
32
+        $this->assertSame($expected,$actual);
33 33
 
34 34
 		
35
-		//valid network path 
36
-		$expected = "//SuiteCRM-develop/include/utils";
37
-		$path = "\\\\/SuiteCRM-develop/include/utils";
38
-		$actual = clean_path($path);
39
-		$this->assertSame($expected,$actual);
35
+        //valid network path 
36
+        $expected = "//SuiteCRM-develop/include/utils";
37
+        $path = "\\\\/SuiteCRM-develop/include/utils";
38
+        $actual = clean_path($path);
39
+        $this->assertSame($expected,$actual);
40 40
 
41 41
 
42 42
         $expected = "/SuiteCRM-develop/include/utils";
@@ -51,474 +51,474 @@  discard block
 block discarded – undo
51 51
 
52 52
 
53 53
 		
54
-	}
54
+    }
55 55
 	
56
-	public function testcreate_cache_directory()
57
-	{
58
-		//execute the method and test if it created file/dir exists
56
+    public function testcreate_cache_directory()
57
+    {
58
+        //execute the method and test if it created file/dir exists
59 59
 		
60
-		$cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\');
61
-		$file = "Test/";
60
+        $cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\');
61
+        $file = "Test/";
62 62
 		
63
-		if ( $this->rootFs->hasChild($file)  == true)
64
-			rmdir($cache_dir . "/" . $file);
63
+        if ( $this->rootFs->hasChild($file)  == true)
64
+            rmdir($cache_dir . "/" . $file);
65 65
 		
66
-		$actual = create_cache_directory($file);
67
-		$this->assertFileExists($actual);
66
+        $actual = create_cache_directory($file);
67
+        $this->assertFileExists($actual);
68 68
 		
69
-		if ( $this->rootFs->hasChild($file)  == true)
70
-			rmdir($cache_dir . "/" . $file);
69
+        if ( $this->rootFs->hasChild($file)  == true)
70
+            rmdir($cache_dir . "/" . $file);
71 71
 		
72
-	}
72
+    }
73 73
 	
74
-	public function testget_module_dir_list()
75
-	{
76
-		//execute the method and test if it returns expected values
77
-		
78
-		$expected  = array (
79
-				'Accounts' => 'Accounts',
80
-				'ACL' => 'ACL',
81
-				'ACLActions' => 'ACLActions',
82
-				'ACLRoles' => 'ACLRoles',
83
-				'Activities' => 'Activities',
84
-				'Administration' => 'Administration',
85
-				'Alerts' => 'Alerts',
86
-				'AM_ProjectTemplates' => 'AM_ProjectTemplates',
87
-				'AM_TaskTemplates' => 'AM_TaskTemplates',
88
-				'AOD_Index' => 'AOD_Index',
89
-				'AOD_IndexEvent' => 'AOD_IndexEvent',
90
-				'AOK_KnowledgeBase' => 'AOK_KnowledgeBase',
91
-				'AOK_Knowledge_Base_Categories' => 'AOK_Knowledge_Base_Categories',
92
-				'AOP_Case_Events' => 'AOP_Case_Events',
93
-				'AOP_Case_Updates' => 'AOP_Case_Updates',
94
-				'AOR_Charts' => 'AOR_Charts',
95
-				'AOR_Conditions' => 'AOR_Conditions',
96
-				'AOR_Fields' => 'AOR_Fields',
97
-				'AOR_Reports' => 'AOR_Reports',
98
-				'AOR_Scheduled_Reports' => 'AOR_Scheduled_Reports',
99
-				'AOS_Contracts' => 'AOS_Contracts',
100
-				'AOS_Invoices' => 'AOS_Invoices',
101
-				'AOS_Line_Item_Groups' => 'AOS_Line_Item_Groups',
102
-				'AOS_PDF_Templates' => 'AOS_PDF_Templates',
103
-				'AOS_Products' => 'AOS_Products',
104
-				'AOS_Products_Quotes' => 'AOS_Products_Quotes',
105
-				'AOS_Product_Categories' => 'AOS_Product_Categories',
106
-				'AOS_Quotes' => 'AOS_Quotes',
107
-				'AOW_Actions' => 'AOW_Actions',
108
-				'AOW_Conditions' => 'AOW_Conditions',
109
-				'AOW_Processed' => 'AOW_Processed',
110
-				'AOW_WorkFlow' => 'AOW_WorkFlow',
111
-				'Audit' => 'Audit',
112
-				'Bugs' => 'Bugs',
113
-				'Calendar' => 'Calendar',
114
-				'Calls' => 'Calls',
115
-				'Calls_Reschedule' => 'Calls_Reschedule',
116
-				'CampaignLog' => 'CampaignLog',
117
-				'Campaigns' => 'Campaigns',
118
-				'CampaignTrackers' => 'CampaignTrackers',
119
-				'Cases' => 'Cases',
120
-				'Charts' => 'Charts',
121
-				'Configurator' => 'Configurator',
122
-				'Connectors' => 'Connectors',
123
-				'Contacts' => 'Contacts',
124
-				'Currencies' => 'Currencies',
125
-				'Delegates' => 'Delegates',
126
-				'DocumentRevisions' => 'DocumentRevisions',
127
-				'Documents' => 'Documents',
128
-				'DynamicFields' => 'DynamicFields',
129
-				'EAPM' => 'EAPM',
130
-				'EmailAddresses' => 'EmailAddresses',
131
-				'EmailMan' => 'EmailMan',
132
-				'EmailMarketing' => 'EmailMarketing',
133
-				'Emails' => 'Emails',
134
-				'EmailTemplates' => 'EmailTemplates',				
135
-				'EmailText' => 'EmailText',
136
-				'Employees' => 'Employees',
137
-				'Favorites' => 'Favorites',
138
-				'FP_events' => 'FP_events',
139
-				'FP_Event_Locations' => 'FP_Event_Locations',
140
-				'Groups' => 'Groups',
141
-				'Help' => 'Help',
142
-				'History' => 'History',
143
-				'Home' => 'Home',
144
-				'iCals' => 'iCals',
145
-				'Import' => 'Import',
146
-				'InboundEmail' => 'InboundEmail',
147
-				'jjwg_Address_Cache' => 'jjwg_Address_Cache',
148
-				'jjwg_Areas' => 'jjwg_Areas',
149
-				'jjwg_Maps' => 'jjwg_Maps',
150
-				'jjwg_Markers' => 'jjwg_Markers',
151
-				'LabelEditor' => 'LabelEditor',
152
-				'Leads' => 'Leads',
153
-				'MailMerge' => 'MailMerge',
154
-				'Meetings' => 'Meetings',
155
-				'MergeRecords' => 'MergeRecords',
156
-				'ModuleBuilder' => 'ModuleBuilder',
157
-				'MySettings' => 'MySettings',
158
-				'Notes' => 'Notes',
159
-				'OAuthKeys' => 'OAuthKeys',
160
-				'OAuthTokens' => 'OAuthTokens',
161
-				'Opportunities' => 'Opportunities',
162
-				'OptimisticLock' => 'OptimisticLock',
163
-				'Project' => 'Project',
164
-				'ProjectTask' => 'ProjectTask',
165
-				'ProspectLists' => 'ProspectLists',
166
-				'Prospects' => 'Prospects',
167
-				'Relationships' => 'Relationships',
74
+    public function testget_module_dir_list()
75
+    {
76
+        //execute the method and test if it returns expected values
77
+		
78
+        $expected  = array (
79
+                'Accounts' => 'Accounts',
80
+                'ACL' => 'ACL',
81
+                'ACLActions' => 'ACLActions',
82
+                'ACLRoles' => 'ACLRoles',
83
+                'Activities' => 'Activities',
84
+                'Administration' => 'Administration',
85
+                'Alerts' => 'Alerts',
86
+                'AM_ProjectTemplates' => 'AM_ProjectTemplates',
87
+                'AM_TaskTemplates' => 'AM_TaskTemplates',
88
+                'AOD_Index' => 'AOD_Index',
89
+                'AOD_IndexEvent' => 'AOD_IndexEvent',
90
+                'AOK_KnowledgeBase' => 'AOK_KnowledgeBase',
91
+                'AOK_Knowledge_Base_Categories' => 'AOK_Knowledge_Base_Categories',
92
+                'AOP_Case_Events' => 'AOP_Case_Events',
93
+                'AOP_Case_Updates' => 'AOP_Case_Updates',
94
+                'AOR_Charts' => 'AOR_Charts',
95
+                'AOR_Conditions' => 'AOR_Conditions',
96
+                'AOR_Fields' => 'AOR_Fields',
97
+                'AOR_Reports' => 'AOR_Reports',
98
+                'AOR_Scheduled_Reports' => 'AOR_Scheduled_Reports',
99
+                'AOS_Contracts' => 'AOS_Contracts',
100
+                'AOS_Invoices' => 'AOS_Invoices',
101
+                'AOS_Line_Item_Groups' => 'AOS_Line_Item_Groups',
102
+                'AOS_PDF_Templates' => 'AOS_PDF_Templates',
103
+                'AOS_Products' => 'AOS_Products',
104
+                'AOS_Products_Quotes' => 'AOS_Products_Quotes',
105
+                'AOS_Product_Categories' => 'AOS_Product_Categories',
106
+                'AOS_Quotes' => 'AOS_Quotes',
107
+                'AOW_Actions' => 'AOW_Actions',
108
+                'AOW_Conditions' => 'AOW_Conditions',
109
+                'AOW_Processed' => 'AOW_Processed',
110
+                'AOW_WorkFlow' => 'AOW_WorkFlow',
111
+                'Audit' => 'Audit',
112
+                'Bugs' => 'Bugs',
113
+                'Calendar' => 'Calendar',
114
+                'Calls' => 'Calls',
115
+                'Calls_Reschedule' => 'Calls_Reschedule',
116
+                'CampaignLog' => 'CampaignLog',
117
+                'Campaigns' => 'Campaigns',
118
+                'CampaignTrackers' => 'CampaignTrackers',
119
+                'Cases' => 'Cases',
120
+                'Charts' => 'Charts',
121
+                'Configurator' => 'Configurator',
122
+                'Connectors' => 'Connectors',
123
+                'Contacts' => 'Contacts',
124
+                'Currencies' => 'Currencies',
125
+                'Delegates' => 'Delegates',
126
+                'DocumentRevisions' => 'DocumentRevisions',
127
+                'Documents' => 'Documents',
128
+                'DynamicFields' => 'DynamicFields',
129
+                'EAPM' => 'EAPM',
130
+                'EmailAddresses' => 'EmailAddresses',
131
+                'EmailMan' => 'EmailMan',
132
+                'EmailMarketing' => 'EmailMarketing',
133
+                'Emails' => 'Emails',
134
+                'EmailTemplates' => 'EmailTemplates',				
135
+                'EmailText' => 'EmailText',
136
+                'Employees' => 'Employees',
137
+                'Favorites' => 'Favorites',
138
+                'FP_events' => 'FP_events',
139
+                'FP_Event_Locations' => 'FP_Event_Locations',
140
+                'Groups' => 'Groups',
141
+                'Help' => 'Help',
142
+                'History' => 'History',
143
+                'Home' => 'Home',
144
+                'iCals' => 'iCals',
145
+                'Import' => 'Import',
146
+                'InboundEmail' => 'InboundEmail',
147
+                'jjwg_Address_Cache' => 'jjwg_Address_Cache',
148
+                'jjwg_Areas' => 'jjwg_Areas',
149
+                'jjwg_Maps' => 'jjwg_Maps',
150
+                'jjwg_Markers' => 'jjwg_Markers',
151
+                'LabelEditor' => 'LabelEditor',
152
+                'Leads' => 'Leads',
153
+                'MailMerge' => 'MailMerge',
154
+                'Meetings' => 'Meetings',
155
+                'MergeRecords' => 'MergeRecords',
156
+                'ModuleBuilder' => 'ModuleBuilder',
157
+                'MySettings' => 'MySettings',
158
+                'Notes' => 'Notes',
159
+                'OAuthKeys' => 'OAuthKeys',
160
+                'OAuthTokens' => 'OAuthTokens',
161
+                'Opportunities' => 'Opportunities',
162
+                'OptimisticLock' => 'OptimisticLock',
163
+                'Project' => 'Project',
164
+                'ProjectTask' => 'ProjectTask',
165
+                'ProspectLists' => 'ProspectLists',
166
+                'Prospects' => 'Prospects',
167
+                'Relationships' => 'Relationships',
168 168
                 'Reminders' => 'Reminders',
169 169
                 'Reminders_Invitees' => 'Reminders_Invitees',
170
-				'Releases' => 'Releases',
171
-				'Roles' => 'Roles',
172
-				'SavedSearch' => 'SavedSearch',
173
-				'Schedulers' => 'Schedulers',
174
-				'SchedulersJobs' => 'SchedulersJobs',
175
-				'SecurityGroups' => 'SecurityGroups',
176
-				'Studio' => 'Studio',
177
-				'SugarFeed' => 'SugarFeed',
178
-				'Tasks' => 'Tasks',
179
-				'Trackers' => 'Trackers',
180
-				'UpgradeWizard' => 'UpgradeWizard',
181
-				'UserPreferences' => 'UserPreferences',
182
-				'Users' => 'Users',
183
-				'vCals' => 'vCals',
184
-				'Versions' => 'Versions',
185
-				);
186
-		
187
-		
188
-		$actual = get_module_dir_list();
170
+                'Releases' => 'Releases',
171
+                'Roles' => 'Roles',
172
+                'SavedSearch' => 'SavedSearch',
173
+                'Schedulers' => 'Schedulers',
174
+                'SchedulersJobs' => 'SchedulersJobs',
175
+                'SecurityGroups' => 'SecurityGroups',
176
+                'Studio' => 'Studio',
177
+                'SugarFeed' => 'SugarFeed',
178
+                'Tasks' => 'Tasks',
179
+                'Trackers' => 'Trackers',
180
+                'UpgradeWizard' => 'UpgradeWizard',
181
+                'UserPreferences' => 'UserPreferences',
182
+                'Users' => 'Users',
183
+                'vCals' => 'vCals',
184
+                'Versions' => 'Versions',
185
+                );
186
+		
187
+		
188
+        $actual = get_module_dir_list();
189 189
         sort($actual);
190 190
         sort($expected);
191
-		$this->assertSame($expected,$actual);
191
+        $this->assertSame($expected,$actual);
192 192
 		
193
-	}
193
+    }
194 194
 	
195
-	public function testmk_temp_dir(  )
196
-	{
197
-		//execute the method and test if created dir/file exists
195
+    public function testmk_temp_dir(  )
196
+    {
197
+        //execute the method and test if created dir/file exists
198 198
 		
199
-		//without prefix
200
-		$actual = mk_temp_dir('vfs://root', '' );
201
-		$this->assertFileExists($actual);
199
+        //without prefix
200
+        $actual = mk_temp_dir('vfs://root', '' );
201
+        $this->assertFileExists($actual);
202 202
 
203
-		//with prefix
204
-		$actual = mk_temp_dir('vfs://root', 'pfx' );
205
-		$this->assertFileExists($actual);
203
+        //with prefix
204
+        $actual = mk_temp_dir('vfs://root', 'pfx' );
205
+        $this->assertFileExists($actual);
206 206
 		
207
-	}
207
+    }
208 208
 	
209
-	public function testremove_file_extension(  )
210
-	{
211
-		//execute the method and test if it returns expected values
209
+    public function testremove_file_extension(  )
210
+    {
211
+        //execute the method and test if it returns expected values
212 212
 		
213
-		//no file extension
214
-		$expected = "";
215
-		$actual = remove_file_extension('fileNoExt');
216
-		$this->assertSame($expected,$actual);
213
+        //no file extension
214
+        $expected = "";
215
+        $actual = remove_file_extension('fileNoExt');
216
+        $this->assertSame($expected,$actual);
217 217
 		
218 218
 		
219
-		//simple file extension
220
-		$expected = "file1";
221
-		$actual = remove_file_extension('file1.txt');
222
-		$this->assertSame($expected,$actual);
219
+        //simple file extension
220
+        $expected = "file1";
221
+        $actual = remove_file_extension('file1.txt');
222
+        $this->assertSame($expected,$actual);
223 223
 		
224 224
 		
225
-		//complex filename
226
-		$expected = "file2.ext1";
227
-		$actual =  remove_file_extension('file2.ext1.ext2');
228
-		$this->assertSame($expected,$actual);
225
+        //complex filename
226
+        $expected = "file2.ext1";
227
+        $actual =  remove_file_extension('file2.ext1.ext2');
228
+        $this->assertSame($expected,$actual);
229 229
 		
230
-	}
230
+    }
231 231
 	
232
-	public function testwrite_array_to_file()
233
-	{
232
+    public function testwrite_array_to_file()
233
+    {
234 234
         $this->markTestSkipped('write_array_to_file cannot be tested with vfsStream');
235
-		//execute the method and test if it returns true and verify contents
235
+        //execute the method and test if it returns true and verify contents
236 236
 		
237
-		$cache_dir = "vfs://root";
238
-		$tempArray = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" ));
237
+        $cache_dir = "vfs://root";
238
+        $tempArray = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" ));
239 239
 		
240 240
 		
241
-		//without header
242
-		$expected = "<?php\n// created: " . date('Y-m-d H:i:s') . "\n\$tempArray = array (\n  'Key1' => \n  array (\n    'Key2' => 'value2',\n    'Key3' => 'value3',\n  ),\n);" ;
243
-		$actual = write_array_to_file('tempArray', $tempArray, $cache_dir . '\tempArray.txt');
244
-		$this->assertTrue($actual);
245
-		$actual_contents = file_get_contents($cache_dir . '\tempArray.txt');
246
-		$this->assertSame($expected,$actual_contents);
247
-		unlink($cache_dir . '\tempArray.txt');
241
+        //without header
242
+        $expected = "<?php\n// created: " . date('Y-m-d H:i:s') . "\n\$tempArray = array (\n  'Key1' => \n  array (\n    'Key2' => 'value2',\n    'Key3' => 'value3',\n  ),\n);" ;
243
+        $actual = write_array_to_file('tempArray', $tempArray, $cache_dir . '\tempArray.txt');
244
+        $this->assertTrue($actual);
245
+        $actual_contents = file_get_contents($cache_dir . '\tempArray.txt');
246
+        $this->assertSame($expected,$actual_contents);
247
+        unlink($cache_dir . '\tempArray.txt');
248 248
 		
249
-		//with header
250
-		$expected = "test header \$tempArray = array (\n  'Key1' => \n  array (\n    'Key2' => 'value2',\n    'Key3' => 'value3',\n  ),\n);" ;
251
-		$actual = write_array_to_file('tempArray', $tempArray, $cache_dir . '\tempArray.txt','w' ,'test header ');
252
-		$this->assertTrue($actual);
253
-		$actual_contents = file_get_contents($cache_dir . '\tempArray.txt');
254
-		$this->assertSame($expected,$actual_contents);
255
-		unlink($cache_dir . '\tempArray.txt');
249
+        //with header
250
+        $expected = "test header \$tempArray = array (\n  'Key1' => \n  array (\n    'Key2' => 'value2',\n    'Key3' => 'value3',\n  ),\n);" ;
251
+        $actual = write_array_to_file('tempArray', $tempArray, $cache_dir . '\tempArray.txt','w' ,'test header ');
252
+        $this->assertTrue($actual);
253
+        $actual_contents = file_get_contents($cache_dir . '\tempArray.txt');
254
+        $this->assertSame($expected,$actual_contents);
255
+        unlink($cache_dir . '\tempArray.txt');
256 256
 		
257 257
 		
258
-	}
258
+    }
259 259
 	
260
-	public function testwrite_encoded_file( )
261
-	{
262
-		//execute the method and test if it created file exists
260
+    public function testwrite_encoded_file( )
261
+    {
262
+        //execute the method and test if it created file exists
263 263
 		
264
-		$cache_dir = "vfs://root";
264
+        $cache_dir = "vfs://root";
265 265
 		
266
-		//without filename 
267
-		$tempArray = Array("filename" =>'soap_array.txt' , "md5" => "523ef67de860fc54794f27117dba4fac" , "data" => "some soap data" );
268
-		$actual = write_encoded_file( $tempArray, $cache_dir, "" );
269
-		$this->assertFileExists($actual);
270
-		unlink($actual);
266
+        //without filename 
267
+        $tempArray = Array("filename" =>'soap_array.txt' , "md5" => "523ef67de860fc54794f27117dba4fac" , "data" => "some soap data" );
268
+        $actual = write_encoded_file( $tempArray, $cache_dir, "" );
269
+        $this->assertFileExists($actual);
270
+        unlink($actual);
271 271
 		
272 272
 		
273
-		//with filename
274
-		$tempArray = Array("md5" => "523ef67de860fc54794f27117dba4fac" , "data" => "some soap data" );
275
-		$actual = write_encoded_file( $tempArray, $cache_dir, "soap_array.txt" );
276
-		$this->assertFileExists($actual);
277
-		unlink($actual);
273
+        //with filename
274
+        $tempArray = Array("md5" => "523ef67de860fc54794f27117dba4fac" , "data" => "some soap data" );
275
+        $actual = write_encoded_file( $tempArray, $cache_dir, "soap_array.txt" );
276
+        $this->assertFileExists($actual);
277
+        unlink($actual);
278 278
 		
279
-	}
279
+    }
280 280
 	
281
-	public function testcreate_custom_directory()
282
-	{
283
-		//execute the method and test if it created file/dir exists
281
+    public function testcreate_custom_directory()
282
+    {
283
+        //execute the method and test if it created file/dir exists
284 284
 		
285
-		$file = "Test/";
285
+        $file = "Test/";
286 286
 		
287
-		$vfs = $this->rootFs;
288
-		if ( $vfs->hasChild($file)  == true)
289
-			rmdir("custom/" . $file);
287
+        $vfs = $this->rootFs;
288
+        if ( $vfs->hasChild($file)  == true)
289
+            rmdir("custom/" . $file);
290 290
 		
291
-		$actual = create_custom_directory($file);
292
-		$this->assertFileExists($actual);
291
+        $actual = create_custom_directory($file);
292
+        $this->assertFileExists($actual);
293 293
 
294
-		if ( $vfs->hasChild($file)  == true)
295
-			rmdir("custom/" . $file);
294
+        if ( $vfs->hasChild($file)  == true)
295
+            rmdir("custom/" . $file);
296 296
 		
297 297
 		
298
-	}
298
+    }
299 299
 	
300 300
 	
301
-	public function testgenerateMD5array()
302
-	{
303
-		//execute the method and test if it returns expected values
301
+    public function testgenerateMD5array()
302
+    {
303
+        //execute the method and test if it returns expected values
304 304
 
305
-		$expected= array (
306
-				'data/Relationships/EmailAddressRelationship.php' => '2f04780ddd15f7b65a35c75c303ed5d7',
307
-				'data/Relationships/M2MRelationship.php' => 'c320909b5a17d63aafa0d7497fe3c991',
308
-				'data/Relationships/One2MBeanRelationship.php' => 'c09fe92826b4c8a3944694098de35027',
309
-				'data/Relationships/One2MRelationship.php' => '588ad87910bd9d885fe27da77ad13e30',
310
-				'data/Relationships/One2OneBeanRelationship.php' => '765b8785d5ca576a8530db99bdf4d411',
311
-				'data/Relationships/One2OneRelationship.php' => '0385f7577687a402d9603ef26984257e',
312
-				'data/Relationships/RelationshipFactory.php' => '3bd7cc6998beaf82a13808f54bff1c2d',
313
-				'data/Relationships/SugarRelationship.php' => '8d0fa8ae0f41ac34eb5d0c04f0e02825',
314
-		); 
315
-		
316
-		$actual = generateMD5array('data/Relationships/');
317
-		$this->assertSame($expected,$actual);
305
+        $expected= array (
306
+                'data/Relationships/EmailAddressRelationship.php' => '2f04780ddd15f7b65a35c75c303ed5d7',
307
+                'data/Relationships/M2MRelationship.php' => 'c320909b5a17d63aafa0d7497fe3c991',
308
+                'data/Relationships/One2MBeanRelationship.php' => 'c09fe92826b4c8a3944694098de35027',
309
+                'data/Relationships/One2MRelationship.php' => '588ad87910bd9d885fe27da77ad13e30',
310
+                'data/Relationships/One2OneBeanRelationship.php' => '765b8785d5ca576a8530db99bdf4d411',
311
+                'data/Relationships/One2OneRelationship.php' => '0385f7577687a402d9603ef26984257e',
312
+                'data/Relationships/RelationshipFactory.php' => '3bd7cc6998beaf82a13808f54bff1c2d',
313
+                'data/Relationships/SugarRelationship.php' => '8d0fa8ae0f41ac34eb5d0c04f0e02825',
314
+        ); 
315
+		
316
+        $actual = generateMD5array('data/Relationships/');
317
+        $this->assertSame($expected,$actual);
318 318
 			
319
-	}
319
+    }
320 320
 	
321 321
 	
322
-	public function testmd5DirCompare()
323
-	{
324
-		//execute the method and test if it returns expected values
322
+    public function testmd5DirCompare()
323
+    {
324
+        //execute the method and test if it returns expected values
325 325
 		
326
-		$expected= array ();
326
+        $expected= array ();
327 327
 		
328
-		$actual = md5DirCompare('include/MVC/', 'include/MVC/',array('views'));
329
-		$this->assertSame($expected,$actual);
328
+        $actual = md5DirCompare('include/MVC/', 'include/MVC/',array('views'));
329
+        $this->assertSame($expected,$actual);
330 330
 		
331
-	}
331
+    }
332 332
 	
333 333
 	
334
-	public function testgetFiles() 
335
-	{
336
-		//execute the method and test if it returns expected values
334
+    public function testgetFiles() 
335
+    {
336
+        //execute the method and test if it returns expected values
337 337
 		
338
-		//test without pattern
339
-		$expected = array (
338
+        //test without pattern
339
+        $expected = array (
340 340
             'include/MVC/Controller/ControllerFactory.php',
341 341
             'include/MVC/Controller/file_access_control_map.php',
342 342
             'include/MVC/Controller/action_file_map.php',
343 343
             'include/MVC/Controller/action_view_map.php',
344 344
             'include/MVC/Controller/entry_point_registry.php',
345 345
             'include/MVC/Controller/SugarController.php',
346
-		);
347
-		$actual = Array();
348
-		getFiles($actual, 'include/MVC/Controller');
346
+        );
347
+        $actual = Array();
348
+        getFiles($actual, 'include/MVC/Controller');
349 349
         sort($actual);
350 350
         sort($expected);
351
-		$this->assertSame($expected,$actual);
352
-		
353
-		
354
-		
355
-		
356
-		//test with pattern
357
-		$expected = array (
358
-				'include/MVC/Controller/action_view_map.php',
359
-				'include/MVC/View/views/view.ajax.php',
360
-				'include/MVC/View/views/view.ajaxui.php',
361
-				'include/MVC/View/views/view.classic.config.php',
362
-				'include/MVC/View/views/view.classic.php',
363
-				'include/MVC/View/views/view.config.php',
364
-				'include/MVC/View/views/view.detail.config.php',
365
-				'include/MVC/View/views/view.detail.php',
366
-				'include/MVC/View/views/view.edit.php',
367
-				'include/MVC/View/views/view.favorites.php',
368
-				'include/MVC/View/views/view.html.php',
369
-				'include/MVC/View/views/view.importvcard.php',
370
-				'include/MVC/View/views/view.importvcardsave.php',
371
-				'include/MVC/View/views/view.json.php',
372
-				'include/MVC/View/views/view.list.php',
373
-				'include/MVC/View/views/view.metadata.php',
374
-				'include/MVC/View/views/view.modulelistmenu.php',
375
-				'include/MVC/View/views/view.multiedit.php',
376
-				'include/MVC/View/views/view.noaccess.php',
377
-				'include/MVC/View/views/view.popup.php',
378
-				'include/MVC/View/views/view.quick.php',
379
-				'include/MVC/View/views/view.quickcreate.php',
380
-				'include/MVC/View/views/view.quickedit.php',
381
-				'include/MVC/View/views/view.serialized.php',
382
-				'include/MVC/View/views/view.sugarpdf.config.php',
383
-				'include/MVC/View/views/view.sugarpdf.php',
384
-				'include/MVC/View/views/view.vcard.php',
385
-				'include/MVC/View/views/view.xml.php',
386
-		);
387
-		$actual = Array();
388
-		getFiles($actual, 'include/MVC','@view@');
351
+        $this->assertSame($expected,$actual);
352
+		
353
+		
354
+		
355
+		
356
+        //test with pattern
357
+        $expected = array (
358
+                'include/MVC/Controller/action_view_map.php',
359
+                'include/MVC/View/views/view.ajax.php',
360
+                'include/MVC/View/views/view.ajaxui.php',
361
+                'include/MVC/View/views/view.classic.config.php',
362
+                'include/MVC/View/views/view.classic.php',
363
+                'include/MVC/View/views/view.config.php',
364
+                'include/MVC/View/views/view.detail.config.php',
365
+                'include/MVC/View/views/view.detail.php',
366
+                'include/MVC/View/views/view.edit.php',
367
+                'include/MVC/View/views/view.favorites.php',
368
+                'include/MVC/View/views/view.html.php',
369
+                'include/MVC/View/views/view.importvcard.php',
370
+                'include/MVC/View/views/view.importvcardsave.php',
371
+                'include/MVC/View/views/view.json.php',
372
+                'include/MVC/View/views/view.list.php',
373
+                'include/MVC/View/views/view.metadata.php',
374
+                'include/MVC/View/views/view.modulelistmenu.php',
375
+                'include/MVC/View/views/view.multiedit.php',
376
+                'include/MVC/View/views/view.noaccess.php',
377
+                'include/MVC/View/views/view.popup.php',
378
+                'include/MVC/View/views/view.quick.php',
379
+                'include/MVC/View/views/view.quickcreate.php',
380
+                'include/MVC/View/views/view.quickedit.php',
381
+                'include/MVC/View/views/view.serialized.php',
382
+                'include/MVC/View/views/view.sugarpdf.config.php',
383
+                'include/MVC/View/views/view.sugarpdf.php',
384
+                'include/MVC/View/views/view.vcard.php',
385
+                'include/MVC/View/views/view.xml.php',
386
+        );
387
+        $actual = Array();
388
+        getFiles($actual, 'include/MVC','@view@');
389 389
         sort($expected);
390 390
         sort($actual);
391
-		$this->assertEquals($expected,$actual);
391
+        $this->assertEquals($expected,$actual);
392 392
 
393
-	}
393
+    }
394 394
 	
395 395
 	
396
-	public function testreadfile_chunked()
397
-	{
398
-		//execute the method and test if it returns expected values
396
+    public function testreadfile_chunked()
397
+    {
398
+        //execute the method and test if it returns expected values
399 399
 	
400
-		$expected = file_get_contents('config.php');
400
+        $expected = file_get_contents('config.php');
401 401
 		
402 402
 		
403
-		//retbytes parameter false
404
-		ob_start();		
405
-		$actual = readfile_chunked('config.php',false);		
406
-		$renderedContent = ob_get_contents();
407
-		ob_end_clean();		 
403
+        //retbytes parameter false
404
+        ob_start();		
405
+        $actual = readfile_chunked('config.php',false);		
406
+        $renderedContent = ob_get_contents();
407
+        ob_end_clean();		 
408 408
 		
409
-		$this->assertTrue($actual);
410
-		$this->assertSame($expected,$renderedContent);
409
+        $this->assertTrue($actual);
410
+        $this->assertSame($expected,$renderedContent);
411 411
 
412 412
 		
413 413
 		
414
-		//retbytes parameter true/default
415
-		ob_start();
416
-		$actual = readfile_chunked('config.php');
417
-		$renderedContent = ob_get_contents();
418
-		ob_end_clean();
414
+        //retbytes parameter true/default
415
+        ob_start();
416
+        $actual = readfile_chunked('config.php');
417
+        $renderedContent = ob_get_contents();
418
+        ob_end_clean();
419 419
 		
420
-		$this->assertEquals($actual,strlen($renderedContent));
421
-		$this->assertSame($expected,$renderedContent);
420
+        $this->assertEquals($actual,strlen($renderedContent));
421
+        $this->assertSame($expected,$renderedContent);
422 422
 		
423
-	}
423
+    }
424 424
 	
425
-	public function testsugar_rename( )
426
-	{
427
-		//execute the method and test if it returns true/success
425
+    public function testsugar_rename( )
426
+    {
427
+        //execute the method and test if it returns true/success
428 428
 	
429
-		$dir = 'vfs://root';
430
-		$file = "test.txt";
431
-		$vfs = $this->rootFs;
432
-		if ( $vfs->hasChild($file)  != true)
433
-			write_array_to_file('', '', $dir . '/' . $file);
429
+        $dir = 'vfs://root';
430
+        $file = "test.txt";
431
+        $vfs = $this->rootFs;
432
+        if ( $vfs->hasChild($file)  != true)
433
+            write_array_to_file('', '', $dir . '/' . $file);
434 434
 		
435
-		//test with empty file names
436
-		$actual = sugar_rename('','');
437
-		$this->assertFalse($actual);
435
+        //test with empty file names
436
+        $actual = sugar_rename('','');
437
+        $this->assertFalse($actual);
438 438
 		
439 439
 		
440
-		//test with valid file names 
441
-		$actual = sugar_rename($dir . '/' . $file, $dir . '/' . 'newtest.txt');
442
-		$this->assertTrue($actual);
440
+        //test with valid file names 
441
+        $actual = sugar_rename($dir . '/' . $file, $dir . '/' . 'newtest.txt');
442
+        $this->assertTrue($actual);
443 443
 		
444
-		unlink($dir . '/' . 'newtest.txt');
444
+        unlink($dir . '/' . 'newtest.txt');
445 445
 		
446
-	}
446
+    }
447 447
 	
448
-	public function testfileToHash()
449
-	{
450
-		//execute the method and test if it returns expected values
451
-		
452
-		//test with empty filename string
453
-		$expected  = "d41d8cd98f00b204e9800998ecf8427e";
454
-		$hash = fileToHash("");
455
-		$this->assertSame($expected,$hash);
456
-		$this->assertSame("",$_SESSION['file2Hash'][$hash]);
457
-		
458
-		//test with valid filename
459
-		$expected = "9e5e2527d69c009a81b8ecd730f3957e";
460
-		$hash = fileToHash('config.php');
461
-		$this->assertSame($expected,$hash);
462
-		$this->assertSame('config.php', $_SESSION['file2Hash'][$hash]);
463
-		
464
-	}
448
+    public function testfileToHash()
449
+    {
450
+        //execute the method and test if it returns expected values
451
+		
452
+        //test with empty filename string
453
+        $expected  = "d41d8cd98f00b204e9800998ecf8427e";
454
+        $hash = fileToHash("");
455
+        $this->assertSame($expected,$hash);
456
+        $this->assertSame("",$_SESSION['file2Hash'][$hash]);
457
+		
458
+        //test with valid filename
459
+        $expected = "9e5e2527d69c009a81b8ecd730f3957e";
460
+        $hash = fileToHash('config.php');
461
+        $this->assertSame($expected,$hash);
462
+        $this->assertSame('config.php', $_SESSION['file2Hash'][$hash]);
463
+		
464
+    }
465 465
 	
466
-	public function testhashToFile()
467
-	{
468
-		//execute the method and test if it returns expected values
469
-		
470
-		//test with invalid hash.
471
-		$actual = hashToFile("");
472
-		$this->assertFalse($actual);
473
-		
474
-		//test with a newly generated hash
475
-		$hash = fileToHash('config.php');
476
-		$actual = hashToFile($hash);
477
-		$this->assertSame('config.php', $actual);
478
-	}
466
+    public function testhashToFile()
467
+    {
468
+        //execute the method and test if it returns expected values
469
+		
470
+        //test with invalid hash.
471
+        $actual = hashToFile("");
472
+        $this->assertFalse($actual);
473
+		
474
+        //test with a newly generated hash
475
+        $hash = fileToHash('config.php');
476
+        $actual = hashToFile($hash);
477
+        $this->assertSame('config.php', $actual);
478
+    }
479 479
 	
480 480
 	
481
-	public function testget_file_extension()
482
-	{
483
-		//execute the method and test if it returns expected values
481
+    public function testget_file_extension()
482
+    {
483
+        //execute the method and test if it returns expected values
484 484
 		
485
-		$this->assertSame('', get_file_extension(''));
486
-		$this->assertSame('txt', get_file_extension('test.txt'));
487
-		$this->assertSame('Txt', get_file_extension('test.ext.Txt',false));
488
-		$this->assertSame('txt', get_file_extension('test.ext.TXT',true));
485
+        $this->assertSame('', get_file_extension(''));
486
+        $this->assertSame('txt', get_file_extension('test.txt'));
487
+        $this->assertSame('Txt', get_file_extension('test.ext.Txt',false));
488
+        $this->assertSame('txt', get_file_extension('test.ext.TXT',true));
489 489
 		
490
-	}
490
+    }
491 491
 	
492 492
 	
493
-	public function testget_mime_content_type_from_filename()
494
-	{
495
-		//execute the method and test if it returns expected values
493
+    public function testget_mime_content_type_from_filename()
494
+    {
495
+        //execute the method and test if it returns expected values
496 496
 		
497
-		$this->assertSame('', get_mime_content_type_from_filename('') );
498
-		$this->assertSame('application/octet-stream', get_mime_content_type_from_filename('file.tmp') );
499
-		$this->assertSame('text/plain', get_mime_content_type_from_filename('file.txt') );
500
-		$this->assertSame('application/x-shockwave-flash', get_mime_content_type_from_filename('file.swf') );
501
-		$this->assertSame('video/x-flv', get_mime_content_type_from_filename('file.flv') );	
497
+        $this->assertSame('', get_mime_content_type_from_filename('') );
498
+        $this->assertSame('application/octet-stream', get_mime_content_type_from_filename('file.tmp') );
499
+        $this->assertSame('text/plain', get_mime_content_type_from_filename('file.txt') );
500
+        $this->assertSame('application/x-shockwave-flash', get_mime_content_type_from_filename('file.swf') );
501
+        $this->assertSame('video/x-flv', get_mime_content_type_from_filename('file.flv') );	
502 502
 		
503
-	}
503
+    }
504 504
 	
505
-	public function testcleanFileName()
506
-	{
507
-		//execute the method and test if it returns expected values
508
-		
509
-		$this->assertSame("file.txt", cleanFileName("file<?>.txt") );
510
-		$this->assertSame("file_1.txt", cleanFileName("file_1<?>.txt") );
511
-		$this->assertSame("file.txt", cleanFileName("file.txt") );
512
-	}
505
+    public function testcleanFileName()
506
+    {
507
+        //execute the method and test if it returns expected values
508
+		
509
+        $this->assertSame("file.txt", cleanFileName("file<?>.txt") );
510
+        $this->assertSame("file_1.txt", cleanFileName("file_1<?>.txt") );
511
+        $this->assertSame("file.txt", cleanFileName("file.txt") );
512
+    }
513 513
 	
514
-	public function testcleanDirName()
515
-	{
516
-		//execute the method and test if it returns expected values
514
+    public function testcleanDirName()
515
+    {
516
+        //execute the method and test if it returns expected values
517 517
 		
518
-		$this->assertSame("testDir", cleanDirName("./testDir") );
519
-		$this->assertSame("testDir", cleanDirName("..\\testDir") );
520
-		$this->assertSame("testDir", cleanDirName("\\test/Dir/") );
518
+        $this->assertSame("testDir", cleanDirName("./testDir") );
519
+        $this->assertSame("testDir", cleanDirName("..\\testDir") );
520
+        $this->assertSame("testDir", cleanDirName("\\test/Dir/") );
521 521
 		
522
-	}
522
+    }
523 523
 
524 524
 }
525 525
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -22,32 +22,32 @@  discard block
 block discarded – undo
22 22
 		$expected = "";
23 23
 		$path = "";
24 24
 		$actual = clean_path($path);
25
-		$this->assertSame($expected,$actual);
25
+		$this->assertSame($expected, $actual);
26 26
 		
27 27
 
28 28
 		//a simple valid path
29 29
 		$expected = "/SuiteCRM-develop/include/utils";
30 30
 		$path = '\SuiteCRM-develop\include\utils';
31 31
 		$actual = clean_path($path);
32
-		$this->assertSame($expected,$actual);
32
+		$this->assertSame($expected, $actual);
33 33
 
34 34
 		
35 35
 		//valid network path 
36 36
 		$expected = "//SuiteCRM-develop/include/utils";
37 37
 		$path = "\\\\/SuiteCRM-develop/include/utils";
38 38
 		$actual = clean_path($path);
39
-		$this->assertSame($expected,$actual);
39
+		$this->assertSame($expected, $actual);
40 40
 
41 41
 
42 42
         $expected = "/SuiteCRM-develop/include/utils";
43 43
         $path = "/SuiteCRM-develop/./include/utils";
44 44
         $actual = clean_path($path);
45
-        $this->assertSame($expected,$actual);
45
+        $this->assertSame($expected, $actual);
46 46
 
47 47
         $expected = "/SuiteCRM-develop/include/utils";
48 48
         $path = "/SuiteCRM-develop//include/utils";
49 49
         $actual = clean_path($path);
50
-        $this->assertSame($expected,$actual);
50
+        $this->assertSame($expected, $actual);
51 51
 
52 52
 
53 53
 		
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 		$cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\');
61 61
 		$file = "Test/";
62 62
 		
63
-		if ( $this->rootFs->hasChild($file)  == true)
64
-			rmdir($cache_dir . "/" . $file);
63
+		if ($this->rootFs->hasChild($file) == true)
64
+			rmdir($cache_dir."/".$file);
65 65
 		
66 66
 		$actual = create_cache_directory($file);
67 67
 		$this->assertFileExists($actual);
68 68
 		
69
-		if ( $this->rootFs->hasChild($file)  == true)
70
-			rmdir($cache_dir . "/" . $file);
69
+		if ($this->rootFs->hasChild($file) == true)
70
+			rmdir($cache_dir."/".$file);
71 71
 		
72 72
 	}
73 73
 	
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	{
76 76
 		//execute the method and test if it returns expected values
77 77
 		
78
-		$expected  = array (
78
+		$expected = array(
79 79
 				'Accounts' => 'Accounts',
80 80
 				'ACL' => 'ACL',
81 81
 				'ACLActions' => 'ACLActions',
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		$actual = get_module_dir_list();
189 189
         sort($actual);
190 190
         sort($expected);
191
-		$this->assertSame($expected,$actual);
191
+		$this->assertSame($expected, $actual);
192 192
 		
193 193
 	}
194 194
 	
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 		//execute the method and test if created dir/file exists
198 198
 		
199 199
 		//without prefix
200
-		$actual = mk_temp_dir('vfs://root', '' );
200
+		$actual = mk_temp_dir('vfs://root', '');
201 201
 		$this->assertFileExists($actual);
202 202
 
203 203
 		//with prefix
204
-		$actual = mk_temp_dir('vfs://root', 'pfx' );
204
+		$actual = mk_temp_dir('vfs://root', 'pfx');
205 205
 		$this->assertFileExists($actual);
206 206
 		
207 207
 	}
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
 		//no file extension
214 214
 		$expected = "";
215 215
 		$actual = remove_file_extension('fileNoExt');
216
-		$this->assertSame($expected,$actual);
216
+		$this->assertSame($expected, $actual);
217 217
 		
218 218
 		
219 219
 		//simple file extension
220 220
 		$expected = "file1";
221 221
 		$actual = remove_file_extension('file1.txt');
222
-		$this->assertSame($expected,$actual);
222
+		$this->assertSame($expected, $actual);
223 223
 		
224 224
 		
225 225
 		//complex filename
226 226
 		$expected = "file2.ext1";
227
-		$actual =  remove_file_extension('file2.ext1.ext2');
228
-		$this->assertSame($expected,$actual);
227
+		$actual = remove_file_extension('file2.ext1.ext2');
228
+		$this->assertSame($expected, $actual);
229 229
 		
230 230
 	}
231 231
 	
@@ -235,24 +235,24 @@  discard block
 block discarded – undo
235 235
 		//execute the method and test if it returns true and verify contents
236 236
 		
237 237
 		$cache_dir = "vfs://root";
238
-		$tempArray = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" ));
238
+		$tempArray = Array("Key1" => Array("Key2" => "value2", "Key3" => "value3"));
239 239
 		
240 240
 		
241 241
 		//without header
242
-		$expected = "<?php\n// created: " . date('Y-m-d H:i:s') . "\n\$tempArray = array (\n  'Key1' => \n  array (\n    'Key2' => 'value2',\n    'Key3' => 'value3',\n  ),\n);" ;
243
-		$actual = write_array_to_file('tempArray', $tempArray, $cache_dir . '\tempArray.txt');
242
+		$expected = "<?php\n// created: ".date('Y-m-d H:i:s')."\n\$tempArray = array (\n  'Key1' => \n  array (\n    'Key2' => 'value2',\n    'Key3' => 'value3',\n  ),\n);";
243
+		$actual = write_array_to_file('tempArray', $tempArray, $cache_dir.'\tempArray.txt');
244 244
 		$this->assertTrue($actual);
245
-		$actual_contents = file_get_contents($cache_dir . '\tempArray.txt');
246
-		$this->assertSame($expected,$actual_contents);
247
-		unlink($cache_dir . '\tempArray.txt');
245
+		$actual_contents = file_get_contents($cache_dir.'\tempArray.txt');
246
+		$this->assertSame($expected, $actual_contents);
247
+		unlink($cache_dir.'\tempArray.txt');
248 248
 		
249 249
 		//with header
250
-		$expected = "test header \$tempArray = array (\n  'Key1' => \n  array (\n    'Key2' => 'value2',\n    'Key3' => 'value3',\n  ),\n);" ;
251
-		$actual = write_array_to_file('tempArray', $tempArray, $cache_dir . '\tempArray.txt','w' ,'test header ');
250
+		$expected = "test header \$tempArray = array (\n  'Key1' => \n  array (\n    'Key2' => 'value2',\n    'Key3' => 'value3',\n  ),\n);";
251
+		$actual = write_array_to_file('tempArray', $tempArray, $cache_dir.'\tempArray.txt', 'w', 'test header ');
252 252
 		$this->assertTrue($actual);
253
-		$actual_contents = file_get_contents($cache_dir . '\tempArray.txt');
254
-		$this->assertSame($expected,$actual_contents);
255
-		unlink($cache_dir . '\tempArray.txt');
253
+		$actual_contents = file_get_contents($cache_dir.'\tempArray.txt');
254
+		$this->assertSame($expected, $actual_contents);
255
+		unlink($cache_dir.'\tempArray.txt');
256 256
 		
257 257
 		
258 258
 	}
@@ -264,15 +264,15 @@  discard block
 block discarded – undo
264 264
 		$cache_dir = "vfs://root";
265 265
 		
266 266
 		//without filename 
267
-		$tempArray = Array("filename" =>'soap_array.txt' , "md5" => "523ef67de860fc54794f27117dba4fac" , "data" => "some soap data" );
268
-		$actual = write_encoded_file( $tempArray, $cache_dir, "" );
267
+		$tempArray = Array("filename" =>'soap_array.txt', "md5" => "523ef67de860fc54794f27117dba4fac", "data" => "some soap data");
268
+		$actual = write_encoded_file($tempArray, $cache_dir, "");
269 269
 		$this->assertFileExists($actual);
270 270
 		unlink($actual);
271 271
 		
272 272
 		
273 273
 		//with filename
274
-		$tempArray = Array("md5" => "523ef67de860fc54794f27117dba4fac" , "data" => "some soap data" );
275
-		$actual = write_encoded_file( $tempArray, $cache_dir, "soap_array.txt" );
274
+		$tempArray = Array("md5" => "523ef67de860fc54794f27117dba4fac", "data" => "some soap data");
275
+		$actual = write_encoded_file($tempArray, $cache_dir, "soap_array.txt");
276 276
 		$this->assertFileExists($actual);
277 277
 		unlink($actual);
278 278
 		
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 		$file = "Test/";
286 286
 		
287 287
 		$vfs = $this->rootFs;
288
-		if ( $vfs->hasChild($file)  == true)
289
-			rmdir("custom/" . $file);
288
+		if ($vfs->hasChild($file) == true)
289
+			rmdir("custom/".$file);
290 290
 		
291 291
 		$actual = create_custom_directory($file);
292 292
 		$this->assertFileExists($actual);
293 293
 
294
-		if ( $vfs->hasChild($file)  == true)
295
-			rmdir("custom/" . $file);
294
+		if ($vfs->hasChild($file) == true)
295
+			rmdir("custom/".$file);
296 296
 		
297 297
 		
298 298
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	{
303 303
 		//execute the method and test if it returns expected values
304 304
 
305
-		$expected= array (
305
+		$expected = array(
306 306
 				'data/Relationships/EmailAddressRelationship.php' => '2f04780ddd15f7b65a35c75c303ed5d7',
307 307
 				'data/Relationships/M2MRelationship.php' => 'c320909b5a17d63aafa0d7497fe3c991',
308 308
 				'data/Relationships/One2MBeanRelationship.php' => 'c09fe92826b4c8a3944694098de35027',
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		); 
315 315
 		
316 316
 		$actual = generateMD5array('data/Relationships/');
317
-		$this->assertSame($expected,$actual);
317
+		$this->assertSame($expected, $actual);
318 318
 			
319 319
 	}
320 320
 	
@@ -323,10 +323,10 @@  discard block
 block discarded – undo
323 323
 	{
324 324
 		//execute the method and test if it returns expected values
325 325
 		
326
-		$expected= array ();
326
+		$expected = array();
327 327
 		
328
-		$actual = md5DirCompare('include/MVC/', 'include/MVC/',array('views'));
329
-		$this->assertSame($expected,$actual);
328
+		$actual = md5DirCompare('include/MVC/', 'include/MVC/', array('views'));
329
+		$this->assertSame($expected, $actual);
330 330
 		
331 331
 	}
332 332
 	
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 		//execute the method and test if it returns expected values
337 337
 		
338 338
 		//test without pattern
339
-		$expected = array (
339
+		$expected = array(
340 340
             'include/MVC/Controller/ControllerFactory.php',
341 341
             'include/MVC/Controller/file_access_control_map.php',
342 342
             'include/MVC/Controller/action_file_map.php',
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 		getFiles($actual, 'include/MVC/Controller');
349 349
         sort($actual);
350 350
         sort($expected);
351
-		$this->assertSame($expected,$actual);
351
+		$this->assertSame($expected, $actual);
352 352
 		
353 353
 		
354 354
 		
355 355
 		
356 356
 		//test with pattern
357
-		$expected = array (
357
+		$expected = array(
358 358
 				'include/MVC/Controller/action_view_map.php',
359 359
 				'include/MVC/View/views/view.ajax.php',
360 360
 				'include/MVC/View/views/view.ajaxui.php',
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 				'include/MVC/View/views/view.xml.php',
386 386
 		);
387 387
 		$actual = Array();
388
-		getFiles($actual, 'include/MVC','@view@');
388
+		getFiles($actual, 'include/MVC', '@view@');
389 389
         sort($expected);
390 390
         sort($actual);
391
-		$this->assertEquals($expected,$actual);
391
+		$this->assertEquals($expected, $actual);
392 392
 
393 393
 	}
394 394
 	
@@ -402,12 +402,12 @@  discard block
 block discarded – undo
402 402
 		
403 403
 		//retbytes parameter false
404 404
 		ob_start();		
405
-		$actual = readfile_chunked('config.php',false);		
405
+		$actual = readfile_chunked('config.php', false);		
406 406
 		$renderedContent = ob_get_contents();
407 407
 		ob_end_clean();		 
408 408
 		
409 409
 		$this->assertTrue($actual);
410
-		$this->assertSame($expected,$renderedContent);
410
+		$this->assertSame($expected, $renderedContent);
411 411
 
412 412
 		
413 413
 		
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 		$renderedContent = ob_get_contents();
418 418
 		ob_end_clean();
419 419
 		
420
-		$this->assertEquals($actual,strlen($renderedContent));
421
-		$this->assertSame($expected,$renderedContent);
420
+		$this->assertEquals($actual, strlen($renderedContent));
421
+		$this->assertSame($expected, $renderedContent);
422 422
 		
423 423
 	}
424 424
 	
@@ -429,19 +429,19 @@  discard block
 block discarded – undo
429 429
 		$dir = 'vfs://root';
430 430
 		$file = "test.txt";
431 431
 		$vfs = $this->rootFs;
432
-		if ( $vfs->hasChild($file)  != true)
433
-			write_array_to_file('', '', $dir . '/' . $file);
432
+		if ($vfs->hasChild($file) != true)
433
+			write_array_to_file('', '', $dir.'/'.$file);
434 434
 		
435 435
 		//test with empty file names
436
-		$actual = sugar_rename('','');
436
+		$actual = sugar_rename('', '');
437 437
 		$this->assertFalse($actual);
438 438
 		
439 439
 		
440 440
 		//test with valid file names 
441
-		$actual = sugar_rename($dir . '/' . $file, $dir . '/' . 'newtest.txt');
441
+		$actual = sugar_rename($dir.'/'.$file, $dir.'/'.'newtest.txt');
442 442
 		$this->assertTrue($actual);
443 443
 		
444
-		unlink($dir . '/' . 'newtest.txt');
444
+		unlink($dir.'/'.'newtest.txt');
445 445
 		
446 446
 	}
447 447
 	
@@ -450,15 +450,15 @@  discard block
 block discarded – undo
450 450
 		//execute the method and test if it returns expected values
451 451
 		
452 452
 		//test with empty filename string
453
-		$expected  = "d41d8cd98f00b204e9800998ecf8427e";
453
+		$expected = "d41d8cd98f00b204e9800998ecf8427e";
454 454
 		$hash = fileToHash("");
455
-		$this->assertSame($expected,$hash);
456
-		$this->assertSame("",$_SESSION['file2Hash'][$hash]);
455
+		$this->assertSame($expected, $hash);
456
+		$this->assertSame("", $_SESSION['file2Hash'][$hash]);
457 457
 		
458 458
 		//test with valid filename
459 459
 		$expected = "9e5e2527d69c009a81b8ecd730f3957e";
460 460
 		$hash = fileToHash('config.php');
461
-		$this->assertSame($expected,$hash);
461
+		$this->assertSame($expected, $hash);
462 462
 		$this->assertSame('config.php', $_SESSION['file2Hash'][$hash]);
463 463
 		
464 464
 	}
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 		
485 485
 		$this->assertSame('', get_file_extension(''));
486 486
 		$this->assertSame('txt', get_file_extension('test.txt'));
487
-		$this->assertSame('Txt', get_file_extension('test.ext.Txt',false));
488
-		$this->assertSame('txt', get_file_extension('test.ext.TXT',true));
487
+		$this->assertSame('Txt', get_file_extension('test.ext.Txt', false));
488
+		$this->assertSame('txt', get_file_extension('test.ext.TXT', true));
489 489
 		
490 490
 	}
491 491
 	
@@ -494,11 +494,11 @@  discard block
 block discarded – undo
494 494
 	{
495 495
 		//execute the method and test if it returns expected values
496 496
 		
497
-		$this->assertSame('', get_mime_content_type_from_filename('') );
498
-		$this->assertSame('application/octet-stream', get_mime_content_type_from_filename('file.tmp') );
499
-		$this->assertSame('text/plain', get_mime_content_type_from_filename('file.txt') );
500
-		$this->assertSame('application/x-shockwave-flash', get_mime_content_type_from_filename('file.swf') );
501
-		$this->assertSame('video/x-flv', get_mime_content_type_from_filename('file.flv') );	
497
+		$this->assertSame('', get_mime_content_type_from_filename(''));
498
+		$this->assertSame('application/octet-stream', get_mime_content_type_from_filename('file.tmp'));
499
+		$this->assertSame('text/plain', get_mime_content_type_from_filename('file.txt'));
500
+		$this->assertSame('application/x-shockwave-flash', get_mime_content_type_from_filename('file.swf'));
501
+		$this->assertSame('video/x-flv', get_mime_content_type_from_filename('file.flv'));	
502 502
 		
503 503
 	}
504 504
 	
@@ -506,18 +506,18 @@  discard block
 block discarded – undo
506 506
 	{
507 507
 		//execute the method and test if it returns expected values
508 508
 		
509
-		$this->assertSame("file.txt", cleanFileName("file<?>.txt") );
510
-		$this->assertSame("file_1.txt", cleanFileName("file_1<?>.txt") );
511
-		$this->assertSame("file.txt", cleanFileName("file.txt") );
509
+		$this->assertSame("file.txt", cleanFileName("file<?>.txt"));
510
+		$this->assertSame("file_1.txt", cleanFileName("file_1<?>.txt"));
511
+		$this->assertSame("file.txt", cleanFileName("file.txt"));
512 512
 	}
513 513
 	
514 514
 	public function testcleanDirName()
515 515
 	{
516 516
 		//execute the method and test if it returns expected values
517 517
 		
518
-		$this->assertSame("testDir", cleanDirName("./testDir") );
519
-		$this->assertSame("testDir", cleanDirName("..\\testDir") );
520
-		$this->assertSame("testDir", cleanDirName("\\test/Dir/") );
518
+		$this->assertSame("testDir", cleanDirName("./testDir"));
519
+		$this->assertSame("testDir", cleanDirName("..\\testDir"));
520
+		$this->assertSame("testDir", cleanDirName("\\test/Dir/"));
521 521
 		
522 522
 	}
523 523
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -60,14 +60,16 @@  discard block
 block discarded – undo
60 60
 		$cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\');
61 61
 		$file = "Test/";
62 62
 		
63
-		if ( $this->rootFs->hasChild($file)  == true)
64
-			rmdir($cache_dir . "/" . $file);
63
+		if ( $this->rootFs->hasChild($file)  == true) {
64
+					rmdir($cache_dir . "/" . $file);
65
+		}
65 66
 		
66 67
 		$actual = create_cache_directory($file);
67 68
 		$this->assertFileExists($actual);
68 69
 		
69
-		if ( $this->rootFs->hasChild($file)  == true)
70
-			rmdir($cache_dir . "/" . $file);
70
+		if ( $this->rootFs->hasChild($file)  == true) {
71
+					rmdir($cache_dir . "/" . $file);
72
+		}
71 73
 		
72 74
 	}
73 75
 	
@@ -285,14 +287,16 @@  discard block
 block discarded – undo
285 287
 		$file = "Test/";
286 288
 		
287 289
 		$vfs = $this->rootFs;
288
-		if ( $vfs->hasChild($file)  == true)
289
-			rmdir("custom/" . $file);
290
+		if ( $vfs->hasChild($file)  == true) {
291
+					rmdir("custom/" . $file);
292
+		}
290 293
 		
291 294
 		$actual = create_custom_directory($file);
292 295
 		$this->assertFileExists($actual);
293 296
 
294
-		if ( $vfs->hasChild($file)  == true)
295
-			rmdir("custom/" . $file);
297
+		if ( $vfs->hasChild($file)  == true) {
298
+					rmdir("custom/" . $file);
299
+		}
296 300
 		
297 301
 		
298 302
 	}
@@ -429,8 +433,9 @@  discard block
 block discarded – undo
429 433
 		$dir = 'vfs://root';
430 434
 		$file = "test.txt";
431 435
 		$vfs = $this->rootFs;
432
-		if ( $vfs->hasChild($file)  != true)
433
-			write_array_to_file('', '', $dir . '/' . $file);
436
+		if ( $vfs->hasChild($file)  != true) {
437
+					write_array_to_file('', '', $dir . '/' . $file);
438
+		}
434 439
 		
435 440
 		//test with empty file names
436 441
 		$actual = sugar_rename('','');
Please login to merge, or discard this patch.
tests/tests/include/utils/sugarFileUtilsTest.php 2 patches
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -10,159 +10,159 @@
 block discarded – undo
10 10
         $rootFs->addChild(org\bovigo\vfs\vfsStream::newFile('test.txt')->withContent("Hello world!"));
11 11
     }
12 12
 
13
-	public function testsugar_mkdir()
14
-	{
15
-		//execute the method and test if it returns true and created dir exists
13
+    public function testsugar_mkdir()
14
+    {
15
+        //execute the method and test if it returns true and created dir exists
16 16
 		
17
-		$dir = "vfs://root";
17
+        $dir = "vfs://root";
18 18
 		
19
-		//non recursive
20
-		$result = sugar_mkdir($dir . "/mkdirTest");
21
-		$this->assertFileExists($dir . "/mkdirTest");
22
-		$this->assertTrue($result);
19
+        //non recursive
20
+        $result = sugar_mkdir($dir . "/mkdirTest");
21
+        $this->assertFileExists($dir . "/mkdirTest");
22
+        $this->assertTrue($result);
23 23
 		
24
-		//recursive
25
-		$result = sugar_mkdir($dir . "/mkdirTest/test",null,true);
26
-		$this->assertFileExists($dir . "/mkdirTest/test");
27
-		$this->assertTrue($result);
28
-	}
24
+        //recursive
25
+        $result = sugar_mkdir($dir . "/mkdirTest/test",null,true);
26
+        $this->assertFileExists($dir . "/mkdirTest/test");
27
+        $this->assertTrue($result);
28
+    }
29 29
 	
30
-	public function testsugar_fopen()
31
-	{
32
-		//execute the method and test if it doesn't returns false
33
-		$result = sugar_fopen('vfs://root/test.txt', 'r');
34
-		$this->assertNotFalse($result);
35
-	}
30
+    public function testsugar_fopen()
31
+    {
32
+        //execute the method and test if it doesn't returns false
33
+        $result = sugar_fopen('vfs://root/test.txt', 'r');
34
+        $this->assertNotFalse($result);
35
+    }
36 36
 
37 37
 	
38
-	public function testsugar_file_put_contents()
39
-	{
40
-		//execute the method and test if it doesn't returns false and returns the number of bytes written
38
+    public function testsugar_file_put_contents()
39
+    {
40
+        //execute the method and test if it doesn't returns false and returns the number of bytes written
41 41
 
42 42
         $dir = "vfs://root";
43
-		$result = sugar_file_put_contents( $dir . '/testfile.txt', 'some test data');
44
-		$this->assertNotFalse($result);
45
-		$this->assertEquals(14,$result);
46
-	}
43
+        $result = sugar_file_put_contents( $dir . '/testfile.txt', 'some test data');
44
+        $this->assertNotFalse($result);
45
+        $this->assertEquals(14,$result);
46
+    }
47 47
 
48 48
 	
49 49
 	
50
-	public function testsugar_file_put_contents_atomic()
51
-	{
50
+    public function testsugar_file_put_contents_atomic()
51
+    {
52 52
         $this->markTestSkipped('Atomic file put cannot be tested with vfsStream');
53
-		//execute the method and test if it returns success(true)
53
+        //execute the method and test if it returns success(true)
54 54
         $dir = "vfs://root";
55
-		$result = sugar_file_put_contents_atomic( $dir . '/atomictestfile.txt', 'some test data');
56
-		$this->assertTrue($result);
57
-	}
55
+        $result = sugar_file_put_contents_atomic( $dir . '/atomictestfile.txt', 'some test data');
56
+        $this->assertTrue($result);
57
+    }
58 58
 	
59 59
 	
60
-	public function testsugar_file_get_contents()
61
-	{
62
-		//execute the method and test if it doesn't returns false and returns the expected contents
60
+    public function testsugar_file_get_contents()
61
+    {
62
+        //execute the method and test if it doesn't returns false and returns the expected contents
63 63
         $dir = "vfs://root";
64
-		$result = file_get_contents( $dir . '/test.txt');
64
+        $result = file_get_contents( $dir . '/test.txt');
65 65
 		
66
-		$this->assertNotFalse($result);
67
-		$this->assertEquals('Hello world!',$result);
68
-	}
66
+        $this->assertNotFalse($result);
67
+        $this->assertEquals('Hello world!',$result);
68
+    }
69 69
 	
70 70
 
71
-	public function testsugar_touch() 
72
-	{
73
-		//execute the method and test if it returns success(true)
71
+    public function testsugar_touch() 
72
+    {
73
+        //execute the method and test if it returns success(true)
74 74
 
75 75
         $dir = "vfs://root";
76
-		$test_dt = time() - 3600 ; 
77
-		$expected = date("m d Y H:i:s",  time() - 3600 );
76
+        $test_dt = time() - 3600 ; 
77
+        $expected = date("m d Y H:i:s",  time() - 3600 );
78 78
 		
79
-		//test wihout modified date param
80
-		$result = sugar_touch( $dir . '/testfiletouch.txt');
81
-		$this->assertTrue($result);		
79
+        //test wihout modified date param
80
+        $result = sugar_touch( $dir . '/testfiletouch.txt');
81
+        $this->assertTrue($result);		
82 82
 		
83
-		//test wih modified date param
84
-		$result = sugar_touch( $dir . '/testfiletouch.txt',$test_dt,$test_dt);
85
-		$file_dt = date ("m d Y H:i:s", filemtime($dir . '/testfiletouch.txt')) ;
83
+        //test wih modified date param
84
+        $result = sugar_touch( $dir . '/testfiletouch.txt',$test_dt,$test_dt);
85
+        $file_dt = date ("m d Y H:i:s", filemtime($dir . '/testfiletouch.txt')) ;
86 86
 		
87
-		$this->assertTrue($result);
88
-		$this->assertSame($file_dt, $expected );
89
-	}
87
+        $this->assertTrue($result);
88
+        $this->assertSame($file_dt, $expected );
89
+    }
90 90
 	
91 91
 
92
-	public function testsugar_chmod() 
93
-	{
92
+    public function testsugar_chmod() 
93
+    {
94 94
         $this->markTestSkipped('Permissions cannot be tested with vfsStream');
95
-		//execute the method and test if it returns success(true)
95
+        //execute the method and test if it returns success(true)
96 96
         $dir = "vfs://test";
97
-		$result = sugar_chmod($dir . '/test.txt',0777);
98
-		$this->assertTrue($result);
99
-	}
97
+        $result = sugar_chmod($dir . '/test.txt',0777);
98
+        $this->assertTrue($result);
99
+    }
100 100
 	
101 101
 	
102
-	public function testsugar_chown() 
103
-	{
102
+    public function testsugar_chown() 
103
+    {
104 104
         $this->markTestSkipped('Permissions cannot be tested with vfsStream');
105
-		//execute the method and test if it returns success(true)
105
+        //execute the method and test if it returns success(true)
106 106
         $dir = "vfs://test";
107
-		$result = sugar_chown($dir . '/test.txt');
108
-		$this->assertFalse($result);
107
+        $result = sugar_chown($dir . '/test.txt');
108
+        $this->assertFalse($result);
109 109
 
110 110
         $result = sugar_chown($dir . '/test.txt',org\bovigo\vfs\vfsStream::getCurrentUser());
111 111
         $this->assertTrue($result);
112 112
 
113
-	}
113
+    }
114 114
 	
115 115
 	
116
-	public function testsugar_chgrp() 
117
-	{
116
+    public function testsugar_chgrp() 
117
+    {
118 118
         $this->markTestSkipped('Permissions cannot be tested with vfsStream');
119
-		//execute the method and test if it returns success(true)
119
+        //execute the method and test if it returns success(true)
120 120
         $dir = "vfs://test";
121
-		$result = sugar_chgrp($dir . '/test.txt');
122
-		$this->assertFalse($result);
121
+        $result = sugar_chgrp($dir . '/test.txt');
122
+        $this->assertFalse($result);
123 123
 
124 124
         $result = sugar_chgrp($dir . '/test.txt',org\bovigo\vfs\vfsStream::getCurrentGroup());
125 125
         $this->assertFalse($result);
126
-	}
126
+    }
127 127
 	
128 128
 
129
-	public function testget_mode()
130
-	{
131
-		//test with all mods defined in config
132
-		$this->assertSame(1528,get_mode());
133
-		$this->assertSame(1528,get_mode('dir_mode', 10));
134
-		$this->assertSame(493,get_mode('file_mode', 10));
135
-		$this->assertSame('',get_mode('user', 10));
136
-		$this->assertSame('',get_mode('group', 10));
137
-	}
138
-
139
-	public function testsugar_is_dir()
140
-	{
141
-		$dir = "vfs://root";
129
+    public function testget_mode()
130
+    {
131
+        //test with all mods defined in config
132
+        $this->assertSame(1528,get_mode());
133
+        $this->assertSame(1528,get_mode('dir_mode', 10));
134
+        $this->assertSame(493,get_mode('file_mode', 10));
135
+        $this->assertSame('',get_mode('user', 10));
136
+        $this->assertSame('',get_mode('group', 10));
137
+    }
138
+
139
+    public function testsugar_is_dir()
140
+    {
141
+        $dir = "vfs://root";
142 142
 		
143
-		$this->assertFalse(sugar_is_dir('')); //invalid dir
143
+        $this->assertFalse(sugar_is_dir('')); //invalid dir
144 144
         $this->assertFalse(sugar_is_dir($dir."/foo")); //invalid dir
145
-		$this->assertTrue(sugar_is_dir($dir."/testDir")); //valid dir
145
+        $this->assertTrue(sugar_is_dir($dir."/testDir")); //valid dir
146 146
 		
147
-	}
148
-
149
-	public function testsugar_is_file()
150
-	{
151
-		$this->assertFalse(sugar_is_file('')); //invalid file
152
-		$this->assertFalse(sugar_is_file('vfs://config')); //invalid file
153
-		$this->assertTrue(is_file('vfs://root/test.txt')); //valid file
154
-	}
147
+    }
148
+
149
+    public function testsugar_is_file()
150
+    {
151
+        $this->assertFalse(sugar_is_file('')); //invalid file
152
+        $this->assertFalse(sugar_is_file('vfs://config')); //invalid file
153
+        $this->assertTrue(is_file('vfs://root/test.txt')); //valid file
154
+    }
155 155
 	
156 156
 
157
-	public function testsugar_cached()
158
-	{
159
-		$cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\');
157
+    public function testsugar_cached()
158
+    {
159
+        $cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\');
160 160
 		
161
-		$this->assertSame($cache_dir . '/', sugar_cached('')); //invalid file
162
-		$this->assertSame($cache_dir . '/config', sugar_cached('config')); //valid file		
163
-		$this->assertSame($cache_dir . '/modules' , sugar_cached('modules')); //valid file
161
+        $this->assertSame($cache_dir . '/', sugar_cached('')); //invalid file
162
+        $this->assertSame($cache_dir . '/config', sugar_cached('config')); //valid file		
163
+        $this->assertSame($cache_dir . '/modules' , sugar_cached('modules')); //valid file
164 164
 		
165
-	}
165
+    }
166 166
 
167 167
 	
168 168
 }
169 169
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 		$dir = "vfs://root";
18 18
 		
19 19
 		//non recursive
20
-		$result = sugar_mkdir($dir . "/mkdirTest");
21
-		$this->assertFileExists($dir . "/mkdirTest");
20
+		$result = sugar_mkdir($dir."/mkdirTest");
21
+		$this->assertFileExists($dir."/mkdirTest");
22 22
 		$this->assertTrue($result);
23 23
 		
24 24
 		//recursive
25
-		$result = sugar_mkdir($dir . "/mkdirTest/test",null,true);
26
-		$this->assertFileExists($dir . "/mkdirTest/test");
25
+		$result = sugar_mkdir($dir."/mkdirTest/test", null, true);
26
+		$this->assertFileExists($dir."/mkdirTest/test");
27 27
 		$this->assertTrue($result);
28 28
 	}
29 29
 	
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 		//execute the method and test if it doesn't returns false and returns the number of bytes written
41 41
 
42 42
         $dir = "vfs://root";
43
-		$result = sugar_file_put_contents( $dir . '/testfile.txt', 'some test data');
43
+		$result = sugar_file_put_contents($dir.'/testfile.txt', 'some test data');
44 44
 		$this->assertNotFalse($result);
45
-		$this->assertEquals(14,$result);
45
+		$this->assertEquals(14, $result);
46 46
 	}
47 47
 
48 48
 	
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         $this->markTestSkipped('Atomic file put cannot be tested with vfsStream');
53 53
 		//execute the method and test if it returns success(true)
54 54
         $dir = "vfs://root";
55
-		$result = sugar_file_put_contents_atomic( $dir . '/atomictestfile.txt', 'some test data');
55
+		$result = sugar_file_put_contents_atomic($dir.'/atomictestfile.txt', 'some test data');
56 56
 		$this->assertTrue($result);
57 57
 	}
58 58
 	
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 	{
62 62
 		//execute the method and test if it doesn't returns false and returns the expected contents
63 63
         $dir = "vfs://root";
64
-		$result = file_get_contents( $dir . '/test.txt');
64
+		$result = file_get_contents($dir.'/test.txt');
65 65
 		
66 66
 		$this->assertNotFalse($result);
67
-		$this->assertEquals('Hello world!',$result);
67
+		$this->assertEquals('Hello world!', $result);
68 68
 	}
69 69
 	
70 70
 
@@ -73,19 +73,19 @@  discard block
 block discarded – undo
73 73
 		//execute the method and test if it returns success(true)
74 74
 
75 75
         $dir = "vfs://root";
76
-		$test_dt = time() - 3600 ; 
77
-		$expected = date("m d Y H:i:s",  time() - 3600 );
76
+		$test_dt = time() - 3600; 
77
+		$expected = date("m d Y H:i:s", time() - 3600);
78 78
 		
79 79
 		//test wihout modified date param
80
-		$result = sugar_touch( $dir . '/testfiletouch.txt');
80
+		$result = sugar_touch($dir.'/testfiletouch.txt');
81 81
 		$this->assertTrue($result);		
82 82
 		
83 83
 		//test wih modified date param
84
-		$result = sugar_touch( $dir . '/testfiletouch.txt',$test_dt,$test_dt);
85
-		$file_dt = date ("m d Y H:i:s", filemtime($dir . '/testfiletouch.txt')) ;
84
+		$result = sugar_touch($dir.'/testfiletouch.txt', $test_dt, $test_dt);
85
+		$file_dt = date("m d Y H:i:s", filemtime($dir.'/testfiletouch.txt'));
86 86
 		
87 87
 		$this->assertTrue($result);
88
-		$this->assertSame($file_dt, $expected );
88
+		$this->assertSame($file_dt, $expected);
89 89
 	}
90 90
 	
91 91
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $this->markTestSkipped('Permissions cannot be tested with vfsStream');
95 95
 		//execute the method and test if it returns success(true)
96 96
         $dir = "vfs://test";
97
-		$result = sugar_chmod($dir . '/test.txt',0777);
97
+		$result = sugar_chmod($dir.'/test.txt', 0777);
98 98
 		$this->assertTrue($result);
99 99
 	}
100 100
 	
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
         $this->markTestSkipped('Permissions cannot be tested with vfsStream');
105 105
 		//execute the method and test if it returns success(true)
106 106
         $dir = "vfs://test";
107
-		$result = sugar_chown($dir . '/test.txt');
107
+		$result = sugar_chown($dir.'/test.txt');
108 108
 		$this->assertFalse($result);
109 109
 
110
-        $result = sugar_chown($dir . '/test.txt',org\bovigo\vfs\vfsStream::getCurrentUser());
110
+        $result = sugar_chown($dir.'/test.txt', org\bovigo\vfs\vfsStream::getCurrentUser());
111 111
         $this->assertTrue($result);
112 112
 
113 113
 	}
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
         $this->markTestSkipped('Permissions cannot be tested with vfsStream');
119 119
 		//execute the method and test if it returns success(true)
120 120
         $dir = "vfs://test";
121
-		$result = sugar_chgrp($dir . '/test.txt');
121
+		$result = sugar_chgrp($dir.'/test.txt');
122 122
 		$this->assertFalse($result);
123 123
 
124
-        $result = sugar_chgrp($dir . '/test.txt',org\bovigo\vfs\vfsStream::getCurrentGroup());
124
+        $result = sugar_chgrp($dir.'/test.txt', org\bovigo\vfs\vfsStream::getCurrentGroup());
125 125
         $this->assertFalse($result);
126 126
 	}
127 127
 	
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 	public function testget_mode()
130 130
 	{
131 131
 		//test with all mods defined in config
132
-		$this->assertSame(1528,get_mode());
133
-		$this->assertSame(1528,get_mode('dir_mode', 10));
134
-		$this->assertSame(493,get_mode('file_mode', 10));
135
-		$this->assertSame('',get_mode('user', 10));
136
-		$this->assertSame('',get_mode('group', 10));
132
+		$this->assertSame(1528, get_mode());
133
+		$this->assertSame(1528, get_mode('dir_mode', 10));
134
+		$this->assertSame(493, get_mode('file_mode', 10));
135
+		$this->assertSame('', get_mode('user', 10));
136
+		$this->assertSame('', get_mode('group', 10));
137 137
 	}
138 138
 
139 139
 	public function testsugar_is_dir()
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
 	{
159 159
 		$cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\');
160 160
 		
161
-		$this->assertSame($cache_dir . '/', sugar_cached('')); //invalid file
162
-		$this->assertSame($cache_dir . '/config', sugar_cached('config')); //valid file		
163
-		$this->assertSame($cache_dir . '/modules' , sugar_cached('modules')); //valid file
161
+		$this->assertSame($cache_dir.'/', sugar_cached('')); //invalid file
162
+		$this->assertSame($cache_dir.'/config', sugar_cached('config')); //valid file		
163
+		$this->assertSame($cache_dir.'/modules', sugar_cached('modules')); //valid file
164 164
 		
165 165
 	}
166 166
 
Please login to merge, or discard this patch.
tests/tests/include/utils/logicUtilsTest.php 3 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -8,26 +8,26 @@  discard block
 block discarded – undo
8 8
 class logic_utilsTest extends PHPUnit_Framework_TestCase
9 9
 {
10 10
 
11
-	public function testget_hook_array()
12
-	{
13
-		//test with a vaid module. it will return an array
14
-		$AccountsHooks =  get_hook_array('Accounts');
15
-		$this->assertTrue(is_array($AccountsHooks));
11
+    public function testget_hook_array()
12
+    {
13
+        //test with a vaid module. it will return an array
14
+        $AccountsHooks =  get_hook_array('Accounts');
15
+        $this->assertTrue(is_array($AccountsHooks));
16 16
 		
17
-		//test with an invalid array. it will throw an file include exception.
18
-		$BugsHooks = "";
19
-		try{
20
-			$BugsHooks =  get_hook_array('Bugs');
21
-		}catch(Exception $e){}
17
+        //test with an invalid array. it will throw an file include exception.
18
+        $BugsHooks = "";
19
+        try{
20
+            $BugsHooks =  get_hook_array('Bugs');
21
+        }catch(Exception $e){}
22 22
 		
23
-		$this->assertFalse(is_array($BugsHooks));
23
+        $this->assertFalse(is_array($BugsHooks));
24 24
 		
25
-	}
25
+    }
26 26
 	
27 27
 	
28
-	private function getTestHook(){
28
+    private function getTestHook(){
29 29
 		
30
-		//array containing hooks array to test
30
+        //array containing hooks array to test
31 31
 		
32 32
         $hook_array = Array();
33 33
         $hook_array['after_ui_footer'] = Array();
@@ -43,80 +43,80 @@  discard block
 block discarded – undo
43 43
         $hook_array['after_restore'] = array();
44 44
         $hook_array['after_restore'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleRestore');
45 45
         
46
-		return $hook_array;
47
-	}
46
+        return $hook_array;
47
+    }
48 48
 	
49
-	public function check_existing_elementProvider()
50
-	{
51
-		//provide test cases dataset to validate 
52
-		
53
-		$hook_array = $this->getTestHook();
54
-		return array(
55
-				array($hook_array,'after_save',array(0,'popup_select'), true),
56
-				array($hook_array,'after_save',array(0,'foo'), false),
57
-				array($hook_array,'foo',array(0,'popup_select'), false),
58
-		);	
59
-	}
49
+    public function check_existing_elementProvider()
50
+    {
51
+        //provide test cases dataset to validate 
52
+		
53
+        $hook_array = $this->getTestHook();
54
+        return array(
55
+                array($hook_array,'after_save',array(0,'popup_select'), true),
56
+                array($hook_array,'after_save',array(0,'foo'), false),
57
+                array($hook_array,'foo',array(0,'popup_select'), false),
58
+        );	
59
+    }
60 60
 	
61
-	/**
62
-	 * @dataProvider check_existing_elementProvider
63
-	 */
64
-	public function testcheck_existing_element($hook_array, $event, $action_array, $expected)
65
-	{
66
-		//test with dataset containing valid and invalid cases
67
-		$this->assertSame( check_existing_element($hook_array,$event, $action_array) , $expected);
68
-		
69
-	}
61
+    /**
62
+     * @dataProvider check_existing_elementProvider
63
+     */
64
+    public function testcheck_existing_element($hook_array, $event, $action_array, $expected)
65
+    {
66
+        //test with dataset containing valid and invalid cases
67
+        $this->assertSame( check_existing_element($hook_array,$event, $action_array) , $expected);
68
+		
69
+    }
70 70
 	
71
-	public function testreplace_or_add_logic_type()
72
-	{
73
-		//execute the method and test if it returns expected values
71
+    public function testreplace_or_add_logic_type()
72
+    {
73
+        //execute the method and test if it returns expected values
74 74
 		
75
-		$hook_array = $this->getTestHook();
76
-		$expected = "<?php\n// Do not store anything in this file that is not part of the array or the hook version.  This file will	\n// be automatically rebuilt in the future. \n \$hook_version = 1; \n\$hook_array = Array(); \n// position, file, function \n\$hook_array['after_ui_footer'] = Array(); \n\$hook_array['after_ui_footer'][] = Array(10, 'popup_onload', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_onload'); \n\$hook_array['after_ui_frame'] = Array(); \n\$hook_array['after_ui_frame'][] = Array(20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'mass_assign'); \n\$hook_array['after_ui_frame'][] = Array(1, 'Load Social JS', 'custom/include/social/hooks.php','hooks', 'load_js'); \n\$hook_array['after_save'] = Array(); \n\$hook_array['after_save'][] = Array(30, 'popup_select', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_select'); \n\$hook_array['after_save'][] = Array(1, 'AOD Index Changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleChanges'); \n\$hook_array['after_delete'] = Array(); \n\$hook_array['after_delete'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleDelete'); \n\$hook_array['after_restore'] = Array(); \n\$hook_array['after_restore'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleRestore'); \n\n\n\n?>";
77
-		$this->assertEquals($expected,replace_or_add_logic_type($hook_array));
75
+        $hook_array = $this->getTestHook();
76
+        $expected = "<?php\n// Do not store anything in this file that is not part of the array or the hook version.  This file will	\n// be automatically rebuilt in the future. \n \$hook_version = 1; \n\$hook_array = Array(); \n// position, file, function \n\$hook_array['after_ui_footer'] = Array(); \n\$hook_array['after_ui_footer'][] = Array(10, 'popup_onload', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_onload'); \n\$hook_array['after_ui_frame'] = Array(); \n\$hook_array['after_ui_frame'][] = Array(20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'mass_assign'); \n\$hook_array['after_ui_frame'][] = Array(1, 'Load Social JS', 'custom/include/social/hooks.php','hooks', 'load_js'); \n\$hook_array['after_save'] = Array(); \n\$hook_array['after_save'][] = Array(30, 'popup_select', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_select'); \n\$hook_array['after_save'][] = Array(1, 'AOD Index Changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleChanges'); \n\$hook_array['after_delete'] = Array(); \n\$hook_array['after_delete'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleDelete'); \n\$hook_array['after_restore'] = Array(); \n\$hook_array['after_restore'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleRestore'); \n\n\n\n?>";
77
+        $this->assertEquals($expected,replace_or_add_logic_type($hook_array));
78 78
 		
79
-	}
79
+    }
80 80
 	
81
-	public function testwrite_logic_file()
82
-	{
83
-		//execute the method and test if it returns expected values, 
84
-		//check if file is created and contains expected contents
81
+    public function testwrite_logic_file()
82
+    {
83
+        //execute the method and test if it returns expected values, 
84
+        //check if file is created and contains expected contents
85 85
 	
86
-		$vfs = vfsStream::setup('custom/modules/TEST_Test');
86
+        $vfs = vfsStream::setup('custom/modules/TEST_Test');
87 87
 	
88
-		if ( $vfs->hasChild('logic_hooks.php')  == true) {
89
-			unlink('custom/modules/TEST_Test/logic_hooks.php');
90
-			rmdir('custom/modules/TEST_Test');
91
-		}
88
+        if ( $vfs->hasChild('logic_hooks.php')  == true) {
89
+            unlink('custom/modules/TEST_Test/logic_hooks.php');
90
+            rmdir('custom/modules/TEST_Test');
91
+        }
92 92
 		
93
-		$expectedContents = "<?php\n// Do not store anything in this file that is not part of the array or the hook version.  This file will	\n// be automatically rebuilt in the future. \n \$hook_version = 1; \n\$hook_array = Array(); \n// position, file, function \n\$hook_array['after_ui_footer'] = Array(); \n\$hook_array['after_ui_footer'][] = Array(10, 'popup_onload', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_onload'); \n\$hook_array['after_ui_frame'] = Array(); \n\$hook_array['after_ui_frame'][] = Array(20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'mass_assign'); \n\$hook_array['after_ui_frame'][] = Array(1, 'Load Social JS', 'custom/include/social/hooks.php','hooks', 'load_js'); \n\$hook_array['after_save'] = Array(); \n\$hook_array['after_save'][] = Array(30, 'popup_select', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_select'); \n\$hook_array['after_save'][] = Array(1, 'AOD Index Changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleChanges'); \n\$hook_array['after_delete'] = Array(); \n\$hook_array['after_delete'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleDelete'); \n\$hook_array['after_restore'] = Array(); \n\$hook_array['after_restore'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleRestore'); \n\n\n\n?>";
94
-		write_logic_file('TEST_Test',$expectedContents);
93
+        $expectedContents = "<?php\n// Do not store anything in this file that is not part of the array or the hook version.  This file will	\n// be automatically rebuilt in the future. \n \$hook_version = 1; \n\$hook_array = Array(); \n// position, file, function \n\$hook_array['after_ui_footer'] = Array(); \n\$hook_array['after_ui_footer'][] = Array(10, 'popup_onload', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_onload'); \n\$hook_array['after_ui_frame'] = Array(); \n\$hook_array['after_ui_frame'][] = Array(20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'mass_assign'); \n\$hook_array['after_ui_frame'][] = Array(1, 'Load Social JS', 'custom/include/social/hooks.php','hooks', 'load_js'); \n\$hook_array['after_save'] = Array(); \n\$hook_array['after_save'][] = Array(30, 'popup_select', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_select'); \n\$hook_array['after_save'][] = Array(1, 'AOD Index Changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleChanges'); \n\$hook_array['after_delete'] = Array(); \n\$hook_array['after_delete'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleDelete'); \n\$hook_array['after_restore'] = Array(); \n\$hook_array['after_restore'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleRestore'); \n\n\n\n?>";
94
+        write_logic_file('TEST_Test',$expectedContents);
95 95
 		
96
-		//Check file created
97
-		$this->assertFileExists('custom/modules/TEST_Test/logic_hooks.php');
98
-		$actualContents = file_get_contents('custom/modules/TEST_Test/logic_hooks.php');
99
-		$this->assertSame($expectedContents, $actualContents);
96
+        //Check file created
97
+        $this->assertFileExists('custom/modules/TEST_Test/logic_hooks.php');
98
+        $actualContents = file_get_contents('custom/modules/TEST_Test/logic_hooks.php');
99
+        $this->assertSame($expectedContents, $actualContents);
100 100
 		
101
-		$expectedArray = $this->getTestHook();
101
+        $expectedArray = $this->getTestHook();
102 102
 		
103
-		$actualArray = get_hook_array('TEST_Test');
103
+        $actualArray = get_hook_array('TEST_Test');
104 104
 		
105
-		$this->assertSame($expectedArray, $actualArray);
105
+        $this->assertSame($expectedArray, $actualArray);
106 106
 		
107
-		unlink('custom/modules/TEST_Test/logic_hooks.php');
108
-		rmdir('custom/modules/TEST_Test');		
107
+        unlink('custom/modules/TEST_Test/logic_hooks.php');
108
+        rmdir('custom/modules/TEST_Test');		
109 109
 		
110
-	}
110
+    }
111 111
 	
112
-	public function testbuild_logic_file()
113
-	{
114
-		//execute the method and test if it returns expected values
115
-		
116
-		$hook_array = $this->getTestHook();
117
-		$expected = "// Do not store anything in this file that is not part of the array or the hook version.  This file will	\n// be automatically rebuilt in the future. \n \$hook_version = 1; \n\$hook_array = Array(); \n// position, file, function \n\$hook_array['after_ui_footer'] = Array(); \n\$hook_array['after_ui_footer'][] = Array(10, 'popup_onload', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_onload'); \n\$hook_array['after_ui_frame'] = Array(); \n\$hook_array['after_ui_frame'][] = Array(20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'mass_assign'); \n\$hook_array['after_ui_frame'][] = Array(1, 'Load Social JS', 'custom/include/social/hooks.php','hooks', 'load_js'); \n\$hook_array['after_save'] = Array(); \n\$hook_array['after_save'][] = Array(30, 'popup_select', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_select'); \n\$hook_array['after_save'][] = Array(1, 'AOD Index Changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleChanges'); \n\$hook_array['after_delete'] = Array(); \n\$hook_array['after_delete'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleDelete'); \n\$hook_array['after_restore'] = Array(); \n\$hook_array['after_restore'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleRestore'); \n\n\n";
118
-		$this->assertEquals($expected,build_logic_file($hook_array));	
119
-	}
112
+    public function testbuild_logic_file()
113
+    {
114
+        //execute the method and test if it returns expected values
115
+		
116
+        $hook_array = $this->getTestHook();
117
+        $expected = "// Do not store anything in this file that is not part of the array or the hook version.  This file will	\n// be automatically rebuilt in the future. \n \$hook_version = 1; \n\$hook_array = Array(); \n// position, file, function \n\$hook_array['after_ui_footer'] = Array(); \n\$hook_array['after_ui_footer'][] = Array(10, 'popup_onload', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_onload'); \n\$hook_array['after_ui_frame'] = Array(); \n\$hook_array['after_ui_frame'][] = Array(20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'mass_assign'); \n\$hook_array['after_ui_frame'][] = Array(1, 'Load Social JS', 'custom/include/social/hooks.php','hooks', 'load_js'); \n\$hook_array['after_save'] = Array(); \n\$hook_array['after_save'][] = Array(30, 'popup_select', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_select'); \n\$hook_array['after_save'][] = Array(1, 'AOD Index Changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleChanges'); \n\$hook_array['after_delete'] = Array(); \n\$hook_array['after_delete'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleDelete'); \n\$hook_array['after_restore'] = Array(); \n\$hook_array['after_restore'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleRestore'); \n\n\n";
118
+        $this->assertEquals($expected,build_logic_file($hook_array));	
119
+    }
120 120
 	
121 121
 }
122 122
 ?>
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -11,37 +11,37 @@  discard block
 block discarded – undo
11 11
 	public function testget_hook_array()
12 12
 	{
13 13
 		//test with a vaid module. it will return an array
14
-		$AccountsHooks =  get_hook_array('Accounts');
14
+		$AccountsHooks = get_hook_array('Accounts');
15 15
 		$this->assertTrue(is_array($AccountsHooks));
16 16
 		
17 17
 		//test with an invalid array. it will throw an file include exception.
18 18
 		$BugsHooks = "";
19
-		try{
20
-			$BugsHooks =  get_hook_array('Bugs');
21
-		}catch(Exception $e){}
19
+		try {
20
+			$BugsHooks = get_hook_array('Bugs');
21
+		}catch (Exception $e) {}
22 22
 		
23 23
 		$this->assertFalse(is_array($BugsHooks));
24 24
 		
25 25
 	}
26 26
 	
27 27
 	
28
-	private function getTestHook(){
28
+	private function getTestHook() {
29 29
 		
30 30
 		//array containing hooks array to test
31 31
 		
32 32
         $hook_array = Array();
33 33
         $hook_array['after_ui_footer'] = Array();
34
-        $hook_array['after_ui_footer'][] = Array(10, 'popup_onload', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_onload');
34
+        $hook_array['after_ui_footer'][] = Array(10, 'popup_onload', 'modules/SecurityGroups/AssignGroups.php', 'AssignGroups', 'popup_onload');
35 35
         $hook_array['after_ui_frame'] = Array();
36
-        $hook_array['after_ui_frame'][] = Array(20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'mass_assign');
37
-        $hook_array['after_ui_frame'][] = Array(1, 'Load Social JS', 'custom/include/social/hooks.php','hooks', 'load_js');
36
+        $hook_array['after_ui_frame'][] = Array(20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php', 'AssignGroups', 'mass_assign');
37
+        $hook_array['after_ui_frame'][] = Array(1, 'Load Social JS', 'custom/include/social/hooks.php', 'hooks', 'load_js');
38 38
         $hook_array['after_save'] = Array();
39
-        $hook_array['after_save'][] = Array(30, 'popup_select', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_select');
40
-        $hook_array['after_save'][] = Array(1, 'AOD Index Changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleChanges');
39
+        $hook_array['after_save'][] = Array(30, 'popup_select', 'modules/SecurityGroups/AssignGroups.php', 'AssignGroups', 'popup_select');
40
+        $hook_array['after_save'][] = Array(1, 'AOD Index Changes', 'modules/AOD_Index/AOD_LogicHooks.php', 'AOD_LogicHooks', 'saveModuleChanges');
41 41
         $hook_array['after_delete'] = array();
42
-        $hook_array['after_delete'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleDelete');
42
+        $hook_array['after_delete'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php', 'AOD_LogicHooks', 'saveModuleDelete');
43 43
         $hook_array['after_restore'] = array();
44
-        $hook_array['after_restore'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleRestore');
44
+        $hook_array['after_restore'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php', 'AOD_LogicHooks', 'saveModuleRestore');
45 45
         
46 46
 		return $hook_array;
47 47
 	}
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 		
53 53
 		$hook_array = $this->getTestHook();
54 54
 		return array(
55
-				array($hook_array,'after_save',array(0,'popup_select'), true),
56
-				array($hook_array,'after_save',array(0,'foo'), false),
57
-				array($hook_array,'foo',array(0,'popup_select'), false),
55
+				array($hook_array, 'after_save', array(0, 'popup_select'), true),
56
+				array($hook_array, 'after_save', array(0, 'foo'), false),
57
+				array($hook_array, 'foo', array(0, 'popup_select'), false),
58 58
 		);	
59 59
 	}
60 60
 	
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	public function testcheck_existing_element($hook_array, $event, $action_array, $expected)
65 65
 	{
66 66
 		//test with dataset containing valid and invalid cases
67
-		$this->assertSame( check_existing_element($hook_array,$event, $action_array) , $expected);
67
+		$this->assertSame(check_existing_element($hook_array, $event, $action_array), $expected);
68 68
 		
69 69
 	}
70 70
 	
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		
75 75
 		$hook_array = $this->getTestHook();
76 76
 		$expected = "<?php\n// Do not store anything in this file that is not part of the array or the hook version.  This file will	\n// be automatically rebuilt in the future. \n \$hook_version = 1; \n\$hook_array = Array(); \n// position, file, function \n\$hook_array['after_ui_footer'] = Array(); \n\$hook_array['after_ui_footer'][] = Array(10, 'popup_onload', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_onload'); \n\$hook_array['after_ui_frame'] = Array(); \n\$hook_array['after_ui_frame'][] = Array(20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'mass_assign'); \n\$hook_array['after_ui_frame'][] = Array(1, 'Load Social JS', 'custom/include/social/hooks.php','hooks', 'load_js'); \n\$hook_array['after_save'] = Array(); \n\$hook_array['after_save'][] = Array(30, 'popup_select', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_select'); \n\$hook_array['after_save'][] = Array(1, 'AOD Index Changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleChanges'); \n\$hook_array['after_delete'] = Array(); \n\$hook_array['after_delete'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleDelete'); \n\$hook_array['after_restore'] = Array(); \n\$hook_array['after_restore'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleRestore'); \n\n\n\n?>";
77
-		$this->assertEquals($expected,replace_or_add_logic_type($hook_array));
77
+		$this->assertEquals($expected, replace_or_add_logic_type($hook_array));
78 78
 		
79 79
 	}
80 80
 	
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 	
86 86
 		$vfs = vfsStream::setup('custom/modules/TEST_Test');
87 87
 	
88
-		if ( $vfs->hasChild('logic_hooks.php')  == true) {
88
+		if ($vfs->hasChild('logic_hooks.php') == true) {
89 89
 			unlink('custom/modules/TEST_Test/logic_hooks.php');
90 90
 			rmdir('custom/modules/TEST_Test');
91 91
 		}
92 92
 		
93 93
 		$expectedContents = "<?php\n// Do not store anything in this file that is not part of the array or the hook version.  This file will	\n// be automatically rebuilt in the future. \n \$hook_version = 1; \n\$hook_array = Array(); \n// position, file, function \n\$hook_array['after_ui_footer'] = Array(); \n\$hook_array['after_ui_footer'][] = Array(10, 'popup_onload', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_onload'); \n\$hook_array['after_ui_frame'] = Array(); \n\$hook_array['after_ui_frame'][] = Array(20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'mass_assign'); \n\$hook_array['after_ui_frame'][] = Array(1, 'Load Social JS', 'custom/include/social/hooks.php','hooks', 'load_js'); \n\$hook_array['after_save'] = Array(); \n\$hook_array['after_save'][] = Array(30, 'popup_select', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_select'); \n\$hook_array['after_save'][] = Array(1, 'AOD Index Changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleChanges'); \n\$hook_array['after_delete'] = Array(); \n\$hook_array['after_delete'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleDelete'); \n\$hook_array['after_restore'] = Array(); \n\$hook_array['after_restore'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleRestore'); \n\n\n\n?>";
94
-		write_logic_file('TEST_Test',$expectedContents);
94
+		write_logic_file('TEST_Test', $expectedContents);
95 95
 		
96 96
 		//Check file created
97 97
 		$this->assertFileExists('custom/modules/TEST_Test/logic_hooks.php');
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		
116 116
 		$hook_array = $this->getTestHook();
117 117
 		$expected = "// Do not store anything in this file that is not part of the array or the hook version.  This file will	\n// be automatically rebuilt in the future. \n \$hook_version = 1; \n\$hook_array = Array(); \n// position, file, function \n\$hook_array['after_ui_footer'] = Array(); \n\$hook_array['after_ui_footer'][] = Array(10, 'popup_onload', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_onload'); \n\$hook_array['after_ui_frame'] = Array(); \n\$hook_array['after_ui_frame'][] = Array(20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'mass_assign'); \n\$hook_array['after_ui_frame'][] = Array(1, 'Load Social JS', 'custom/include/social/hooks.php','hooks', 'load_js'); \n\$hook_array['after_save'] = Array(); \n\$hook_array['after_save'][] = Array(30, 'popup_select', 'modules/SecurityGroups/AssignGroups.php','AssignGroups', 'popup_select'); \n\$hook_array['after_save'][] = Array(1, 'AOD Index Changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleChanges'); \n\$hook_array['after_delete'] = Array(); \n\$hook_array['after_delete'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleDelete'); \n\$hook_array['after_restore'] = Array(); \n\$hook_array['after_restore'][] = Array(1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php','AOD_LogicHooks', 'saveModuleRestore'); \n\n\n";
118
-		$this->assertEquals($expected,build_logic_file($hook_array));	
118
+		$this->assertEquals($expected, build_logic_file($hook_array));	
119 119
 	}
120 120
 	
121 121
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 		$BugsHooks = "";
19 19
 		try{
20 20
 			$BugsHooks =  get_hook_array('Bugs');
21
-		}catch(Exception $e){}
21
+		} catch(Exception $e){}
22 22
 		
23 23
 		$this->assertFalse(is_array($BugsHooks));
24 24
 		
Please login to merge, or discard this patch.
tests/tests/include/utils/dbUtilsTest.php 2 patches
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -6,130 +6,130 @@
 block discarded – undo
6 6
 
7 7
 	
8 8
 	
9
-	public function db_convertProvider()
10
-	{
11
-		//array containing all possible types supported by db_convert
12
-		return array(
13
-				array(gmdate('Y-m-d H:i:s'),'today',array(),'CURDATE()'),
14
-				array('text','left',array(2),'LEFT(text,2)'),
15
-				array('2015-11-16 19:10:52','date_format',array(),'DATE_FORMAT(2015-11-16 19:10:52,\'%Y-%m-%d\')'),
16
-				array('2015-11-16 19:10:52','time_format',array(), '2015-11-16 19:10:52' ),
17
-				array('2015-11-16','date',array(), '2015-11-16' ),
18
-				array('19:10:52','time',array(), '19:10:52' ),
19
-				array('2015-11-16 19:10:52','datetime',array(), '2015-11-16 19:10:52'),
20
-				array(Null,'ifnull',array(0), 'IFNULL(0)' ),
21
-				array('value1 ','concat',array('value2'), 'CONCAT(value1 ,value2)' ), 
22
-				array('2015-11-16 19:10:52','quarter',array(), 'QUARTER(2015-11-16 19:10:52)' ),
23
-				array('value1','length',array(), 'LENGTH(value1)' ),
24
-				array('2015-11-16 19:32:29', 'month',array(), 'MONTH(2015-11-16 19:32:29)' ),
25
-				array('2015-11-16','add_date',array('1','DAY'), 'DATE_ADD(2015-11-16, INTERVAL 1 DAY)' ),
26
-				array('19:10:52','add_time',array('1', 'HOUR'), 'DATE_ADD(19:10:52, INTERVAL + CONCAT(1, \':\', HOUR) HOUR_MINUTE)' ),
27
-				array('col','avg',array(2), 'avg(col)' ),
28
-				array('2015-11-16 19:32:29','add_tz_offset',array(), '2015-11-16 19:32:29 + INTERVAL 0 MINUTE' ),
9
+    public function db_convertProvider()
10
+    {
11
+        //array containing all possible types supported by db_convert
12
+        return array(
13
+                array(gmdate('Y-m-d H:i:s'),'today',array(),'CURDATE()'),
14
+                array('text','left',array(2),'LEFT(text,2)'),
15
+                array('2015-11-16 19:10:52','date_format',array(),'DATE_FORMAT(2015-11-16 19:10:52,\'%Y-%m-%d\')'),
16
+                array('2015-11-16 19:10:52','time_format',array(), '2015-11-16 19:10:52' ),
17
+                array('2015-11-16','date',array(), '2015-11-16' ),
18
+                array('19:10:52','time',array(), '19:10:52' ),
19
+                array('2015-11-16 19:10:52','datetime',array(), '2015-11-16 19:10:52'),
20
+                array(Null,'ifnull',array(0), 'IFNULL(0)' ),
21
+                array('value1 ','concat',array('value2'), 'CONCAT(value1 ,value2)' ), 
22
+                array('2015-11-16 19:10:52','quarter',array(), 'QUARTER(2015-11-16 19:10:52)' ),
23
+                array('value1','length',array(), 'LENGTH(value1)' ),
24
+                array('2015-11-16 19:32:29', 'month',array(), 'MONTH(2015-11-16 19:32:29)' ),
25
+                array('2015-11-16','add_date',array('1','DAY'), 'DATE_ADD(2015-11-16, INTERVAL 1 DAY)' ),
26
+                array('19:10:52','add_time',array('1', 'HOUR'), 'DATE_ADD(19:10:52, INTERVAL + CONCAT(1, \':\', HOUR) HOUR_MINUTE)' ),
27
+                array('col','avg',array(2), 'avg(col)' ),
28
+                array('2015-11-16 19:32:29','add_tz_offset',array(), '2015-11-16 19:32:29 + INTERVAL 0 MINUTE' ),
29 29
 				
30
-		);
31
-	}
32
-	
33
-	/**
34
-	 * @dataProvider db_convertProvider
35
-	 */	
36
-	public function testdb_convert($string, $type, $params, $expected)
37
-	{
38
-		//execute the method and test if it returns expected values for all types
39
-		$actual = db_convert($string, $type,$params);
40
-		$this->assertSame($expected,$actual);
41
-	}
42
-	
43
-	
44
-	public function testdb_concat()
45
-	{
46
-		error_reporting(E_ERROR | E_PARSE);
30
+        );
31
+    }
32
+	
33
+    /**
34
+     * @dataProvider db_convertProvider
35
+     */	
36
+    public function testdb_convert($string, $type, $params, $expected)
37
+    {
38
+        //execute the method and test if it returns expected values for all types
39
+        $actual = db_convert($string, $type,$params);
40
+        $this->assertSame($expected,$actual);
41
+    }
42
+	
43
+	
44
+    public function testdb_concat()
45
+    {
46
+        error_reporting(E_ERROR | E_PARSE);
47 47
 		
48
-		//execute the method and test if it returns expected values
48
+        //execute the method and test if it returns expected values
49 49
 		
50
-		$table = "Table1"; 
51
-		$fields = Array('Col1','Col2','Col3');
52
-		$expected = "LTRIM(RTRIM(CONCAT(IFNULL(Table1.Col1,''),'',IFNULL(Table1.Col2,''),'',IFNULL(Table1.Col3,''))))";
53
-		$actual = db_concat($table, $fields);
54
-		$this->assertSame($expected,$actual);
55
-	}
50
+        $table = "Table1"; 
51
+        $fields = Array('Col1','Col2','Col3');
52
+        $expected = "LTRIM(RTRIM(CONCAT(IFNULL(Table1.Col1,''),'',IFNULL(Table1.Col2,''),'',IFNULL(Table1.Col3,''))))";
53
+        $actual = db_concat($table, $fields);
54
+        $this->assertSame($expected,$actual);
55
+    }
56 56
 	
57 57
 	
58
-	public function testfrom_db_convert()
59
-	{
60
-		//execute the method and test if it returns expected values
58
+    public function testfrom_db_convert()
59
+    {
60
+        //execute the method and test if it returns expected values
61 61
 		
62
-		$this->assertSame("2015-11-16 19:32:29", from_db_convert("2015-11-16 19:32:29","date")); 
63
-		$this->assertSame("19:32:29",from_db_convert("19:32:29","time"));
64
-		$this->assertSame("2015-11-16 19:32:29",from_db_convert("2015-11-16 19:32:29","datetime"));
65
-		$this->assertSame("2015-11-16 19:32:29",from_db_convert("2015-11-16 19:32:29","datetimecombo"));
66
-		$this->assertSame("2015-11-16 19:32:29",from_db_convert("2015-11-16 19:32:29","timestamp"));
62
+        $this->assertSame("2015-11-16 19:32:29", from_db_convert("2015-11-16 19:32:29","date")); 
63
+        $this->assertSame("19:32:29",from_db_convert("19:32:29","time"));
64
+        $this->assertSame("2015-11-16 19:32:29",from_db_convert("2015-11-16 19:32:29","datetime"));
65
+        $this->assertSame("2015-11-16 19:32:29",from_db_convert("2015-11-16 19:32:29","datetimecombo"));
66
+        $this->assertSame("2015-11-16 19:32:29",from_db_convert("2015-11-16 19:32:29","timestamp"));
67 67
 		
68
-	}
68
+    }
69 69
 	
70 70
 	
71
-	public function testto_html()
72
-	{
73
-		//execute the method and test if it returns expected values
71
+    public function testto_html()
72
+    {
73
+        //execute the method and test if it returns expected values
74 74
 		
75
-		$string = "";
76
-		$expected = "";
77
-		$actual = to_html($string);
78
-		$this->assertSame($expected,$actual);
75
+        $string = "";
76
+        $expected = "";
77
+        $actual = to_html($string);
78
+        $this->assertSame($expected,$actual);
79 79
 		
80
-		$string = "'test'&trial<\">";
81
-		$expected = "&#039;test&#039;&trial&lt;&quot;&gt;";
82
-		$actual = to_html($string);
83
-		$this->assertSame($expected,$actual);
80
+        $string = "'test'&trial<\">";
81
+        $expected = "&#039;test&#039;&trial&lt;&quot;&gt;";
82
+        $actual = to_html($string);
83
+        $this->assertSame($expected,$actual);
84 84
 		
85
-	}
85
+    }
86 86
 	
87 87
 	
88 88
 	
89
-	public function testfrom_html() 
90
-	{
89
+    public function testfrom_html() 
90
+    {
91 91
 	
92
-		$string = "";
93
-		$expected = "";
94
-		$actual = from_html($string);
95
-		$this->assertSame($expected,$actual);
92
+        $string = "";
93
+        $expected = "";
94
+        $actual = from_html($string);
95
+        $this->assertSame($expected,$actual);
96 96
 		
97
-		$string = "&#039;test&#039;&trial&lt;&quot;&gt;";
98
-		$expected = "'test'&trial<\">"; 
99
-		$actual = from_html($string);
100
-		$this->assertSame($expected,$actual);
97
+        $string = "&#039;test&#039;&trial&lt;&quot;&gt;";
98
+        $expected = "'test'&trial<\">"; 
99
+        $actual = from_html($string);
100
+        $this->assertSame($expected,$actual);
101 101
 		
102
-	}
102
+    }
103 103
 	
104 104
 	
105
-	public function testgetValidDBName()
106
-	{
107
-		$expected ="";
108
-		$actual = getValidDBName("");
109
-		$this->assertSame($expected,$actual);
105
+    public function testgetValidDBName()
106
+    {
107
+        $expected ="";
108
+        $actual = getValidDBName("");
109
+        $this->assertSame($expected,$actual);
110 110
 		
111 111
 		
112
-		$expected = "col";
113
-		$actual = getValidDBName("Col");
114
-		$this->assertSame($expected,$actual);
112
+        $expected = "col";
113
+        $actual = getValidDBName("Col");
114
+        $this->assertSame($expected,$actual);
115 115
 		
116
-	}
116
+    }
117 117
 	
118 118
 	
119
-	public function testisValidDBName()
120
-	{
121
-		//valid value
122
-		$expected = true;
123
-		$actual = isValidDBName("suitecrmtest","mysql");
124
-		$this->assertSame($expected,$actual);
119
+    public function testisValidDBName()
120
+    {
121
+        //valid value
122
+        $expected = true;
123
+        $actual = isValidDBName("suitecrmtest","mysql");
124
+        $this->assertSame($expected,$actual);
125 125
 
126
-		//invalid value
127
-		$expected = false;
128
-		$actual = isValidDBName("suite/crm.test","mysql");
129
-		$this->assertSame($expected,$actual);
126
+        //invalid value
127
+        $expected = false;
128
+        $actual = isValidDBName("suite/crm.test","mysql");
129
+        $this->assertSame($expected,$actual);
130 130
 		
131 131
 		
132
-	}
132
+    }
133 133
 
134 134
 	
135 135
 }
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -10,22 +10,22 @@  discard block
 block discarded – undo
10 10
 	{
11 11
 		//array containing all possible types supported by db_convert
12 12
 		return array(
13
-				array(gmdate('Y-m-d H:i:s'),'today',array(),'CURDATE()'),
14
-				array('text','left',array(2),'LEFT(text,2)'),
15
-				array('2015-11-16 19:10:52','date_format',array(),'DATE_FORMAT(2015-11-16 19:10:52,\'%Y-%m-%d\')'),
16
-				array('2015-11-16 19:10:52','time_format',array(), '2015-11-16 19:10:52' ),
17
-				array('2015-11-16','date',array(), '2015-11-16' ),
18
-				array('19:10:52','time',array(), '19:10:52' ),
19
-				array('2015-11-16 19:10:52','datetime',array(), '2015-11-16 19:10:52'),
20
-				array(Null,'ifnull',array(0), 'IFNULL(0)' ),
21
-				array('value1 ','concat',array('value2'), 'CONCAT(value1 ,value2)' ), 
22
-				array('2015-11-16 19:10:52','quarter',array(), 'QUARTER(2015-11-16 19:10:52)' ),
23
-				array('value1','length',array(), 'LENGTH(value1)' ),
24
-				array('2015-11-16 19:32:29', 'month',array(), 'MONTH(2015-11-16 19:32:29)' ),
25
-				array('2015-11-16','add_date',array('1','DAY'), 'DATE_ADD(2015-11-16, INTERVAL 1 DAY)' ),
26
-				array('19:10:52','add_time',array('1', 'HOUR'), 'DATE_ADD(19:10:52, INTERVAL + CONCAT(1, \':\', HOUR) HOUR_MINUTE)' ),
27
-				array('col','avg',array(2), 'avg(col)' ),
28
-				array('2015-11-16 19:32:29','add_tz_offset',array(), '2015-11-16 19:32:29 + INTERVAL 0 MINUTE' ),
13
+				array(gmdate('Y-m-d H:i:s'), 'today', array(), 'CURDATE()'),
14
+				array('text', 'left', array(2), 'LEFT(text,2)'),
15
+				array('2015-11-16 19:10:52', 'date_format', array(), 'DATE_FORMAT(2015-11-16 19:10:52,\'%Y-%m-%d\')'),
16
+				array('2015-11-16 19:10:52', 'time_format', array(), '2015-11-16 19:10:52'),
17
+				array('2015-11-16', 'date', array(), '2015-11-16'),
18
+				array('19:10:52', 'time', array(), '19:10:52'),
19
+				array('2015-11-16 19:10:52', 'datetime', array(), '2015-11-16 19:10:52'),
20
+				array(Null, 'ifnull', array(0), 'IFNULL(0)'),
21
+				array('value1 ', 'concat', array('value2'), 'CONCAT(value1 ,value2)'), 
22
+				array('2015-11-16 19:10:52', 'quarter', array(), 'QUARTER(2015-11-16 19:10:52)'),
23
+				array('value1', 'length', array(), 'LENGTH(value1)'),
24
+				array('2015-11-16 19:32:29', 'month', array(), 'MONTH(2015-11-16 19:32:29)'),
25
+				array('2015-11-16', 'add_date', array('1', 'DAY'), 'DATE_ADD(2015-11-16, INTERVAL 1 DAY)'),
26
+				array('19:10:52', 'add_time', array('1', 'HOUR'), 'DATE_ADD(19:10:52, INTERVAL + CONCAT(1, \':\', HOUR) HOUR_MINUTE)'),
27
+				array('col', 'avg', array(2), 'avg(col)'),
28
+				array('2015-11-16 19:32:29', 'add_tz_offset', array(), '2015-11-16 19:32:29 + INTERVAL 0 MINUTE'),
29 29
 				
30 30
 		);
31 31
 	}
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 	public function testdb_convert($string, $type, $params, $expected)
37 37
 	{
38 38
 		//execute the method and test if it returns expected values for all types
39
-		$actual = db_convert($string, $type,$params);
40
-		$this->assertSame($expected,$actual);
39
+		$actual = db_convert($string, $type, $params);
40
+		$this->assertSame($expected, $actual);
41 41
 	}
42 42
 	
43 43
 	
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 		//execute the method and test if it returns expected values
49 49
 		
50 50
 		$table = "Table1"; 
51
-		$fields = Array('Col1','Col2','Col3');
51
+		$fields = Array('Col1', 'Col2', 'Col3');
52 52
 		$expected = "LTRIM(RTRIM(CONCAT(IFNULL(Table1.Col1,''),'',IFNULL(Table1.Col2,''),'',IFNULL(Table1.Col3,''))))";
53 53
 		$actual = db_concat($table, $fields);
54
-		$this->assertSame($expected,$actual);
54
+		$this->assertSame($expected, $actual);
55 55
 	}
56 56
 	
57 57
 	
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 	{
60 60
 		//execute the method and test if it returns expected values
61 61
 		
62
-		$this->assertSame("2015-11-16 19:32:29", from_db_convert("2015-11-16 19:32:29","date")); 
63
-		$this->assertSame("19:32:29",from_db_convert("19:32:29","time"));
64
-		$this->assertSame("2015-11-16 19:32:29",from_db_convert("2015-11-16 19:32:29","datetime"));
65
-		$this->assertSame("2015-11-16 19:32:29",from_db_convert("2015-11-16 19:32:29","datetimecombo"));
66
-		$this->assertSame("2015-11-16 19:32:29",from_db_convert("2015-11-16 19:32:29","timestamp"));
62
+		$this->assertSame("2015-11-16 19:32:29", from_db_convert("2015-11-16 19:32:29", "date")); 
63
+		$this->assertSame("19:32:29", from_db_convert("19:32:29", "time"));
64
+		$this->assertSame("2015-11-16 19:32:29", from_db_convert("2015-11-16 19:32:29", "datetime"));
65
+		$this->assertSame("2015-11-16 19:32:29", from_db_convert("2015-11-16 19:32:29", "datetimecombo"));
66
+		$this->assertSame("2015-11-16 19:32:29", from_db_convert("2015-11-16 19:32:29", "timestamp"));
67 67
 		
68 68
 	}
69 69
 	
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		$string = "";
76 76
 		$expected = "";
77 77
 		$actual = to_html($string);
78
-		$this->assertSame($expected,$actual);
78
+		$this->assertSame($expected, $actual);
79 79
 		
80 80
 		$string = "'test'&trial<\">";
81 81
 		$expected = "&#039;test&#039;&trial&lt;&quot;&gt;";
82 82
 		$actual = to_html($string);
83
-		$this->assertSame($expected,$actual);
83
+		$this->assertSame($expected, $actual);
84 84
 		
85 85
 	}
86 86
 	
@@ -92,26 +92,26 @@  discard block
 block discarded – undo
92 92
 		$string = "";
93 93
 		$expected = "";
94 94
 		$actual = from_html($string);
95
-		$this->assertSame($expected,$actual);
95
+		$this->assertSame($expected, $actual);
96 96
 		
97 97
 		$string = "&#039;test&#039;&trial&lt;&quot;&gt;";
98 98
 		$expected = "'test'&trial<\">"; 
99 99
 		$actual = from_html($string);
100
-		$this->assertSame($expected,$actual);
100
+		$this->assertSame($expected, $actual);
101 101
 		
102 102
 	}
103 103
 	
104 104
 	
105 105
 	public function testgetValidDBName()
106 106
 	{
107
-		$expected ="";
107
+		$expected = "";
108 108
 		$actual = getValidDBName("");
109
-		$this->assertSame($expected,$actual);
109
+		$this->assertSame($expected, $actual);
110 110
 		
111 111
 		
112 112
 		$expected = "col";
113 113
 		$actual = getValidDBName("Col");
114
-		$this->assertSame($expected,$actual);
114
+		$this->assertSame($expected, $actual);
115 115
 		
116 116
 	}
117 117
 	
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 	{
121 121
 		//valid value
122 122
 		$expected = true;
123
-		$actual = isValidDBName("suitecrmtest","mysql");
124
-		$this->assertSame($expected,$actual);
123
+		$actual = isValidDBName("suitecrmtest", "mysql");
124
+		$this->assertSame($expected, $actual);
125 125
 
126 126
 		//invalid value
127 127
 		$expected = false;
128
-		$actual = isValidDBName("suite/crm.test","mysql");
129
-		$this->assertSame($expected,$actual);
128
+		$actual = isValidDBName("suite/crm.test", "mysql");
129
+		$this->assertSame($expected, $actual);
130 130
 		
131 131
 		
132 132
 	}
Please login to merge, or discard this patch.
tests/tests/include/utils/layoutUtilsTest.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -6,113 +6,113 @@
 block discarded – undo
6 6
 {
7 7
 	
8 8
 
9
-	public function testget_form_header()
10
-	{
11
-		error_reporting(E_ERROR | E_PARSE);
9
+    public function testget_form_header()
10
+    {
11
+        error_reporting(E_ERROR | E_PARSE);
12 12
 		
13
-		//execute the method and test if it returns html and contains the values provided in parameters
13
+        //execute the method and test if it returns html and contains the values provided in parameters
14 14
 		
15
-		//help param true
16
-		$html1 = get_form_header("test Header", "test subheader", true);
17
-		$this->assertGreaterThan(0,strlen($html1));
18
-		$this->assertNotFalse(strpos($html1,"test Header"));
19
-		$this->assertNotFalse(strpos($html1,"test subheader"));
15
+        //help param true
16
+        $html1 = get_form_header("test Header", "test subheader", true);
17
+        $this->assertGreaterThan(0,strlen($html1));
18
+        $this->assertNotFalse(strpos($html1,"test Header"));
19
+        $this->assertNotFalse(strpos($html1,"test subheader"));
20 20
 		
21 21
 		
22
-		// help param false
23
-		$html2 = get_form_header("new test Header", "new test subheader", false);
24
-		$this->assertGreaterThan(0,strlen($html2));
25
-		$this->assertNotFalse(strpos($html2,"new test Header"));
26
-		$this->assertNotFalse(strpos($html2,"new test subheader"));
22
+        // help param false
23
+        $html2 = get_form_header("new test Header", "new test subheader", false);
24
+        $this->assertGreaterThan(0,strlen($html2));
25
+        $this->assertNotFalse(strpos($html2,"new test Header"));
26
+        $this->assertNotFalse(strpos($html2,"new test subheader"));
27 27
 		
28 28
 		
29
-		$this->assertGreaterThan(strlen($html2),strlen($html1));
29
+        $this->assertGreaterThan(strlen($html2),strlen($html1));
30 30
 		
31
-	}
31
+    }
32 32
 	
33 33
 	
34
-	public function testget_module_title( )
35
-	{
36
-		//execute the method and test if it returns html and contains the values provided in parameters
37
-		
38
-		//with show_create true, generates more html
39
-		$html1 = get_module_title("Users", "Users Home", true );
40
-		$this->assertGreaterThan(0,strlen($html1));
41
-		$this->assertNotFalse(strpos($html1,"Users"));
42
-		$this->assertNotFalse(strpos($html1,"Users Home"));
43
-		
44
-		//with show_create false, generates less html
45
-		$html2 = get_module_title("Users", "Users Home", false );
46
-		$this->assertGreaterThan(0,strlen($html2));
47
-		$this->assertNotFalse(strpos($html2,"Users"));
48
-		$this->assertNotFalse(strpos($html2,"Users Home"));
49
-		$this->assertGreaterThan(strlen($html2),strlen($html1));
34
+    public function testget_module_title( )
35
+    {
36
+        //execute the method and test if it returns html and contains the values provided in parameters
37
+		
38
+        //with show_create true, generates more html
39
+        $html1 = get_module_title("Users", "Users Home", true );
40
+        $this->assertGreaterThan(0,strlen($html1));
41
+        $this->assertNotFalse(strpos($html1,"Users"));
42
+        $this->assertNotFalse(strpos($html1,"Users Home"));
43
+		
44
+        //with show_create false, generates less html
45
+        $html2 = get_module_title("Users", "Users Home", false );
46
+        $this->assertGreaterThan(0,strlen($html2));
47
+        $this->assertNotFalse(strpos($html2,"Users"));
48
+        $this->assertNotFalse(strpos($html2,"Users Home"));
49
+        $this->assertGreaterThan(strlen($html2),strlen($html1));
50 50
 
51
-		//with show_create flase and count > 1, generates more html compared to count =0
52
-		$html3 = get_module_title("Users", "Users Home", false, 2 );
53
-		$this->assertGreaterThan(0,strlen($html3));
54
-		$this->assertNotFalse(strpos($html3,"Users"));
55
-		$this->assertNotFalse(strpos($html3,"Users Home"));
56
-		$this->assertGreaterThan(strlen($html2),strlen($html3));
57
-		$this->assertGreaterThan(strlen($html3),strlen($html1));
58
-		
59
-	}
51
+        //with show_create flase and count > 1, generates more html compared to count =0
52
+        $html3 = get_module_title("Users", "Users Home", false, 2 );
53
+        $this->assertGreaterThan(0,strlen($html3));
54
+        $this->assertNotFalse(strpos($html3,"Users"));
55
+        $this->assertNotFalse(strpos($html3,"Users Home"));
56
+        $this->assertGreaterThan(strlen($html2),strlen($html3));
57
+        $this->assertGreaterThan(strlen($html3),strlen($html1));
58
+		
59
+    }
60 60
 	
61 61
 	
62
-	public function testgetClassicModuleTitle()
63
-	{
64
-		//execute the method and test if it returns html and contains the values provided in parameters
62
+    public function testgetClassicModuleTitle()
63
+    {
64
+        //execute the method and test if it returns html and contains the values provided in parameters
65 65
 		
66
-		//with show_create false, generates less html
67
-		$html1 = getClassicModuleTitle("users", Array('Users Home'));
68
-		$this->assertGreaterThan(0,strlen($html1));
69
-		$this->assertNotFalse(strpos($html1,"Users Home"));
66
+        //with show_create false, generates less html
67
+        $html1 = getClassicModuleTitle("users", Array('Users Home'));
68
+        $this->assertGreaterThan(0,strlen($html1));
69
+        $this->assertNotFalse(strpos($html1,"Users Home"));
70 70
 		
71 71
 
72
-		//with show_create true, generates more html
73
-		$html2 = getClassicModuleTitle("users", Array('Users Home'),true);
74
-		$this->assertGreaterThan(0,strlen($html2));
75
-		$this->assertNotFalse(strpos($html2,"Users Home"));
76
-		$this->assertGreaterThan(strlen($html1),strlen($html2));
72
+        //with show_create true, generates more html
73
+        $html2 = getClassicModuleTitle("users", Array('Users Home'),true);
74
+        $this->assertGreaterThan(0,strlen($html2));
75
+        $this->assertNotFalse(strpos($html2,"Users Home"));
76
+        $this->assertGreaterThan(strlen($html1),strlen($html2));
77 77
 		
78
-	}
78
+    }
79 79
 	
80 80
 	
81
-	public function testinsert_popup_header()
82
-	{
83
-		//execute the method and test if it returns html/JS
81
+    public function testinsert_popup_header()
82
+    {
83
+        //execute the method and test if it returns html/JS
84 84
 		
85
-		//with includeJS true, generates more html		
86
-		ob_start();
87
-		insert_popup_header();
88
-		$renderedContent1 = ob_get_contents();
89
-		ob_end_clean();
90
-		$this->assertGreaterThan(0,strlen($renderedContent1));
85
+        //with includeJS true, generates more html		
86
+        ob_start();
87
+        insert_popup_header();
88
+        $renderedContent1 = ob_get_contents();
89
+        ob_end_clean();
90
+        $this->assertGreaterThan(0,strlen($renderedContent1));
91 91
 		
92 92
 		
93
-		//with includeJS false, generates less html
94
-		ob_start();
95
-		insert_popup_header('',false);
96
-		$renderedContent2 = ob_get_contents();
97
-		ob_end_clean();
98
-		$this->assertGreaterThan(0,strlen($renderedContent2));		
93
+        //with includeJS false, generates less html
94
+        ob_start();
95
+        insert_popup_header('',false);
96
+        $renderedContent2 = ob_get_contents();
97
+        ob_end_clean();
98
+        $this->assertGreaterThan(0,strlen($renderedContent2));		
99 99
 		
100
-		$this->assertGreaterThan(strlen($renderedContent2),strlen($renderedContent1));
100
+        $this->assertGreaterThan(strlen($renderedContent2),strlen($renderedContent1));
101 101
 		
102
-	}
102
+    }
103 103
 	
104 104
 	
105
-	public function testinsert_popup_footer()
106
-	{
107
-		//execute the method and test if it returns html 
105
+    public function testinsert_popup_footer()
106
+    {
107
+        //execute the method and test if it returns html 
108 108
 		
109
-		ob_start();
110
-		insert_popup_footer();
111
-		$renderedContent = ob_get_contents();
112
-		ob_end_clean();
113
-		$this->assertGreaterThan(0,strlen($renderedContent));
109
+        ob_start();
110
+        insert_popup_footer();
111
+        $renderedContent = ob_get_contents();
112
+        ob_end_clean();
113
+        $this->assertGreaterThan(0,strlen($renderedContent));
114 114
 		
115
-	}
115
+    }
116 116
 
117 117
 }
118 118
 ?>
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@  discard block
 block discarded – undo
14 14
 		
15 15
 		//help param true
16 16
 		$html1 = get_form_header("test Header", "test subheader", true);
17
-		$this->assertGreaterThan(0,strlen($html1));
18
-		$this->assertNotFalse(strpos($html1,"test Header"));
19
-		$this->assertNotFalse(strpos($html1,"test subheader"));
17
+		$this->assertGreaterThan(0, strlen($html1));
18
+		$this->assertNotFalse(strpos($html1, "test Header"));
19
+		$this->assertNotFalse(strpos($html1, "test subheader"));
20 20
 		
21 21
 		
22 22
 		// help param false
23 23
 		$html2 = get_form_header("new test Header", "new test subheader", false);
24
-		$this->assertGreaterThan(0,strlen($html2));
25
-		$this->assertNotFalse(strpos($html2,"new test Header"));
26
-		$this->assertNotFalse(strpos($html2,"new test subheader"));
24
+		$this->assertGreaterThan(0, strlen($html2));
25
+		$this->assertNotFalse(strpos($html2, "new test Header"));
26
+		$this->assertNotFalse(strpos($html2, "new test subheader"));
27 27
 		
28 28
 		
29
-		$this->assertGreaterThan(strlen($html2),strlen($html1));
29
+		$this->assertGreaterThan(strlen($html2), strlen($html1));
30 30
 		
31 31
 	}
32 32
 	
@@ -36,25 +36,25 @@  discard block
 block discarded – undo
36 36
 		//execute the method and test if it returns html and contains the values provided in parameters
37 37
 		
38 38
 		//with show_create true, generates more html
39
-		$html1 = get_module_title("Users", "Users Home", true );
40
-		$this->assertGreaterThan(0,strlen($html1));
41
-		$this->assertNotFalse(strpos($html1,"Users"));
42
-		$this->assertNotFalse(strpos($html1,"Users Home"));
39
+		$html1 = get_module_title("Users", "Users Home", true);
40
+		$this->assertGreaterThan(0, strlen($html1));
41
+		$this->assertNotFalse(strpos($html1, "Users"));
42
+		$this->assertNotFalse(strpos($html1, "Users Home"));
43 43
 		
44 44
 		//with show_create false, generates less html
45
-		$html2 = get_module_title("Users", "Users Home", false );
46
-		$this->assertGreaterThan(0,strlen($html2));
47
-		$this->assertNotFalse(strpos($html2,"Users"));
48
-		$this->assertNotFalse(strpos($html2,"Users Home"));
49
-		$this->assertGreaterThan(strlen($html2),strlen($html1));
45
+		$html2 = get_module_title("Users", "Users Home", false);
46
+		$this->assertGreaterThan(0, strlen($html2));
47
+		$this->assertNotFalse(strpos($html2, "Users"));
48
+		$this->assertNotFalse(strpos($html2, "Users Home"));
49
+		$this->assertGreaterThan(strlen($html2), strlen($html1));
50 50
 
51 51
 		//with show_create flase and count > 1, generates more html compared to count =0
52
-		$html3 = get_module_title("Users", "Users Home", false, 2 );
53
-		$this->assertGreaterThan(0,strlen($html3));
54
-		$this->assertNotFalse(strpos($html3,"Users"));
55
-		$this->assertNotFalse(strpos($html3,"Users Home"));
56
-		$this->assertGreaterThan(strlen($html2),strlen($html3));
57
-		$this->assertGreaterThan(strlen($html3),strlen($html1));
52
+		$html3 = get_module_title("Users", "Users Home", false, 2);
53
+		$this->assertGreaterThan(0, strlen($html3));
54
+		$this->assertNotFalse(strpos($html3, "Users"));
55
+		$this->assertNotFalse(strpos($html3, "Users Home"));
56
+		$this->assertGreaterThan(strlen($html2), strlen($html3));
57
+		$this->assertGreaterThan(strlen($html3), strlen($html1));
58 58
 		
59 59
 	}
60 60
 	
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
 		
66 66
 		//with show_create false, generates less html
67 67
 		$html1 = getClassicModuleTitle("users", Array('Users Home'));
68
-		$this->assertGreaterThan(0,strlen($html1));
69
-		$this->assertNotFalse(strpos($html1,"Users Home"));
68
+		$this->assertGreaterThan(0, strlen($html1));
69
+		$this->assertNotFalse(strpos($html1, "Users Home"));
70 70
 		
71 71
 
72 72
 		//with show_create true, generates more html
73
-		$html2 = getClassicModuleTitle("users", Array('Users Home'),true);
74
-		$this->assertGreaterThan(0,strlen($html2));
75
-		$this->assertNotFalse(strpos($html2,"Users Home"));
76
-		$this->assertGreaterThan(strlen($html1),strlen($html2));
73
+		$html2 = getClassicModuleTitle("users", Array('Users Home'), true);
74
+		$this->assertGreaterThan(0, strlen($html2));
75
+		$this->assertNotFalse(strpos($html2, "Users Home"));
76
+		$this->assertGreaterThan(strlen($html1), strlen($html2));
77 77
 		
78 78
 	}
79 79
 	
@@ -87,17 +87,17 @@  discard block
 block discarded – undo
87 87
 		insert_popup_header();
88 88
 		$renderedContent1 = ob_get_contents();
89 89
 		ob_end_clean();
90
-		$this->assertGreaterThan(0,strlen($renderedContent1));
90
+		$this->assertGreaterThan(0, strlen($renderedContent1));
91 91
 		
92 92
 		
93 93
 		//with includeJS false, generates less html
94 94
 		ob_start();
95
-		insert_popup_header('',false);
95
+		insert_popup_header('', false);
96 96
 		$renderedContent2 = ob_get_contents();
97 97
 		ob_end_clean();
98
-		$this->assertGreaterThan(0,strlen($renderedContent2));		
98
+		$this->assertGreaterThan(0, strlen($renderedContent2));		
99 99
 		
100
-		$this->assertGreaterThan(strlen($renderedContent2),strlen($renderedContent1));
100
+		$this->assertGreaterThan(strlen($renderedContent2), strlen($renderedContent1));
101 101
 		
102 102
 	}
103 103
 	
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		insert_popup_footer();
111 111
 		$renderedContent = ob_get_contents();
112 112
 		ob_end_clean();
113
-		$this->assertGreaterThan(0,strlen($renderedContent));
113
+		$this->assertGreaterThan(0, strlen($renderedContent));
114 114
 		
115 115
 	}
116 116
 
Please login to merge, or discard this patch.
tests/tests/include/utils/autoloaderTest.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -6,36 +6,36 @@
 block discarded – undo
6 6
 
7 7
 
8 8
     public function testautoload()
9
-	{
10
-		//execute the method and test if it returns expected values
9
+    {
10
+        //execute the method and test if it returns expected values
11 11
 		
12
-		//test with a invalid class .
13
-		$result = SugarAutoLoader::autoload('foo');
14
-		$this->assertFalse($result);
12
+        //test with a invalid class .
13
+        $result = SugarAutoLoader::autoload('foo');
14
+        $this->assertFalse($result);
15 15
 		
16
-		//test with a valid class out of autoload mappings.
17
-		$result = SugarAutoLoader::autoload('SugarArray');
18
-		$this->assertFalse($result);
16
+        //test with a valid class out of autoload mappings.
17
+        $result = SugarAutoLoader::autoload('SugarArray');
18
+        $this->assertFalse($result);
19 19
 		
20
-		//test with a valid class registered in autoload mappings
21
-		$result = SugarAutoLoader::autoload('User');
22
-		$this->assertTrue($result);
20
+        //test with a valid class registered in autoload mappings
21
+        $result = SugarAutoLoader::autoload('User');
22
+        $this->assertTrue($result);
23 23
 		
24
-	}
24
+    }
25 25
 
26 26
 
27
-	public function testloadAll(){
27
+    public function testloadAll(){
28 28
 		
29
-		//execute the method and check if it works and doesn't throws an exception
30
-		//this method only includes file so there is no output to test.
31
-		try {
32
-			SugarAutoLoader::loadAll();
33
-			$this->assertTrue(TRUE);
34
-		} catch (Exception $e) {
35
-			$this->fail();
36
-		}
29
+        //execute the method and check if it works and doesn't throws an exception
30
+        //this method only includes file so there is no output to test.
31
+        try {
32
+            SugarAutoLoader::loadAll();
33
+            $this->assertTrue(TRUE);
34
+        } catch (Exception $e) {
35
+            $this->fail();
36
+        }
37 37
 		 
38
-	}
38
+    }
39 39
 	
40 40
 }
41 41
 ?>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 
4 4
 
5
-class SugarAutoLoaderTest extends PHPUnit_Framework_TestCase{
5
+class SugarAutoLoaderTest extends PHPUnit_Framework_TestCase {
6 6
 
7 7
 
8 8
     public function testautoload()
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
 	}
25 25
 
26 26
 
27
-	public function testloadAll(){
27
+	public function testloadAll() {
28 28
 		
29 29
 		//execute the method and check if it works and doesn't throws an exception
30 30
 		//this method only includes file so there is no output to test.
31 31
 		try {
32 32
 			SugarAutoLoader::loadAll();
33 33
 			$this->assertTrue(TRUE);
34
-		} catch (Exception $e) {
34
+		}catch (Exception $e) {
35 35
 			$this->fail();
36 36
 		}
37 37
 		 
Please login to merge, or discard this patch.
tests/tests/include/utils/zipUtilsTest.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -5,22 +5,22 @@
 block discarded – undo
5 5
 {
6 6
 
7 7
 	
8
-	public function testunzip(){
9
-		$this->markTestIncomplete('Can Not be implemented');
10
-	}
8
+    public function testunzip(){
9
+        $this->markTestIncomplete('Can Not be implemented');
10
+    }
11 11
 	
12
-	public function testunzip_file(){
13
-		$this->markTestIncomplete('Can Not be implemented');
14
-	}
12
+    public function testunzip_file(){
13
+        $this->markTestIncomplete('Can Not be implemented');
14
+    }
15 15
 	
16
-	public function testzip_dir(){
17
-		$this->markTestIncomplete('Can Not be implemented');
18
-	}
16
+    public function testzip_dir(){
17
+        $this->markTestIncomplete('Can Not be implemented');
18
+    }
19 19
 	
20 20
 	
21
-	public function testzip_files_list()
22
-	{
23
-		$this->markTestIncomplete('Can Not be implemented');
24
-	}
21
+    public function testzip_files_list()
22
+    {
23
+        $this->markTestIncomplete('Can Not be implemented');
24
+    }
25 25
 
26 26
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,15 +5,15 @@
 block discarded – undo
5 5
 {
6 6
 
7 7
 	
8
-	public function testunzip(){
8
+	public function testunzip() {
9 9
 		$this->markTestIncomplete('Can Not be implemented');
10 10
 	}
11 11
 	
12
-	public function testunzip_file(){
12
+	public function testunzip_file() {
13 13
 		$this->markTestIncomplete('Can Not be implemented');
14 14
 	}
15 15
 	
16
-	public function testzip_dir(){
16
+	public function testzip_dir() {
17 17
 		$this->markTestIncomplete('Can Not be implemented');
18 18
 	}
19 19
 	
Please login to merge, or discard this patch.