Test Failed
Push — master ( e0c20c...b8c830 )
by Alxarafe
39:29
created
dolibarr/test/phpunit/MarginsLibTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *		\remarks	To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	$user->fetch(1);
36 36
 	$user->getrights();
37 37
 }
38
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
38
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
39 39
 
40 40
 
41 41
 /**
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 		parent::__construct();
64 64
 
65 65
 		//$this->sharedFixture
66
-		global $conf,$user,$langs,$db;
67
-		$this->savconf=$conf;
68
-		$this->savuser=$user;
69
-		$this->savlangs=$langs;
70
-		$this->savdb=$db;
66
+		global $conf, $user, $langs, $db;
67
+		$this->savconf = $conf;
68
+		$this->savuser = $user;
69
+		$this->savlangs = $langs;
70
+		$this->savdb = $db;
71 71
 
72 72
 		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73 73
 		//print " - db ".$db->db;
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	// Static methods
78 78
   	public static function setUpBeforeClass()
79 79
     {
80
-    	global $conf,$user,$langs,$db;
81
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
80
+    	global $conf, $user, $langs, $db;
81
+		$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
82 82
 
83 83
     	print __METHOD__."\n";
84 84
     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     // tear down after class
87 87
     public static function tearDownAfterClass()
88 88
     {
89
-    	global $conf,$user,$langs,$db;
89
+    	global $conf, $user, $langs, $db;
90 90
 		$db->rollback();
91 91
 
92 92
 		print __METHOD__."\n";
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
     protected function setUp()
101 101
     {
102
-    	global $conf,$user,$langs,$db;
103
-		$conf=$this->savconf;
104
-		$user=$this->savuser;
105
-		$langs=$this->savlangs;
106
-		$db=$this->savdb;
102
+    	global $conf, $user, $langs, $db;
103
+		$conf = $this->savconf;
104
+		$user = $this->savuser;
105
+		$langs = $this->savlangs;
106
+		$db = $this->savdb;
107 107
 
108 108
 		print __METHOD__."\n";
109 109
     }
@@ -124,28 +124,28 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function testGetMarginInfos()
126 126
     {
127
-    	global $conf,$user,$langs,$db;
128
-		$conf=$this->savconf;
129
-		$user=$this->savuser;
130
-		$langs=$this->savlangs;
131
-		$db=$this->savdb;
127
+    	global $conf, $user, $langs, $db;
128
+		$conf = $this->savconf;
129
+		$user = $this->savuser;
130
+		$langs = $this->savlangs;
131
+		$db = $this->savdb;
132 132
 
133
-		$result=getMarginInfos(10, 0, 19.6, 0, 0, 0, 8);
133
+		$result = getMarginInfos(10, 0, 19.6, 0, 0, 0, 8);
134 134
 		//var_dump($result);
135 135
 		print __METHOD__." result[0]=".$result[0]."\n";
136
-		$this->assertEquals(8,$result[0]);
136
+		$this->assertEquals(8, $result[0]);
137 137
 		print __METHOD__." result[1]=".$result[1]."\n";
138
-		$this->assertEquals(25,$result[1]);
138
+		$this->assertEquals(25, $result[1]);
139 139
 		print __METHOD__." result[2]=".$result[2]."\n";
140
-		$this->assertEquals(20,$result[2]);
140
+		$this->assertEquals(20, $result[2]);
141 141
 
142
-		$result=getMarginInfos(10, 10, 19.6, 0, 0, 0, 8);
142
+		$result = getMarginInfos(10, 10, 19.6, 0, 0, 0, 8);
143 143
 		print __METHOD__." result[0]=".$result[0]."\n";
144
-		$this->assertEquals(8,$result[0]);
144
+		$this->assertEquals(8, $result[0]);
145 145
 		print __METHOD__." result[1]=".$result[1]."\n";
146
-		$this->assertEquals(12.5,$result[1]);
146
+		$this->assertEquals(12.5, $result[1]);
147 147
 		print __METHOD__." result[2]=".$result[2]."\n";
148
-		$this->assertEquals(1/9*100,$result[2]);
148
+		$this->assertEquals(1 / 9 * 100, $result[2]);
149 149
 
150 150
 		return 0;
151 151
     }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/ExpenseReportTest.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *      \remarks    To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     $user->fetch(1);
35 35
     $user->getrights();
36 36
 }
37
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
37
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
38 38
 
39 39
 
40 40
 
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
     	parent::__construct();
64 64
 
65 65
     	//$this->sharedFixture
66
-        global $conf,$user,$langs,$db;
67
-        $this->savconf=$conf;
68
-        $this->savuser=$user;
69
-        $this->savlangs=$langs;
70
-        $this->savdb=$db;
66
+        global $conf, $user, $langs, $db;
67
+        $this->savconf = $conf;
68
+        $this->savuser = $user;
69
+        $this->savlangs = $langs;
70
+        $this->savdb = $db;
71 71
 
72 72
         print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73 73
         //print " - db ".$db->db;
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     // Static methods
78 78
     public static function setUpBeforeClass()
79 79
     {
80
-        global $conf,$user,$langs,$db;
80
+        global $conf, $user, $langs, $db;
81 81
         $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
82 82
 
83 83
         print __METHOD__."\n";
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     // tear down after class
87 87
     public static function tearDownAfterClass()
88 88
     {
89
-        global $conf,$user,$langs,$db;
89
+        global $conf, $user, $langs, $db;
90 90
         $db->rollback();
91 91
 
92 92
         print __METHOD__."\n";
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
      */
100 100
     protected function setUp()
101 101
     {
102
-        global $conf,$user,$langs,$db;
103
-        $conf=$this->savconf;
104
-        $user=$this->savuser;
105
-        $langs=$this->savlangs;
106
-        $db=$this->savdb;
102
+        global $conf, $user, $langs, $db;
103
+        $conf = $this->savconf;
104
+        $user = $this->savuser;
105
+        $langs = $this->savlangs;
106
+        $db = $this->savdb;
107 107
 
108 108
         print __METHOD__."\n";
109 109
         //print $db->getVersion()."\n";
@@ -125,36 +125,36 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function testExpenseReportCreate()
127 127
     {
128
-        global $conf,$user,$langs,$db;
129
-        $conf=$this->savconf;
130
-        $user=$this->savuser;
131
-        $langs=$this->savlangs;
132
-        $db=$this->savdb;
128
+        global $conf, $user, $langs, $db;
129
+        $conf = $this->savconf;
130
+        $user = $this->savuser;
131
+        $langs = $this->savlangs;
132
+        $db = $this->savdb;
133 133
 
134 134
         // Set supplier and product to use
135
-        $socid=1;
135
+        $socid = 1;
136 136
 
137 137
         // Create supplier order with a too low quantity
138
-        $localobject=new ExpenseReport($db);
139
-        $localobject->initAsSpecimen();         // Init a speciment with lines
138
+        $localobject = new ExpenseReport($db);
139
+        $localobject->initAsSpecimen(); // Init a speciment with lines
140 140
         $localobject->status = 0;
141 141
         $localobject->fk_statut = 0;
142
-        $localobject->date_fin = null;  // Force bad value
142
+        $localobject->date_fin = null; // Force bad value
143 143
 
144
-        $result=$localobject->create($user);
144
+        $result = $localobject->create($user);
145 145
         print __METHOD__." result=".$result."\n";
146
-        $this->assertEquals(-1, $result);       // must be -1 because of missing mandatory fields
146
+        $this->assertEquals(-1, $result); // must be -1 because of missing mandatory fields
147 147
 
148
-        $sql="DELETE FROM ".MAIN_DB_PREFIX."expensereport where ref=''";
148
+        $sql = "DELETE FROM ".MAIN_DB_PREFIX."expensereport where ref=''";
149 149
         $db->query($sql);
150 150
 
151 151
         // Create supplier order
152
-        $localobject2=new ExpenseReport($db);
153
-        $localobject2->initAsSpecimen();        // Init a speciment with lines
152
+        $localobject2 = new ExpenseReport($db);
153
+        $localobject2->initAsSpecimen(); // Init a speciment with lines
154 154
         $localobject2->status = 0;
155 155
         $localobject2->fk_statut = 0;
156 156
 
157
-        $result=$localobject2->create($user);
157
+        $result = $localobject2->create($user);
158 158
         print __METHOD__." result=".$result."\n";
159 159
         $this->assertGreaterThanOrEqual(0, $result);
160 160
 
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
      */
174 174
     public function testExpenseReportFetch($id)
175 175
     {
176
-        global $conf,$user,$langs,$db;
177
-        $conf=$this->savconf;
178
-        $user=$this->savuser;
179
-        $langs=$this->savlangs;
180
-        $db=$this->savdb;
176
+        global $conf, $user, $langs, $db;
177
+        $conf = $this->savconf;
178
+        $user = $this->savuser;
179
+        $langs = $this->savlangs;
180
+        $db = $this->savdb;
181 181
 
182
-        $localobject=new ExpenseReport($this->savdb);
183
-        $result=$localobject->fetch($id);
182
+        $localobject = new ExpenseReport($this->savdb);
183
+        $result = $localobject->fetch($id);
184 184
 
185 185
         print __METHOD__." id=".$id." result=".$result."\n";
186 186
         $this->assertLessThan($result, 0);
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
      */
199 199
     public function testExpenseReportValid($localobject)
200 200
     {
201
-        global $conf,$user,$langs,$db;
202
-        $conf=$this->savconf;
203
-        $user=$this->savuser;
204
-        $langs=$this->savlangs;
205
-        $db=$this->savdb;
201
+        global $conf, $user, $langs, $db;
202
+        $conf = $this->savconf;
203
+        $user = $this->savuser;
204
+        $langs = $this->savlangs;
205
+        $db = $this->savdb;
206 206
 
207
-        $result=$localobject->setValidate($user);
207
+        $result = $localobject->setValidate($user);
208 208
 
209 209
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
210 210
         $this->assertLessThan($result, 0);
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
      */
223 223
     public function testExpenseReportApprove($localobject)
224 224
     {
225
-        global $conf,$user,$langs,$db;
226
-        $conf=$this->savconf;
227
-        $user=$this->savuser;
228
-        $langs=$this->savlangs;
229
-        $db=$this->savdb;
225
+        global $conf, $user, $langs, $db;
226
+        $conf = $this->savconf;
227
+        $user = $this->savuser;
228
+        $langs = $this->savlangs;
229
+        $db = $this->savdb;
230 230
 
231
-        $result=$localobject->setApproved($user);
231
+        $result = $localobject->setApproved($user);
232 232
 
233 233
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
234 234
         $this->assertLessThan($result, 0);
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
      */
247 247
     public function testExpenseReportCancel($localobject)
248 248
     {
249
-        global $conf,$user,$langs,$db;
250
-        $conf=$this->savconf;
251
-        $user=$this->savuser;
252
-        $langs=$this->savlangs;
253
-        $db=$this->savdb;
249
+        global $conf, $user, $langs, $db;
250
+        $conf = $this->savconf;
251
+        $user = $this->savuser;
252
+        $langs = $this->savlangs;
253
+        $db = $this->savdb;
254 254
 
255
-        $result=$localobject->set_cancel($user, 'Because...');
255
+        $result = $localobject->set_cancel($user, 'Because...');
256 256
 
257 257
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
258 258
         $this->assertLessThan($result, 0);
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
      */
271 271
     public function testExpenseReportOther($localobject)
272 272
     {
273
-        global $conf,$user,$langs,$db;
274
-        $conf=$this->savconf;
275
-        $user=$this->savuser;
276
-        $langs=$this->savlangs;
277
-        $db=$this->savdb;
273
+        global $conf, $user, $langs, $db;
274
+        $conf = $this->savconf;
275
+        $user = $this->savuser;
276
+        $langs = $this->savlangs;
277
+        $db = $this->savdb;
278 278
 
279 279
         /*$result=$localobject->setstatus(0);
280 280
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
      */
301 301
     public function testExpenseReportDelete($id)
302 302
     {
303
-        global $conf,$user,$langs,$db;
304
-        $conf=$this->savconf;
305
-        $user=$this->savuser;
306
-        $langs=$this->savlangs;
307
-        $db=$this->savdb;
308
-
309
-        $localobject=new ExpenseReport($this->savdb);
310
-        $result=$localobject->fetch($id);
311
-        $result=$localobject->delete($user);
303
+        global $conf, $user, $langs, $db;
304
+        $conf = $this->savconf;
305
+        $user = $this->savuser;
306
+        $langs = $this->savlangs;
307
+        $db = $this->savdb;
308
+
309
+        $localobject = new ExpenseReport($this->savdb);
310
+        $result = $localobject->fetch($id);
311
+        $result = $localobject->delete($user);
312 312
 
313 313
         print __METHOD__." id=".$id." result=".$result."\n";
314 314
         $this->assertLessThan($result, 0);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/HolidayTest.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *		\remarks	To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	$user->getrights();
38 38
 }
39 39
 
40
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
40
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
41 41
 
42 42
 
43 43
 /**
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 		parent::__construct();
66 66
 
67 67
 		//$this->sharedFixture
68
-		global $conf,$user,$langs,$db;
69
-		$this->savconf=$conf;
70
-		$this->savuser=$user;
71
-		$this->savlangs=$langs;
72
-		$this->savdb=$db;
68
+		global $conf, $user, $langs, $db;
69
+		$this->savconf = $conf;
70
+		$this->savuser = $user;
71
+		$this->savlangs = $langs;
72
+		$this->savdb = $db;
73 73
 
74 74
 		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
75 75
 		//print " - db ".$db->db;
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	// Static methods
80 80
   	public static function setUpBeforeClass()
81 81
     {
82
-    	global $conf,$user,$langs,$db;
82
+    	global $conf, $user, $langs, $db;
83 83
 
84
-        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
84
+        $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
85 85
 
86 86
     	print __METHOD__."\n";
87 87
     }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     // tear down after class
90 90
     public static function tearDownAfterClass()
91 91
     {
92
-    	global $conf,$user,$langs,$db;
92
+    	global $conf, $user, $langs, $db;
93 93
 		$db->rollback();
94 94
 
95 95
 		print __METHOD__."\n";
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
     protected function setUp()
104 104
     {
105
-    	global $conf,$user,$langs,$db;
106
-		$conf=$this->savconf;
107
-		$user=$this->savuser;
108
-		$langs=$this->savlangs;
109
-		$db=$this->savdb;
105
+    	global $conf, $user, $langs, $db;
106
+		$conf = $this->savconf;
107
+		$user = $this->savuser;
108
+		$langs = $this->savlangs;
109
+		$db = $this->savdb;
110 110
 
111 111
 		print __METHOD__."\n";
112 112
     }
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function testHolidayCreate()
129 129
     {
130
-    	global $conf,$user,$langs,$db;
131
-		$conf=$this->savconf;
132
-		$user=$this->savuser;
133
-		$langs=$this->savlangs;
134
-		$db=$this->savdb;
130
+    	global $conf, $user, $langs, $db;
131
+		$conf = $this->savconf;
132
+		$user = $this->savuser;
133
+		$langs = $this->savlangs;
134
+		$db = $this->savdb;
135 135
 
136
-		$localobject=new Holiday($this->savdb);
136
+		$localobject = new Holiday($this->savdb);
137 137
     	$localobject->initAsSpecimen();
138
-    	$result=$localobject->create($user);
138
+    	$result = $localobject->create($user);
139 139
 
140 140
         print __METHOD__." result=".$result."\n";
141 141
     	$this->assertLessThan($result, 0);
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
      */
154 154
     public function testHolidayFetch($id)
155 155
     {
156
-    	global $conf,$user,$langs,$db;
157
-		$conf=$this->savconf;
158
-		$user=$this->savuser;
159
-		$langs=$this->savlangs;
160
-		$db=$this->savdb;
156
+    	global $conf, $user, $langs, $db;
157
+		$conf = $this->savconf;
158
+		$user = $this->savuser;
159
+		$langs = $this->savlangs;
160
+		$db = $this->savdb;
161 161
 
162
-		$localobject=new Holiday($this->savdb);
163
-    	$result=$localobject->fetch($id);
162
+		$localobject = new Holiday($this->savdb);
163
+    	$result = $localobject->fetch($id);
164 164
 
165 165
         print __METHOD__." id=".$id." result=".$result."\n";
166 166
     	$this->assertLessThan($result, 0);
@@ -179,51 +179,51 @@  discard block
 block discarded – undo
179 179
      */
180 180
     public function testHolidayUpdate($localobject)
181 181
     {
182
-    	global $conf,$user,$langs,$db;
183
-		$conf=$this->savconf;
184
-		$user=$this->savuser;
185
-		$langs=$this->savlangs;
186
-		$db=$this->savdb;
182
+    	global $conf, $user, $langs, $db;
183
+		$conf = $this->savconf;
184
+		$user = $this->savuser;
185
+		$langs = $this->savlangs;
186
+		$db = $this->savdb;
187 187
 
188 188
 		$localobject->oldcopy = clone $localobject;
189 189
 
190
-		$localobject->note_private='New private note after update';
191
-		$localobject->note_public='New public note after update';
192
-		$localobject->lastname='New name';
193
-		$localobject->firstname='New firstname';
194
-		$localobject->address='New address';
195
-		$localobject->zip='New zip';
196
-		$localobject->town='New town';
197
-    	$localobject->country_id=2;
190
+		$localobject->note_private = 'New private note after update';
191
+		$localobject->note_public = 'New public note after update';
192
+		$localobject->lastname = 'New name';
193
+		$localobject->firstname = 'New firstname';
194
+		$localobject->address = 'New address';
195
+		$localobject->zip = 'New zip';
196
+		$localobject->town = 'New town';
197
+    	$localobject->country_id = 2;
198 198
     	//$localobject->status=0;
199
-		$localobject->phone_pro='New tel pro';
200
-		$localobject->phone_perso='New tel perso';
201
-		$localobject->phone_mobile='New tel mobile';
202
-		$localobject->fax='New fax';
203
-		$localobject->email='[email protected]';
204
-		$localobject->jabberid='New im id';
205
-		$localobject->default_lang='es_ES';
206
-
207
-		$result=$localobject->update($localobject->id,$user);
199
+		$localobject->phone_pro = 'New tel pro';
200
+		$localobject->phone_perso = 'New tel perso';
201
+		$localobject->phone_mobile = 'New tel mobile';
202
+		$localobject->fax = 'New fax';
203
+		$localobject->email = '[email protected]';
204
+		$localobject->jabberid = 'New im id';
205
+		$localobject->default_lang = 'es_ES';
206
+
207
+		$result = $localobject->update($localobject->id, $user);
208 208
     	print __METHOD__." id=".$localobject->id." result=".$result."\n";
209 209
     	$this->assertLessThan($result, 0, 'Holiday::update error');
210 210
 
211
-    	$result=$localobject->update_note($localobject->note_private,'_private');
211
+    	$result = $localobject->update_note($localobject->note_private, '_private');
212 212
     	print __METHOD__." id=".$localobject->id." result=".$result."\n";
213 213
 		$this->assertLessThan($result, 0, 'Holiday::update_note (private) error');
214 214
 
215
-		$result=$localobject->update_note($localobject->note_public, '_public');
215
+		$result = $localobject->update_note($localobject->note_public, '_public');
216 216
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
217 217
 		$this->assertLessThan($result, 0, 'Holiday::update_note (public) error');
218 218
 
219 219
 
220
-		$newobject=new Holiday($this->savdb);
221
-    	$result=$newobject->fetch($localobject->id);
220
+		$newobject = new Holiday($this->savdb);
221
+    	$result = $newobject->fetch($localobject->id);
222 222
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
223 223
     	$this->assertLessThan($result, 0, 'Holiday::fetch error');
224 224
 
225 225
     	print __METHOD__." old=".$localobject->note." new=".$newobject->note."\n";
226
-    	$this->assertEquals($localobject->note, $newobject->note,'Holiday::update_note error compare note');
226
+    	$this->assertEquals($localobject->note, $newobject->note, 'Holiday::update_note error compare note');
227 227
     	//print __METHOD__." old=".$localobject->note_public." new=".$newobject->note_public."\n";
228 228
     	//$this->assertEquals($localobject->note_public, $newobject->note_public);
229 229
 
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
      */
242 242
     public function testHolidayOther($localobject)
243 243
     {
244
-    	global $conf,$user,$langs,$db;
245
-		$conf=$this->savconf;
246
-		$user=$this->savuser;
247
-		$langs=$this->savlangs;
248
-		$db=$this->savdb;
244
+    	global $conf, $user, $langs, $db;
245
+		$conf = $this->savconf;
246
+		$user = $this->savuser;
247
+		$langs = $this->savlangs;
248
+		$db = $this->savdb;
249 249
 
250 250
 		//$localobject->fetch($localobject->id);
251 251
 
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
      */
278 278
     public function testHolidayDelete($id)
279 279
     {
280
-    	global $conf,$user,$langs,$db;
281
-		$conf=$this->savconf;
282
-		$user=$this->savuser;
283
-		$langs=$this->savlangs;
284
-		$db=$this->savdb;
280
+    	global $conf, $user, $langs, $db;
281
+		$conf = $this->savconf;
282
+		$user = $this->savuser;
283
+		$langs = $this->savlangs;
284
+		$db = $this->savdb;
285 285
 
286
-		$localobject=new Holiday($this->savdb);
287
-    	$result=$localobject->fetch($id);
286
+		$localobject = new Holiday($this->savdb);
287
+    	$result = $localobject->fetch($id);
288 288
 
289
-    	$result=$localobject->delete(0);
289
+    	$result = $localobject->delete(0);
290 290
 		print __METHOD__." id=".$id." result=".$result."\n";
291 291
     	$this->assertLessThan($result, 0);
292 292
 
@@ -300,55 +300,55 @@  discard block
 block discarded – undo
300 300
      */
301 301
     public function testVerifDateHolidayCP()
302 302
     {
303
-    	global $conf,$user,$langs,$db;
304
-    	$conf=$this->savconf;
305
-    	$user=$this->savuser;
306
-    	$langs=$this->savlangs;
307
-    	$db=$this->savdb;
303
+    	global $conf, $user, $langs, $db;
304
+    	$conf = $this->savconf;
305
+    	$user = $this->savuser;
306
+    	$langs = $this->savlangs;
307
+    	$db = $this->savdb;
308 308
 
309 309
     	// Create a leave request the 1st morning only
310
-    	$localobjecta=new Holiday($this->savdb);
310
+    	$localobjecta = new Holiday($this->savdb);
311 311
     	$localobjecta->initAsSpecimen();
312 312
     	$localobjecta->date_debut = dol_mktime(0, 0, 0, 1, 1, 2020);
313 313
     	$localobjecta->date_fin = dol_mktime(0, 0, 0, 1, 1, 2020);
314 314
     	$localobjecta->halfday = 1;
315
-    	$result=$localobjecta->create($user);
315
+    	$result = $localobjecta->create($user);
316 316
 
317 317
     	// Create a leave request the 2 afternoon only
318
-    	$localobjectb=new Holiday($this->savdb);
318
+    	$localobjectb = new Holiday($this->savdb);
319 319
     	$localobjectb->initAsSpecimen();
320 320
     	$localobjectb->date_debut = dol_mktime(0, 0, 0, 1, 2, 2020);
321 321
     	$localobjectb->date_fin = dol_mktime(0, 0, 0, 1, 2, 2020);
322 322
     	$localobjectb->halfday = -1;
323
-    	$result=$localobjectb->create($user);
323
+    	$result = $localobjectb->create($user);
324 324
 
325 325
     	$date_debut = dol_mktime(0, 0, 0, 1, 1, 2020);
326 326
     	$date_fin = dol_mktime(0, 0, 0, 1, 2, 2020);
327 327
 
328
-    	$localobjectc=new Holiday($this->savdb);
328
+    	$localobjectc = new Holiday($this->savdb);
329 329
 
330
-    	$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 0);
330
+    	$result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 0);
331 331
     	$this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.');
332
-    	$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 0);
332
+    	$result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 0);
333 333
     	$this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.');
334
-    	$result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 0);
334
+    	$result = $localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 0);
335 335
     	$this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.');
336 336
 
337
-    	$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 1);
337
+    	$result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 1);
338 338
     	$this->assertFalse($result, 'result should be false, there is overlapping, morning of first day is not available.');
339
-    	$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 1);
339
+    	$result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 1);
340 340
     	$this->assertFalse($result, 'result should be false, there is overlapping, morning of first day is not available.');
341
-    	$result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 1);
341
+    	$result = $localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 1);
342 342
     	$this->assertTrue($result, 'result should be true, there is no overlapping');
343 343
 
344
-    	$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, -1);
344
+    	$result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, -1);
345 345
     	$this->assertTrue($result, 'result should be true, there is no overlapping');
346
-    	$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, -1);
346
+    	$result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, -1);
347 347
     	$this->assertFalse($result, 'result should be false, there is overlapping, afternoon of second day is not available');
348
-    	$result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, -1);
348
+    	$result = $localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, -1);
349 349
     	$this->assertFalse($result, 'result should be false, there is overlapping, afternoon of second day is not available');
350 350
 
351
-    	$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 2);	// start afternoon and end morning
351
+    	$result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 2); // start afternoon and end morning
352 352
     	$this->assertTrue($result, 'result should be true, there is no overlapping');
353 353
     }
354 354
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/FilesLibTest.php 1 patch
Spacing   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *		\remarks	To run this script as CLI:  phpunit filename.php
25 25
  */
26 26
 
27
-global $conf,$user,$langs,$db;
27
+global $conf, $user, $langs, $db;
28 28
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
29 29
 //require_once 'PHPUnit/Autoload.php';
30 30
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	$user->fetch(1);
37 37
 	$user->getrights();
38 38
 }
39
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
39
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
40 40
 
41 41
 
42 42
 /**
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		parent::__construct();
65 65
 
66 66
 		//$this->sharedFixture
67
-		global $conf,$user,$langs,$db;
68
-		$this->savconf=$conf;
69
-		$this->savuser=$user;
70
-		$this->savlangs=$langs;
71
-		$this->savdb=$db;
67
+		global $conf, $user, $langs, $db;
68
+		$this->savconf = $conf;
69
+		$this->savuser = $user;
70
+		$this->savlangs = $langs;
71
+		$this->savdb = $db;
72 72
 
73 73
 		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
74 74
 		//print " - db ".$db->db;
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	// Static methods
79 79
   	public static function setUpBeforeClass()
80 80
     {
81
-    	global $conf,$user,$langs,$db;
82
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
81
+    	global $conf, $user, $langs, $db;
82
+		$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
83 83
 
84 84
     	print __METHOD__."\n";
85 85
     }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     // tear down after class
88 88
     public static function tearDownAfterClass()
89 89
     {
90
-    	global $conf,$user,$langs,$db;
90
+    	global $conf, $user, $langs, $db;
91 91
 		$db->rollback();
92 92
 
93 93
 		print __METHOD__."\n";
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
     protected function setUp()
102 102
     {
103
-    	global $conf,$user,$langs,$db;
104
-		$conf=$this->savconf;
105
-		$user=$this->savuser;
106
-		$langs=$this->savlangs;
107
-		$db=$this->savdb;
103
+    	global $conf, $user, $langs, $db;
104
+		$conf = $this->savconf;
105
+		$user = $this->savuser;
106
+		$langs = $this->savlangs;
107
+		$db = $this->savdb;
108 108
 
109 109
 		print __METHOD__."\n";
110 110
     }
@@ -126,27 +126,27 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function testDolBasename()
128 128
     {
129
-    	global $conf,$user,$langs,$db;
130
-		$conf=$this->savconf;
131
-		$user=$this->savuser;
132
-		$langs=$this->savlangs;
133
-		$db=$this->savdb;
129
+    	global $conf, $user, $langs, $db;
130
+		$conf = $this->savconf;
131
+		$user = $this->savuser;
132
+		$langs = $this->savlangs;
133
+		$db = $this->savdb;
134 134
 
135
-        $result=dol_basename('adir/afile');
135
+        $result = dol_basename('adir/afile');
136 136
     	print __METHOD__." result=".$result."\n";
137
-		$this->assertEquals('afile',$result);
137
+		$this->assertEquals('afile', $result);
138 138
 
139
-		$result=dol_basename('adir/afile/');
139
+		$result = dol_basename('adir/afile/');
140 140
     	print __METHOD__." result=".$result."\n";
141
-		$this->assertEquals('afile',$result);
141
+		$this->assertEquals('afile', $result);
142 142
 
143
-		$result=dol_basename('adir/νεο');    // With cyrillic data. Here basename fails to return correct value
143
+		$result = dol_basename('adir/νεο'); // With cyrillic data. Here basename fails to return correct value
144 144
     	print __METHOD__." result=".$result."\n";
145
-		$this->assertEquals('νεο',$result);
145
+		$this->assertEquals('νεο', $result);
146 146
 
147
-		$result=dol_basename('adir/νεο/');    // With cyrillic data. Here basename fails to return correct value
147
+		$result = dol_basename('adir/νεο/'); // With cyrillic data. Here basename fails to return correct value
148 148
     	print __METHOD__." result=".$result."\n";
149
-		$this->assertEquals('νεο',$result);
149
+		$this->assertEquals('νεο', $result);
150 150
     }
151 151
 
152 152
 
@@ -157,16 +157,16 @@  discard block
 block discarded – undo
157 157
     */
158 158
     public function testDolCountNbOfLine()
159 159
     {
160
-    	global $conf,$user,$langs,$db;
161
-		$conf=$this->savconf;
162
-		$user=$this->savuser;
163
-		$langs=$this->savlangs;
164
-		$db=$this->savdb;
165
-
166
-		$file=dirname(__FILE__).'/Example_import_company_1.csv';
167
-		$result=dol_count_nb_of_line($file);
160
+    	global $conf, $user, $langs, $db;
161
+		$conf = $this->savconf;
162
+		$user = $this->savuser;
163
+		$langs = $this->savlangs;
164
+		$db = $this->savdb;
165
+
166
+		$file = dirname(__FILE__).'/Example_import_company_1.csv';
167
+		$result = dol_count_nb_of_line($file);
168 168
     	print __METHOD__." result=".$result."\n";
169
-		$this->assertEquals(3,$result);
169
+		$this->assertEquals(3, $result);
170 170
 
171 171
 		return $result;
172 172
     }
@@ -178,19 +178,19 @@  discard block
 block discarded – undo
178 178
     */
179 179
     public function testDolIsFileDir()
180 180
     {
181
-    	global $conf,$user,$langs,$db;
182
-		$conf=$this->savconf;
183
-		$user=$this->savuser;
184
-		$langs=$this->savlangs;
185
-		$db=$this->savdb;
181
+    	global $conf, $user, $langs, $db;
182
+		$conf = $this->savconf;
183
+		$user = $this->savuser;
184
+		$langs = $this->savlangs;
185
+		$db = $this->savdb;
186 186
 
187
-		$file=dirname(__FILE__).'/Example_import_company_1.csv';
187
+		$file = dirname(__FILE__).'/Example_import_company_1.csv';
188 188
 
189
-		$result=dol_is_file($file);
189
+		$result = dol_is_file($file);
190 190
     	print __METHOD__." result=".$result."\n";
191 191
 		$this->assertTrue($result);
192 192
 
193
-		$result=dol_is_dir($file);
193
+		$result = dol_is_dir($file);
194 194
     	print __METHOD__." result=".$result."\n";
195 195
 		$this->assertFalse($result);
196 196
 
@@ -204,24 +204,24 @@  discard block
 block discarded – undo
204 204
     */
205 205
     public function testDolOther()
206 206
     {
207
-        global $conf,$user,$langs,$db;
208
-        $conf=$this->savconf;
209
-        $user=$this->savuser;
210
-        $langs=$this->savlangs;
211
-        $db=$this->savdb;
212
-
213
-        $url='http://www.dolibarr.org';
214
-  		$result=dol_is_url($url);
207
+        global $conf, $user, $langs, $db;
208
+        $conf = $this->savconf;
209
+        $user = $this->savuser;
210
+        $langs = $this->savlangs;
211
+        $db = $this->savdb;
212
+
213
+        $url = 'http://www.dolibarr.org';
214
+  		$result = dol_is_url($url);
215 215
         print __METHOD__." result=".$result."\n";
216 216
         $this->assertTrue($result);
217 217
 
218
-        $url='https://www.dolibarr.org';
219
-  		$result=dol_is_url($url);
218
+        $url = 'https://www.dolibarr.org';
219
+  		$result = dol_is_url($url);
220 220
         print __METHOD__." result=".$result."\n";
221 221
         $this->assertTrue($result);
222 222
 
223
-        $url='file://www.dolibarr.org/download/file.zip';
224
-        $result=dol_is_url($url);
223
+        $url = 'file://www.dolibarr.org/download/file.zip';
224
+        $result = dol_is_url($url);
225 225
         print __METHOD__." result=".$result."\n";
226 226
         $this->assertTrue($result);
227 227
 
@@ -235,42 +235,42 @@  discard block
 block discarded – undo
235 235
      */
236 236
     public function testDolMimeType()
237 237
     {
238
-    	global $conf,$user,$langs,$db;
239
-    	$conf=$this->savconf;
240
-    	$user=$this->savuser;
241
-    	$langs=$this->savlangs;
242
-    	$db=$this->savdb;
238
+    	global $conf, $user, $langs, $db;
239
+    	$conf = $this->savconf;
240
+    	$user = $this->savuser;
241
+    	$langs = $this->savlangs;
242
+    	$db = $this->savdb;
243 243
 
244 244
     	// file.png
245
-    	$result=dol_mimetype('file.png','',0);
246
-    	$this->assertEquals('image/png',$result);
247
-    	$result=dol_mimetype('file.png','',1);
248
-    	$this->assertEquals('png',$result);
249
-    	$result=dol_mimetype('file.png','',2);
250
-    	$this->assertEquals('image.png',$result);
251
-    	$result=dol_mimetype('file.png','',3);
252
-    	$this->assertEquals('',$result);
245
+    	$result = dol_mimetype('file.png', '', 0);
246
+    	$this->assertEquals('image/png', $result);
247
+    	$result = dol_mimetype('file.png', '', 1);
248
+    	$this->assertEquals('png', $result);
249
+    	$result = dol_mimetype('file.png', '', 2);
250
+    	$this->assertEquals('image.png', $result);
251
+    	$result = dol_mimetype('file.png', '', 3);
252
+    	$this->assertEquals('', $result);
253 253
     	// file.odt
254
-    	$result=dol_mimetype('file.odt','',0);
255
-    	$this->assertEquals('application/vnd.oasis.opendocument.text',$result);
256
-    	$result=dol_mimetype('file.odt','',1);
257
-    	$this->assertEquals('vnd.oasis.opendocument.text',$result);
258
-    	$result=dol_mimetype('file.odt','',2);
259
-    	$this->assertEquals('ooffice.png',$result);
260
-    	$result=dol_mimetype('file.odt','',3);
261
-    	$this->assertEquals('',$result);
254
+    	$result = dol_mimetype('file.odt', '', 0);
255
+    	$this->assertEquals('application/vnd.oasis.opendocument.text', $result);
256
+    	$result = dol_mimetype('file.odt', '', 1);
257
+    	$this->assertEquals('vnd.oasis.opendocument.text', $result);
258
+    	$result = dol_mimetype('file.odt', '', 2);
259
+    	$this->assertEquals('ooffice.png', $result);
260
+    	$result = dol_mimetype('file.odt', '', 3);
261
+    	$this->assertEquals('', $result);
262 262
     	// file.php
263
-    	$result=dol_mimetype('file.php','',0);
264
-    	$this->assertEquals('text/plain',$result);
265
-    	$result=dol_mimetype('file.php','',1);
266
-    	$this->assertEquals('plain',$result);
267
-    	$result=dol_mimetype('file.php','',2);
268
-    	$this->assertEquals('php.png',$result);
269
-    	$result=dol_mimetype('file.php','',3);
270
-    	$this->assertEquals('php',$result);
263
+    	$result = dol_mimetype('file.php', '', 0);
264
+    	$this->assertEquals('text/plain', $result);
265
+    	$result = dol_mimetype('file.php', '', 1);
266
+    	$this->assertEquals('plain', $result);
267
+    	$result = dol_mimetype('file.php', '', 2);
268
+    	$this->assertEquals('php.png', $result);
269
+    	$result = dol_mimetype('file.php', '', 3);
270
+    	$this->assertEquals('php', $result);
271 271
     	// file.php.noexe
272
-    	$result=dol_mimetype('file.php.noexe','',0);
273
-    	$this->assertEquals('text/plain',$result);
272
+    	$result = dol_mimetype('file.php.noexe', '', 0);
273
+    	$this->assertEquals('text/plain', $result);
274 274
     }
275 275
 
276 276
 
@@ -281,34 +281,34 @@  discard block
 block discarded – undo
281 281
      */
282 282
     public function testDolDeleteDir()
283 283
     {
284
-    	global $conf,$user,$langs,$db;
285
-    	$conf=$this->savconf;
286
-    	$user=$this->savuser;
287
-    	$langs=$this->savlangs;
288
-    	$db=$this->savdb;
284
+    	global $conf, $user, $langs, $db;
285
+    	$conf = $this->savconf;
286
+    	$user = $this->savuser;
287
+    	$langs = $this->savlangs;
288
+    	$db = $this->savdb;
289 289
 
290
-    	$dirout=$conf->admin->dir_temp.'/test';
291
-    	$dirout2=$conf->admin->dir_temp.'/test2';
290
+    	$dirout = $conf->admin->dir_temp.'/test';
291
+    	$dirout2 = $conf->admin->dir_temp.'/test2';
292 292
 
293
-    	$count=0;
294
-    	$result=dol_delete_dir_recursive($dirout,$count);	// If it has no permission to delete, it will fails as if dir does not exists, so we can't test it
293
+    	$count = 0;
294
+    	$result = dol_delete_dir_recursive($dirout, $count); // If it has no permission to delete, it will fails as if dir does not exists, so we can't test it
295 295
     	print __METHOD__." result=".$result."\n";
296
-    	$this->assertGreaterThanOrEqual(0,$result);
296
+    	$this->assertGreaterThanOrEqual(0, $result);
297 297
 
298
-    	$count=0;
299
-    	$countdeleted=0;
300
-    	$result=dol_delete_dir_recursive($dirout,$count,1,0,$countdeleted);	// If it has no permission to delete, it will fails as if dir does not exists, so we can't test it
298
+    	$count = 0;
299
+    	$countdeleted = 0;
300
+    	$result = dol_delete_dir_recursive($dirout, $count, 1, 0, $countdeleted); // If it has no permission to delete, it will fails as if dir does not exists, so we can't test it
301 301
     	print __METHOD__." result=".$result."\n";
302
-    	$this->assertGreaterThanOrEqual(0,$result);
303
-    	$this->assertGreaterThanOrEqual(0,$countdeleted);
302
+    	$this->assertGreaterThanOrEqual(0, $result);
303
+    	$this->assertGreaterThanOrEqual(0, $countdeleted);
304 304
 
305 305
     	dol_mkdir($dirout2);
306
-    	$count=0;
307
-    	$countdeleted=0;
308
-    	$result=dol_delete_dir_recursive($dirout2,$count,1,0,$countdeleted);	// If it has no permission to delete, it will fails as if dir does not exists, so we can't test it
306
+    	$count = 0;
307
+    	$countdeleted = 0;
308
+    	$result = dol_delete_dir_recursive($dirout2, $count, 1, 0, $countdeleted); // If it has no permission to delete, it will fails as if dir does not exists, so we can't test it
309 309
     	print __METHOD__." result=".$result."\n";
310
-    	$this->assertGreaterThanOrEqual(1,$result);
311
-    	$this->assertGreaterThanOrEqual(1,$countdeleted);
310
+    	$this->assertGreaterThanOrEqual(1, $result);
311
+    	$this->assertGreaterThanOrEqual(1, $countdeleted);
312 312
     }
313 313
 
314 314
 
@@ -322,66 +322,66 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public function testDolCopyMoveDelete()
324 324
     {
325
-        global $conf,$user,$langs,$db;
326
-        $conf=$this->savconf;
327
-        $user=$this->savuser;
328
-        $langs=$this->savlangs;
329
-        $db=$this->savdb;
325
+        global $conf, $user, $langs, $db;
326
+        $conf = $this->savconf;
327
+        $user = $this->savuser;
328
+        $langs = $this->savlangs;
329
+        $db = $this->savdb;
330 330
 
331
-        $file=dirname(__FILE__).'/Example_import_company_1.csv';
331
+        $file = dirname(__FILE__).'/Example_import_company_1.csv';
332 332
 
333
-        $result=dol_copy($file, '/adir/that/does/not/exists/file.csv');
333
+        $result = dol_copy($file, '/adir/that/does/not/exists/file.csv');
334 334
         print __METHOD__." result=".$result."\n";
335
-        $this->assertLessThan(0,$result,'copy dir that does not exists');    // We should have error
335
+        $this->assertLessThan(0, $result, 'copy dir that does not exists'); // We should have error
336 336
 
337
-        $result=dol_copy($file, $conf->admin->dir_temp.'/file.csv',0,1);
337
+        $result = dol_copy($file, $conf->admin->dir_temp.'/file.csv', 0, 1);
338 338
         print __METHOD__." result=".$result."\n";
339
-        $this->assertGreaterThanOrEqual(1,$result, 'copy file ('.$file.') into a dir that exists ('.$conf->admin->dir_temp.'/file.csv'.')');    // Should be 1
339
+        $this->assertGreaterThanOrEqual(1, $result, 'copy file ('.$file.') into a dir that exists ('.$conf->admin->dir_temp.'/file.csv'.')'); // Should be 1
340 340
 
341 341
         // Again to test with overwriting=0
342
-        $result=dol_copy($file, $conf->admin->dir_temp.'/file.csv',0,0);
342
+        $result = dol_copy($file, $conf->admin->dir_temp.'/file.csv', 0, 0);
343 343
         print __METHOD__." result=".$result."\n";
344
-        $this->assertEquals(0,$result, 'copy destination already exists, no overwrite');    // Should be 0
344
+        $this->assertEquals(0, $result, 'copy destination already exists, no overwrite'); // Should be 0
345 345
 
346 346
         // Again to test with overwriting=1
347
-        $result=dol_copy($file, $conf->admin->dir_temp.'/file.csv',0,1);
347
+        $result = dol_copy($file, $conf->admin->dir_temp.'/file.csv', 0, 1);
348 348
         print __METHOD__." result=".$result."\n";
349
-        $this->assertGreaterThanOrEqual(1,$result,'copy destination already exists, overwrite');    // Should be 1
349
+        $this->assertGreaterThanOrEqual(1, $result, 'copy destination already exists, overwrite'); // Should be 1
350 350
 
351 351
         // To test a move that should work
352
-        $result=dol_move($conf->admin->dir_temp.'/file.csv',$conf->admin->dir_temp.'/file2.csv',0,1);
352
+        $result = dol_move($conf->admin->dir_temp.'/file.csv', $conf->admin->dir_temp.'/file2.csv', 0, 1);
353 353
         print __METHOD__." result=".$result."\n";
354
-        $this->assertTrue($result,'move with default mask');
354
+        $this->assertTrue($result, 'move with default mask');
355 355
 
356 356
         // To test a move that should work with forced mask
357
-        $result=dol_move($conf->admin->dir_temp.'/file2.csv',$conf->admin->dir_temp.'/file3.csv','0754',1); // file shoutld be rwxr-wr--
357
+        $result = dol_move($conf->admin->dir_temp.'/file2.csv', $conf->admin->dir_temp.'/file3.csv', '0754', 1); // file shoutld be rwxr-wr--
358 358
         print __METHOD__." result=".$result."\n";
359
-        $this->assertTrue($result,'move with forced mask');
359
+        $this->assertTrue($result, 'move with forced mask');
360 360
 
361 361
         // To test a delete that should success
362
-        $result=dol_delete_file($conf->admin->dir_temp.'/file3.csv');
362
+        $result = dol_delete_file($conf->admin->dir_temp.'/file3.csv');
363 363
         print __METHOD__." result=".$result."\n";
364
-        $this->assertTrue($result,'delete file');
364
+        $this->assertTrue($result, 'delete file');
365 365
 
366 366
         // Again to test there is error when deleting a non existing file with option disableglob
367
-        $result=dol_delete_file($conf->admin->dir_temp.'/file3.csv',1,1);
367
+        $result = dol_delete_file($conf->admin->dir_temp.'/file3.csv', 1, 1);
368 368
         print __METHOD__." result=".$result."\n";
369
-        $this->assertFalse($result,'delete file that does not exists with disableglo must return ko');
369
+        $this->assertFalse($result, 'delete file that does not exists with disableglo must return ko');
370 370
 
371 371
         // Again to test there is no error when deleting a non existing file without option disableglob
372
-        $result=dol_delete_file($conf->admin->dir_temp.'/file3csv',0,1);
372
+        $result = dol_delete_file($conf->admin->dir_temp.'/file3csv', 0, 1);
373 373
         print __METHOD__." result=".$result."\n";
374
-        $this->assertTrue($result,'delete file that does not exists without disabling glob must return ok');
374
+        $this->assertTrue($result, 'delete file that does not exists without disabling glob must return ok');
375 375
 
376 376
         // Test copy with special char / delete with blob
377
-        $result=dol_copy($file, $conf->admin->dir_temp.'/file with [x] and é.csv',0,1);
377
+        $result = dol_copy($file, $conf->admin->dir_temp.'/file with [x] and é.csv', 0, 1);
378 378
         print __METHOD__." result=".$result."\n";
379
-        $this->assertGreaterThanOrEqual(1,$result,'copy file with special chars, overwrite');    // Should be 1
379
+        $this->assertGreaterThanOrEqual(1, $result, 'copy file with special chars, overwrite'); // Should be 1
380 380
 
381 381
         // Try to delete using a glob criteria
382
-        $result=dol_delete_file($conf->admin->dir_temp.'/file with [x]*é.csv');
382
+        $result = dol_delete_file($conf->admin->dir_temp.'/file with [x]*é.csv');
383 383
         print __METHOD__." result=".$result."\n";
384
-        $this->assertTrue($result,'delete file using glob');
384
+        $this->assertTrue($result, 'delete file using glob');
385 385
     }
386 386
 
387 387
     /**
@@ -394,28 +394,28 @@  discard block
 block discarded – undo
394 394
      */
395 395
     public function testDolCompressUnCompress()
396 396
     {
397
-        global $conf,$user,$langs,$db;
398
-        $conf=$this->savconf;
399
-        $user=$this->savuser;
400
-        $langs=$this->savlangs;
401
-        $db=$this->savdb;
397
+        global $conf, $user, $langs, $db;
398
+        $conf = $this->savconf;
399
+        $user = $this->savuser;
400
+        $langs = $this->savlangs;
401
+        $db = $this->savdb;
402 402
 
403
-        $format='zip';
404
-        $filein=dirname(__FILE__).'/Example_import_company_1.csv';
405
-        $fileout=$conf->admin->dir_temp.'/test.'.$format;
406
-        $dirout=$conf->admin->dir_temp.'/test';
403
+        $format = 'zip';
404
+        $filein = dirname(__FILE__).'/Example_import_company_1.csv';
405
+        $fileout = $conf->admin->dir_temp.'/test.'.$format;
406
+        $dirout = $conf->admin->dir_temp.'/test';
407 407
 
408 408
         dol_delete_file($fileout);
409
-        $count=0;
410
-        dol_delete_dir_recursive($dirout,$count,1);
409
+        $count = 0;
410
+        dol_delete_dir_recursive($dirout, $count, 1);
411 411
 
412
-        $result=dol_compress_file($filein, $fileout, $format);
412
+        $result = dol_compress_file($filein, $fileout, $format);
413 413
         print __METHOD__." result=".$result."\n";
414
-        $this->assertGreaterThanOrEqual(1,$result);
414
+        $this->assertGreaterThanOrEqual(1, $result);
415 415
 
416
-        $result=dol_uncompress($fileout, $dirout);
417
-        print __METHOD__." result=".join(',',$result)."\n";
418
-        $this->assertEquals(0,count($result));
416
+        $result = dol_uncompress($fileout, $dirout);
417
+        print __METHOD__." result=".join(',', $result)."\n";
418
+        $this->assertEquals(0, count($result));
419 419
     }
420 420
 
421 421
     /**
@@ -428,12 +428,12 @@  discard block
 block discarded – undo
428 428
      */
429 429
     public function testDolDirList()
430 430
     {
431
-        global $conf,$user,$langs,$db;
431
+        global $conf, $user, $langs, $db;
432 432
 
433 433
         // Scan dir to guaruante we on't have library jquery twice (we accept exception of duplicte into ckeditor because all dir is removed for debian package, so there is no duplicate).
434
-        $founddirs=dol_dir_list(DOL_DOCUMENT_ROOT.'/includes/', 'files', 1, '^jquery\.js', array('ckeditor'));
434
+        $founddirs = dol_dir_list(DOL_DOCUMENT_ROOT.'/includes/', 'files', 1, '^jquery\.js', array('ckeditor'));
435 435
         print __METHOD__." count(founddirs)=".count($founddirs)."\n";
436
-        $this->assertEquals(1,count($founddirs));
436
+        $this->assertEquals(1, count($founddirs));
437 437
     }
438 438
 
439 439
 
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
      */
445 445
     public function testDolCheckSecureAccessDocument()
446 446
     {
447
-        global $conf,$user,$langs,$db;
448
-        $conf=$this->savconf;
449
-        $user=$this->savuser;
450
-        $langs=$this->savlangs;
451
-        $db=$this->savdb;
447
+        global $conf, $user, $langs, $db;
448
+        $conf = $this->savconf;
449
+        $user = $this->savuser;
450
+        $langs = $this->savlangs;
451
+        $db = $this->savdb;
452 452
 
453 453
 
454 454
         //$dummyuser=new User($db);
@@ -462,42 +462,42 @@  discard block
 block discarded – undo
462 462
 		// Check access to SPECIMEN
463 463
         $user->rights->facture->lire = 0;
464 464
         $user->rights->facture->creer = 0;
465
-        $filename='SPECIMEN.pdf';             // Filename relative to module part
466
-        $result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'read');
467
-        $this->assertEquals(1,$result['accessallowed']);
465
+        $filename = 'SPECIMEN.pdf'; // Filename relative to module part
466
+        $result = dol_check_secure_access_document('facture', $filename, 0, '', '', 'read');
467
+        $this->assertEquals(1, $result['accessallowed']);
468 468
 
469 469
 
470 470
         // Check read permission
471 471
         $user->rights->facture->lire = 1;
472 472
         $user->rights->facture->creer = 1;
473
-        $filename='FA010101/FA010101.pdf';    // Filename relative to module part
474
-        $result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'read');
475
-        $this->assertEquals(1,$result['accessallowed']);
473
+        $filename = 'FA010101/FA010101.pdf'; // Filename relative to module part
474
+        $result = dol_check_secure_access_document('facture', $filename, 0, '', '', 'read');
475
+        $this->assertEquals(1, $result['accessallowed']);
476 476
 
477 477
         $user->rights->facture->lire = 0;
478 478
         $user->rights->facture->creer = 0;
479
-        $filename='FA010101/FA010101.pdf';    // Filename relative to module part
480
-        $result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'read');
481
-        $this->assertEquals(0,$result['accessallowed']);
479
+        $filename = 'FA010101/FA010101.pdf'; // Filename relative to module part
480
+        $result = dol_check_secure_access_document('facture', $filename, 0, '', '', 'read');
481
+        $this->assertEquals(0, $result['accessallowed']);
482 482
 
483 483
         // Check write permission
484 484
         $user->rights->facture->lire = 0;
485 485
         $user->rights->facture->creer = 0;
486
-        $filename='FA010101/FA010101.pdf';    // Filename relative to module part
487
-        $result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'write');
488
-        $this->assertEquals(0,$result['accessallowed']);
486
+        $filename = 'FA010101/FA010101.pdf'; // Filename relative to module part
487
+        $result = dol_check_secure_access_document('facture', $filename, 0, '', '', 'write');
488
+        $this->assertEquals(0, $result['accessallowed']);
489 489
 
490 490
         $user->rights->facture->lire = 1;
491 491
         $user->rights->facture->creer = 1;
492
-        $filename='FA010101/FA010101.pdf';    // Filename relative to module part
493
-        $result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'write');
494
-        $this->assertEquals(1,$result['accessallowed']);
492
+        $filename = 'FA010101/FA010101.pdf'; // Filename relative to module part
493
+        $result = dol_check_secure_access_document('facture', $filename, 0, '', '', 'write');
494
+        $this->assertEquals(1, $result['accessallowed']);
495 495
 
496 496
         $user->rights->facture->lire = 1;
497 497
         $user->rights->facture->creer = 0;
498
-        $filename='FA010101/FA010101.pdf';    // Filename relative to module part
499
-        $result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'write');
500
-        $this->assertEquals(0,$result['accessallowed']);
498
+        $filename = 'FA010101/FA010101.pdf'; // Filename relative to module part
499
+        $result = dol_check_secure_access_document('facture', $filename, 0, '', '', 'write');
500
+        $this->assertEquals(0, $result['accessallowed']);
501 501
 
502 502
 
503 503
         // We restore user properties
Please login to merge, or discard this patch.
dolibarr/test/phpunit/BonPrelevementTest.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *		\remarks	To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	$user->fetch(1);
36 36
 	$user->getrights();
37 37
 }
38
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
38
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
39 39
 
40 40
 $langs->load("main");
41 41
 
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 		parent::__construct();
66 66
 
67 67
 		//$this->sharedFixture
68
-		global $conf,$user,$langs,$db;
69
-		$this->savconf=$conf;
70
-		$this->savuser=$user;
71
-		$this->savlangs=$langs;
72
-		$this->savdb=$db;
68
+		global $conf, $user, $langs, $db;
69
+		$this->savconf = $conf;
70
+		$this->savuser = $user;
71
+		$this->savlangs = $langs;
72
+		$this->savdb = $db;
73 73
 
74 74
 		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
75 75
 		//print " - db ".$db->db;
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public static function setUpBeforeClass()
85 85
     {
86
-    	global $conf,$user,$langs,$db;
87
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
86
+    	global $conf, $user, $langs, $db;
87
+		$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
88 88
 
89 89
     	print __METHOD__."\n";
90 90
     }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public static function tearDownAfterClass()
98 98
     {
99
-    	global $conf,$user,$langs,$db;
99
+    	global $conf, $user, $langs, $db;
100 100
 		$db->rollback();
101 101
 
102 102
 		print __METHOD__."\n";
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
     protected function setUp()
111 111
     {
112
-    	global $conf,$user,$langs,$db;
113
-		$conf=$this->savconf;
114
-		$user=$this->savuser;
115
-		$langs=$this->savlangs;
116
-		$db=$this->savdb;
112
+    	global $conf, $user, $langs, $db;
113
+		$conf = $this->savconf;
114
+		$user = $this->savuser;
115
+		$langs = $this->savlangs;
116
+		$db = $this->savdb;
117 117
 
118 118
 		print __METHOD__."\n";
119 119
     }
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function testBonPrelevementCreate()
136 136
     {
137
-    	global $conf,$user,$langs,$db;
138
-		$conf=$this->savconf;
139
-		$user=$this->savuser;
140
-		$langs=$this->savlangs;
141
-		$db=$this->savdb;
137
+    	global $conf, $user, $langs, $db;
138
+		$conf = $this->savconf;
139
+		$user = $this->savuser;
140
+		$langs = $this->savlangs;
141
+		$db = $this->savdb;
142 142
 
143 143
 		// TODO
144 144
 		// Create invoice
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 
152 152
 
153 153
 		// Create withdraw record and generate SEPA file
154
-		$localobject=new BonPrelevement($this->savdb);
154
+		$localobject = new BonPrelevement($this->savdb);
155 155
     	//$localobject->date_solde=dol_now();
156
-    	$result=$localobject->Create(0,0,'simu');
156
+    	$result = $localobject->Create(0, 0, 'simu');
157 157
 
158 158
     	print __METHOD__." result=".$result."\n";
159 159
     	$this->assertEquals($result, 0);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/UserGroupTest.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *      \remarks    To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     $user->fetch(1);
35 35
     $user->getrights();
36 36
 }
37
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
37
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
38 38
 
39 39
 
40 40
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
     	parent::__construct();
63 63
 
64 64
     	//$this->sharedFixture
65
-        global $conf,$user,$langs,$db;
66
-        $this->savconf=$conf;
67
-        $this->savuser=$user;
68
-        $this->savlangs=$langs;
69
-        $this->savdb=$db;
65
+        global $conf, $user, $langs, $db;
66
+        $this->savconf = $conf;
67
+        $this->savuser = $user;
68
+        $this->savlangs = $langs;
69
+        $this->savdb = $db;
70 70
 
71 71
         print __METHOD__." db->type=".$db->type." user->id=".$user->id;
72 72
         //print " - db ".$db->db;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     // Static methods
77 77
     public static function setUpBeforeClass()
78 78
     {
79
-        global $conf,$user,$langs,$db;
79
+        global $conf, $user, $langs, $db;
80 80
         $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
81 81
 
82 82
         print __METHOD__."\n";
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     // tear down after class
86 86
     public static function tearDownAfterClass()
87 87
     {
88
-        global $conf,$user,$langs,$db;
88
+        global $conf, $user, $langs, $db;
89 89
         $db->rollback();
90 90
 
91 91
         print __METHOD__."\n";
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
     */
99 99
     protected function setUp()
100 100
     {
101
-        global $conf,$user,$langs,$db;
102
-        $conf=$this->savconf;
103
-        $user=$this->savuser;
104
-        $langs=$this->savlangs;
105
-        $db=$this->savdb;
101
+        global $conf, $user, $langs, $db;
102
+        $conf = $this->savconf;
103
+        $user = $this->savuser;
104
+        $langs = $this->savlangs;
105
+        $db = $this->savdb;
106 106
 
107 107
         print __METHOD__."\n";
108 108
     }
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function testUserGroupCreate()
126 126
     {
127
-        global $conf,$user,$langs,$db;
128
-        $conf=$this->savconf;
129
-        $user=$this->savuser;
130
-        $langs=$this->savlangs;
131
-        $db=$this->savdb;
127
+        global $conf, $user, $langs, $db;
128
+        $conf = $this->savconf;
129
+        $user = $this->savuser;
130
+        $langs = $this->savlangs;
131
+        $db = $this->savdb;
132 132
 
133
-        $localobject=new UserGroup($this->savdb);
133
+        $localobject = new UserGroup($this->savdb);
134 134
         $localobject->initAsSpecimen();
135
-        $result=$localobject->create($user);
135
+        $result = $localobject->create($user);
136 136
 
137 137
         $this->assertLessThan($result, 0);
138 138
         print __METHOD__." result=".$result."\n";
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public function testUserGroupFetch($id)
151 151
     {
152
-        global $conf,$user,$langs,$db;
153
-        $conf=$this->savconf;
154
-        $user=$this->savuser;
155
-        $langs=$this->savlangs;
156
-        $db=$this->savdb;
152
+        global $conf, $user, $langs, $db;
153
+        $conf = $this->savconf;
154
+        $user = $this->savuser;
155
+        $langs = $this->savlangs;
156
+        $db = $this->savdb;
157 157
 
158
-        $localobject=new UserGroup($this->savdb);
159
-        $result=$localobject->fetch($id);
158
+        $localobject = new UserGroup($this->savdb);
159
+        $result = $localobject->fetch($id);
160 160
 
161 161
         $this->assertLessThan($result, 0);
162 162
         print __METHOD__." id=".$id." result=".$result."\n";
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
      */
174 174
     public function testUserGroupUpdate($localobject)
175 175
     {
176
-        global $conf,$user,$langs,$db;
177
-        $conf=$this->savconf;
178
-        $user=$this->savuser;
179
-        $langs=$this->savlangs;
180
-        $db=$this->savdb;
176
+        global $conf, $user, $langs, $db;
177
+        $conf = $this->savconf;
178
+        $user = $this->savuser;
179
+        $langs = $this->savlangs;
180
+        $db = $this->savdb;
181 181
 
182
-        $localobject->note='New note after update';
183
-        $result=$localobject->update($user);
182
+        $localobject->note = 'New note after update';
183
+        $result = $localobject->update($user);
184 184
 
185 185
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
186 186
         $this->assertLessThan($result, 0);
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
      */
198 198
     public function testUserGroupAddRight($localobject)
199 199
     {
200
-        global $conf,$user,$langs,$db;
201
-        $conf=$this->savconf;
202
-        $user=$this->savuser;
203
-        $langs=$this->savlangs;
204
-        $db=$this->savdb;
200
+        global $conf, $user, $langs, $db;
201
+        $conf = $this->savconf;
202
+        $user = $this->savuser;
203
+        $langs = $this->savlangs;
204
+        $db = $this->savdb;
205 205
 
206
-        $result=$localobject->addrights(1,'bookmarks');
206
+        $result = $localobject->addrights(1, 'bookmarks');
207 207
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
208 208
 
209 209
         $this->assertLessThan($result, 0);
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
      */
221 221
     public function testUserGroupDelRight($localobject)
222 222
     {
223
-        global $conf,$user,$langs,$db;
224
-        $conf=$this->savconf;
225
-        $user=$this->savuser;
226
-        $langs=$this->savlangs;
227
-        $db=$this->savdb;
223
+        global $conf, $user, $langs, $db;
224
+        $conf = $this->savconf;
225
+        $user = $this->savuser;
226
+        $langs = $this->savlangs;
227
+        $db = $this->savdb;
228 228
 
229
-        $result=$localobject->delrights(1,'bookmarks');
229
+        $result = $localobject->delrights(1, 'bookmarks');
230 230
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
231 231
 
232 232
         $this->assertLessThan($result, 0);
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
      */
244 244
     public function testUserGroupOther($localobject)
245 245
     {
246
-        global $conf,$user,$langs,$db;
247
-        $conf=$this->savconf;
248
-        $user=$this->savuser;
249
-        $langs=$this->savlangs;
250
-        $db=$this->savdb;
246
+        global $conf, $user, $langs, $db;
247
+        $conf = $this->savconf;
248
+        $user = $this->savuser;
249
+        $langs = $this->savlangs;
250
+        $db = $this->savdb;
251 251
 
252 252
         /*$result=$localobject->setstatus(0);
253 253
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
      */
272 272
     public function testUserGroupDelete($id)
273 273
     {
274
-        global $conf,$user,$langs,$db;
275
-        $conf=$this->savconf;
276
-        $user=$this->savuser;
277
-        $langs=$this->savlangs;
278
-        $db=$this->savdb;
279
-
280
-        $localobject=new UserGroup($this->savdb);
281
-        $result=$localobject->fetch($id);
282
-        $result=$localobject->delete($id);
274
+        global $conf, $user, $langs, $db;
275
+        $conf = $this->savconf;
276
+        $user = $this->savuser;
277
+        $langs = $this->savlangs;
278
+        $db = $this->savdb;
279
+
280
+        $localobject = new UserGroup($this->savdb);
281
+        $result = $localobject->fetch($id);
282
+        $result = $localobject->delete($id);
283 283
 
284 284
         print __METHOD__." id=".$id." result=".$result."\n";
285 285
         $this->assertLessThan($result, 0);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/functional/InstallTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	public static function setUpBeforeClass()
51 51
 	{
52 52
 		// Make sure we backup and remove the configuration file to force new install.
53
-		@rename('htdocs/conf/conf.php', sys_get_temp_dir() . '/conf.php');
53
+		@rename('htdocs/conf/conf.php', sys_get_temp_dir().'/conf.php');
54 54
 
55 55
 		// Start without a database
56 56
 		self::dropTestDatabase();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	protected static function dropTestDatabase()
68 68
 	{
69 69
 		$mysqli = new mysqli(self::$db_host, self::$db_admin_user, self::$db_admin_pass);
70
-		$mysqli->query("DROP DATABASE " . self::$db_name);
70
+		$mysqli->query("DROP DATABASE ".self::$db_name);
71 71
 	}
72 72
 
73 73
     /**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	{
80 80
 		// Remove the generated configuration and restore the backed up file.
81 81
 		@unlink('htdocs/conf/conf.php');
82
-		@rename(sys_get_temp_dir() . '/conf.php', 'htdocs/conf/conf.php');
82
+		@rename(sys_get_temp_dir().'/conf.php', 'htdocs/conf/conf.php');
83 83
 
84 84
 		// Cleanup test database
85 85
 		self::dropTestDatabase();
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		// FIXME: the button itself should have an ID
222 222
 		$this->byId('nextbutton')->byTag('input')->click();
223 223
 		$time = $start->diff(new DateTimeImmutable());
224
-		echo "\nPopulating the database took " . $time->format("%s seconds.\n");
224
+		echo "\nPopulating the database took ".$time->format("%s seconds.\n");
225 225
 		$this->assertContains('/install/step2.php', $this->url());
226 226
 	}
227 227
 
Please login to merge, or discard this patch.
dolibarr/test/phpunit/functional/TakePosFunctionalTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	{
156 156
 		$this->url('/admin/const.php');
157 157
 		$this->authenticate();
158
-		$main_features_level_path='//input[@value="MAIN_FEATURES_LEVEL"]/following::input[@type="text"]';
158
+		$main_features_level_path = '//input[@value="MAIN_FEATURES_LEVEL"]/following::input[@type="text"]';
159 159
 		$main_features_level = $this->byXPath($main_features_level_path);
160 160
 		$main_features_level->clear();
161 161
 		$main_features_level->value('2');
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	{
177 177
 		$this->url('/admin/modules.php');
178 178
 		$this->authenticate();
179
-		$module_status_image_path='//a[contains(@href, "' . self::$module_id . '")]/img';
179
+		$module_status_image_path = '//a[contains(@href, "'.self::$module_id.'")]/img';
180 180
 		$module_status_image = $this->byXPath($module_status_image_path);
181 181
 		if (strstr($module_status_image->attribute('src'), 'switch_off.png')) {
182 182
 			// Enable the module
Please login to merge, or discard this patch.
dolibarr/test/phpunit/CMailFileTest.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *      \remarks    To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     $user->fetch(1);
35 35
     $user->getrights();
36 36
 }
37
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
37
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
38 38
 
39 39
 
40 40
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
     	parent::__construct();
63 63
 
64 64
     	//$this->sharedFixture
65
-        global $conf,$user,$langs,$db;
66
-        $this->savconf=$conf;
67
-        $this->savuser=$user;
68
-        $this->savlangs=$langs;
69
-        $this->savdb=$db;
65
+        global $conf, $user, $langs, $db;
66
+        $this->savconf = $conf;
67
+        $this->savuser = $user;
68
+        $this->savlangs = $langs;
69
+        $this->savdb = $db;
70 70
 
71 71
         print __METHOD__." db->type=".$db->type." user->id=".$user->id;
72 72
         //print " - db ".$db->db;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     // Static methods
77 77
     public static function setUpBeforeClass()
78 78
     {
79
-        global $conf,$user,$langs,$db;
79
+        global $conf, $user, $langs, $db;
80 80
         $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
81 81
 
82 82
         print __METHOD__."\n";
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     // tear down after class
86 86
     public static function tearDownAfterClass()
87 87
     {
88
-        global $conf,$user,$langs,$db;
88
+        global $conf, $user, $langs, $db;
89 89
         $db->rollback();
90 90
 
91 91
         print __METHOD__."\n";
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
      */
99 99
     protected function setUp()
100 100
     {
101
-        global $conf,$user,$langs,$db;
102
-        $conf=$this->savconf;
103
-        $user=$this->savuser;
104
-        $langs=$this->savlangs;
105
-        $db=$this->savdb;
101
+        global $conf, $user, $langs, $db;
102
+        $conf = $this->savconf;
103
+        $user = $this->savuser;
104
+        $langs = $this->savlangs;
105
+        $db = $this->savdb;
106 106
 
107
-        $conf->global->MAIN_DISABLE_ALL_MAILS=1;    // If I comment/remove this lien, unit test still works alone but failed when ran from AllTest. Don't know why.
107
+        $conf->global->MAIN_DISABLE_ALL_MAILS = 1; // If I comment/remove this lien, unit test still works alone but failed when ran from AllTest. Don't know why.
108 108
 
109 109
         print __METHOD__."\n";
110 110
     }
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function testCMailFileText()
127 127
     {
128
-        global $conf,$user,$langs,$db;
129
-        $conf=$this->savconf;
130
-        $user=$this->savuser;
131
-        $langs=$this->savlangs;
132
-        $db=$this->savdb;
128
+        global $conf, $user, $langs, $db;
129
+        $conf = $this->savconf;
130
+        $user = $this->savuser;
131
+        $langs = $this->savlangs;
132
+        $db = $this->savdb;
133 133
 
134
-        $localobject=new CMailFile('Test','[email protected]','[email protected]','Message txt',array(),array(),array(),'','',1,0);
134
+        $localobject = new CMailFile('Test', '[email protected]', '[email protected]', 'Message txt', array(), array(), array(), '', '', 1, 0);
135 135
 
136
-        $result=$localobject->sendfile();
136
+        $result = $localobject->sendfile();
137 137
         print __METHOD__." result=".$result."\n";
138
-        $this->assertFalse($result);   // False because mail send disabled
138
+        $this->assertFalse($result); // False because mail send disabled
139 139
 
140 140
         return $result;
141 141
     }
@@ -147,53 +147,53 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function testCMailFileStatic()
149 149
     {
150
-        global $conf,$user,$langs,$db;
151
-        $conf=$this->savconf;
152
-        $user=$this->savuser;
153
-        $langs=$this->savlangs;
154
-        $db=$this->savdb;
150
+        global $conf, $user, $langs, $db;
151
+        $conf = $this->savconf;
152
+        $user = $this->savuser;
153
+        $langs = $this->savlangs;
154
+        $db = $this->savdb;
155 155
 
156
-        $localobject=new CMailFile('','','','');
156
+        $localobject = new CMailFile('', '', '', '');
157 157
 
158
-        $src='John Doe <[email protected]>';
159
-        $result=$localobject->getValidAddress($src,0);
158
+        $src = 'John Doe <[email protected]>';
159
+        $result = $localobject->getValidAddress($src, 0);
160 160
         print __METHOD__." result=".$result."\n";
161
-        $this->assertEquals($result,'John Doe <[email protected]>');
161
+        $this->assertEquals($result, 'John Doe <[email protected]>');
162 162
 
163
-        $src='John Doe <[email protected]>';
164
-        $result=$localobject->getValidAddress($src,1);
163
+        $src = 'John Doe <[email protected]>';
164
+        $result = $localobject->getValidAddress($src, 1);
165 165
         print __METHOD__." result=".$result."\n";
166
-        $this->assertEquals($result,'<[email protected]>');
166
+        $this->assertEquals($result, '<[email protected]>');
167 167
 
168
-        $src='John Doe <[email protected]>';
169
-        $result=$localobject->getValidAddress($src,2);
168
+        $src = 'John Doe <[email protected]>';
169
+        $result = $localobject->getValidAddress($src, 2);
170 170
         print __METHOD__." result=".$result."\n";
171
-        $this->assertEquals($result,'[email protected]');
171
+        $this->assertEquals($result, '[email protected]');
172 172
 
173
-        $src='John Doe <[email protected]>';
174
-        $result=$localobject->getValidAddress($src,3,0);
173
+        $src = 'John Doe <[email protected]>';
174
+        $result = $localobject->getValidAddress($src, 3, 0);
175 175
         print __METHOD__." result=".$result."\n";
176
-        $this->assertEquals($result,'"John Doe" <[email protected]>');
176
+        $this->assertEquals($result, '"John Doe" <[email protected]>');
177 177
 
178
-        $src='John Doe <[email protected]>';
179
-        $result=$localobject->getValidAddress($src,3,1);
178
+        $src = 'John Doe <[email protected]>';
179
+        $result = $localobject->getValidAddress($src, 3, 1);
180 180
         print __METHOD__." result=".$result."\n";
181
-        $this->assertEquals($result,'"=?UTF-8?B?Sm9obiBEb2U=?=" <[email protected]>');
181
+        $this->assertEquals($result, '"=?UTF-8?B?Sm9obiBEb2U=?=" <[email protected]>');
182 182
 
183
-        $src='John Doe <[email protected]>';
184
-        $result=$localobject->getValidAddress($src,4);
183
+        $src = 'John Doe <[email protected]>';
184
+        $result = $localobject->getValidAddress($src, 4);
185 185
         print __METHOD__." result=".$result."\n";
186
-        $this->assertEquals($result,'John Doe');
186
+        $this->assertEquals($result, 'John Doe');
187 187
 
188
-        $src='John Doe <[email protected]>, John Doe2 <[email protected]>, John Doe3 <[email protected]>';
189
-        $result=$localobject->getValidAddress($src,4);
188
+        $src = 'John Doe <[email protected]>, John Doe2 <[email protected]>, John Doe3 <[email protected]>';
189
+        $result = $localobject->getValidAddress($src, 4);
190 190
         print __METHOD__." result=".$result."\n";
191
-        $this->assertEquals($result,'John Doe,John Doe2,John Doe3');
191
+        $this->assertEquals($result, 'John Doe,John Doe2,John Doe3');
192 192
 
193
-        $src='John Doe <[email protected]>, John Doe2 <[email protected]>, John Doe3 <[email protected]>';
194
-        $result=$localobject->getValidAddress($src,4,0,2);
193
+        $src = 'John Doe <[email protected]>, John Doe2 <[email protected]>, John Doe3 <[email protected]>';
194
+        $result = $localobject->getValidAddress($src, 4, 0, 2);
195 195
         print __METHOD__." result=".$result."\n";
196
-        $this->assertEquals($result,'John Doe,John Doe2...');
196
+        $this->assertEquals($result, 'John Doe,John Doe2...');
197 197
 
198 198
         return $result;
199 199
     }
Please login to merge, or discard this patch.