Test Failed
Push — master ( e0c20c...b8c830 )
by Alxarafe
39:29
created
dolibarr/test/phpunit/ActionCommTest.php 1 patch
Spacing   +47 added lines, -47 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
         if (empty($conf->agenda->enabled)) { print __METHOD__." module agenda must be enabled.\n"; die(); }
@@ -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
         //print $db->getVersion()."\n";
@@ -127,28 +127,28 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function testActionCommCreate()
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 136
         $now = dol_now();
137 137
 
138
-        $localobject=new ActionComm($this->savdb);
138
+        $localobject = new ActionComm($this->savdb);
139 139
 
140
-        $localobject->type_code   = 'AC_OTH_AUTO';		// Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
140
+        $localobject->type_code   = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
141 141
         $localobject->code        = 'AC_PHPUNITTEST';
142 142
         $localobject->label       = 'This is a description';
143 143
         $localobject->note        = 'This is note';
144 144
         $localobject->fk_project  = 0;
145 145
         $localobject->datep       = $now;
146 146
         $localobject->datef       = $now;
147
-        $localobject->percentage  = -1;   // Not applicable
147
+        $localobject->percentage  = -1; // Not applicable
148 148
         $localobject->socid       = 0;
149 149
         $localobject->contactid   = 0;
150
-        $localobject->authorid    = $user->id;   // User saving action
151
-        $localobject->userownerid = $user->id;	// Owner of action
150
+        $localobject->authorid    = $user->id; // User saving action
151
+        $localobject->userownerid = $user->id; // Owner of action
152 152
         // Fields when action is en email (content should be added into note)
153 153
         /*$localobject->email_msgid = $object->email_msgid;
154 154
          $localobject->email_from  = $object->email_from;
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
      */
181 181
     public function testActionCommFetch($id)
182 182
     {
183
-        global $conf,$user,$langs,$db;
184
-        $conf=$this->savconf;
185
-        $user=$this->savuser;
186
-        $langs=$this->savlangs;
187
-        $db=$this->savdb;
183
+        global $conf, $user, $langs, $db;
184
+        $conf = $this->savconf;
185
+        $user = $this->savuser;
186
+        $langs = $this->savlangs;
187
+        $db = $this->savdb;
188 188
 
189
-        $localobject=new ActionComm($this->savdb);
190
-        $result=$localobject->fetch($id);
189
+        $localobject = new ActionComm($this->savdb);
190
+        $result = $localobject->fetch($id);
191 191
 
192 192
         $this->assertLessThan($result, 0);
193 193
         print __METHOD__." id=".$id." result=".$result."\n";
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function testActionCommUpdate($localobject)
207 207
     {
208
-    	global $conf,$user,$langs,$db;
209
-    	$conf=$this->savconf;
210
-    	$user=$this->savuser;
211
-    	$langs=$this->savlangs;
212
-    	$db=$this->savdb;
208
+    	global $conf, $user, $langs, $db;
209
+    	$conf = $this->savconf;
210
+    	$user = $this->savuser;
211
+    	$langs = $this->savlangs;
212
+    	$db = $this->savdb;
213 213
 
214
-    	$localobject->label='New label';
215
-    	$result=$localobject->update($user);
214
+    	$localobject->label = 'New label';
215
+    	$result = $localobject->update($user);
216 216
 
217 217
     	$this->assertLessThan($result, 0);
218 218
     	print __METHOD__." id=".$id." result=".$result."\n";
@@ -230,15 +230,15 @@  discard block
 block discarded – undo
230 230
      */
231 231
     public function testActionCommDelete($id)
232 232
     {
233
-        global $conf,$user,$langs,$db;
234
-        $conf=$this->savconf;
235
-        $user=$this->savuser;
236
-        $langs=$this->savlangs;
237
-        $db=$this->savdb;
238
-
239
-        $localobject=new ActionComm($this->savdb);
240
-        $result=$localobject->fetch($id);
241
-        $result=$localobject->delete($user);
233
+        global $conf, $user, $langs, $db;
234
+        $conf = $this->savconf;
235
+        $user = $this->savuser;
236
+        $langs = $this->savlangs;
237
+        $db = $this->savdb;
238
+
239
+        $localobject = new ActionComm($this->savdb);
240
+        $result = $localobject->fetch($id);
241
+        $result = $localobject->delete($user);
242 242
 
243 243
         print __METHOD__." id=".$id." result=".$result."\n";
244 244
         $this->assertLessThan($result, 0);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/WebservicesInvoicesTest.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  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';
30 30
 require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php';
31
-require_once NUSOAP_PATH.'/nusoap.php';        // Include SOAP
31
+require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
32 32
 
33 33
 
34 34
 if (empty($user->id))
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 	$user->fetch(1);
38 38
 	$user->getrights();
39 39
 }
40
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
40
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
41 41
 
42
-$conf->global->MAIN_UMASK='0666';
42
+$conf->global->MAIN_UMASK = '0666';
43 43
 
44 44
 
45 45
 /**
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
 		parent::__construct();
73 73
 
74 74
 		//$this->sharedFixture
75
-		global $conf,$user,$langs,$db;
76
-		$this->savconf=$conf;
77
-		$this->savuser=$user;
78
-		$this->savlangs=$langs;
79
-		$this->savdb=$db;
75
+		global $conf, $user, $langs, $db;
76
+		$this->savconf = $conf;
77
+		$this->savuser = $user;
78
+		$this->savlangs = $langs;
79
+		$this->savdb = $db;
80 80
 
81 81
 		// Set the WebService URL
82 82
 		$WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php';
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		$this->soapclient = new nusoap_client($WS_DOL_URL);
85 85
 		if ($this->soapclient)
86 86
 		{
87
-			$this->soapclient->soap_defencoding='UTF-8';
87
+			$this->soapclient->soap_defencoding = 'UTF-8';
88 88
 			$this->soapclient->decodeUTF8(false);
89 89
 		}
90 90
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public static function setUpBeforeClass()
102 102
     {
103
-        global $conf,$user,$langs,$db;
103
+        global $conf, $user, $langs, $db;
104 104
 
105 105
 		// create a third_party, needed to create an invoice
106 106
 		//
@@ -115,25 +115,25 @@  discard block
 block discarded – undo
115 115
 		// transaction commit. So if the invoice is created in the same
116 116
 		// transaction than the third party, the FK constraint fails.
117 117
 		// See this post for more detail: http://stackoverflow.com/a/5014744/5187108
118
-		$societe=new Societe($db);
119
-		$societe->ref='';
120
-		$societe->name='name';
121
-		$societe->ref_ext='ref-phpunit';
122
-		$societe->status=1;
123
-		$societe->client=1;
124
-		$societe->code_client='CU0901-1234';
125
-		$societe->code_fournisseur='SU0901-1234';
126
-		$societe->fournisseur=0;
127
-		$societe->date_creation=$now;
128
-		$societe->tva_assuj=0;
129
-		$societe->particulier=0;
118
+		$societe = new Societe($db);
119
+		$societe->ref = '';
120
+		$societe->name = 'name';
121
+		$societe->ref_ext = 'ref-phpunit';
122
+		$societe->status = 1;
123
+		$societe->client = 1;
124
+		$societe->code_client = 'CU0901-1234';
125
+		$societe->code_fournisseur = 'SU0901-1234';
126
+		$societe->fournisseur = 0;
127
+		$societe->date_creation = $now;
128
+		$societe->tva_assuj = 0;
129
+		$societe->particulier = 0;
130 130
 
131 131
 		$societe->create($user);
132 132
 
133 133
 		self::$socid = $societe->id;
134 134
 		print __METHOD__." societe created id=".$societe->id."\n";
135 135
 
136
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
136
+		$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
137 137
 
138 138
         print __METHOD__."\n";
139 139
     }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public static function tearDownAfterClass()
147 147
     {
148
-    	global $conf,$user,$langs,$db;
148
+    	global $conf, $user, $langs, $db;
149 149
 		$db->rollback();
150 150
 
151 151
 		print __METHOD__."\n";
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
     protected function setUp()
160 160
     {
161
-    	global $conf,$user,$langs,$db;
162
-		$conf=$this->savconf;
163
-		$user=$this->savuser;
164
-		$langs=$this->savlangs;
165
-		$db=$this->savdb;
161
+    	global $conf, $user, $langs, $db;
162
+		$conf = $this->savconf;
163
+		$user = $this->savuser;
164
+		$langs = $this->savlangs;
165
+		$db = $this->savdb;
166 166
 
167 167
 		print __METHOD__."\n";
168 168
     }
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function testWSInvoicesCreateInvoice()
187 187
     {
188
-    	global $conf,$user,$langs,$db;
189
-    	$conf=$this->savconf;
190
-    	$user=$this->savuser;
191
-    	$langs=$this->savlangs;
192
-    	$db=$this->savdb;
188
+    	global $conf, $user, $langs, $db;
189
+    	$conf = $this->savconf;
190
+    	$user = $this->savuser;
191
+    	$langs = $this->savlangs;
192
+    	$db = $this->savdb;
193 193
 
194
-    	$WS_METHOD  = 'createInvoice';
194
+    	$WS_METHOD = 'createInvoice';
195 195
 
196
-    	$body = array (
196
+    	$body = array(
197 197
     			"id" => null,
198 198
 				"ref" => null,
199 199
 				"ref_ext" => "ref-phpunit-2",
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 				"note_private" => "Synchronised from Prestashop",
214 214
 				"note_public" => "",
215 215
 				"status" => "1",
216
-				"close_code" => null ,
216
+				"close_code" => null,
217 217
 				"close_note" => null,
218 218
 				"project_id" => null,
219 219
 				"lines" => array(
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
 					"product_id" => "",
233 233
 					"product_ref" => "",
234 234
 					"product_label" => "",
235
-					"product_desc" => "" ))
235
+					"product_desc" => ""))
236 236
 					);
237 237
 
238 238
     	// Call the WebService method and store its result in $result.
239
-    	$authentication=array(
239
+    	$authentication = array(
240 240
     	'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
241 241
     	'sourceapplication'=>'DEMO',
242 242
     	'login'=>'admin',
@@ -244,18 +244,18 @@  discard block
 block discarded – undo
244 244
     	'entity'=>'');
245 245
 
246 246
     	// Test URL
247
-    	$result='';
248
-    	$parameters = array('authentication'=>$authentication,'invoice'=>$body);
247
+    	$result = '';
248
+    	$parameters = array('authentication'=>$authentication, 'invoice'=>$body);
249 249
     	print __METHOD__." call method ".$WS_METHOD."\n";
250 250
     	try {
251
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,'');
251
+    		$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
252 252
     	}
253
-    	catch(SoapFault $exception)
253
+    	catch (SoapFault $exception)
254 254
     	{
255 255
     		echo $exception;
256
-    		$result=0;
256
+    		$result = 0;
257 257
     	}
258
-    	if (! $result || ! empty($result['faultstring']))
258
+    	if (!$result || !empty($result['faultstring']))
259 259
     	{
260 260
     		//var_dump($soapclient);
261 261
     		print $this->soapclient->error_str;
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     	}
268 268
 
269 269
     	print __METHOD__." result=".$result['result']['result_code']."\n";
270
-    	$this->assertEquals('OK',$result['result']['result_code']);
270
+    	$this->assertEquals('OK', $result['result']['result_code']);
271 271
     	$this->assertEquals('ref-phpunit-2', $result['ref_ext']);
272 272
 
273 273
 
@@ -285,16 +285,16 @@  discard block
 block discarded – undo
285 285
      */
286 286
     public function testWSInvoicesGetInvoiceByRefExt($result)
287 287
     {
288
-    	global $conf,$user,$langs,$db;
289
-    	$conf=$this->savconf;
290
-    	$user=$this->savuser;
291
-    	$langs=$this->savlangs;
292
-    	$db=$this->savdb;
288
+    	global $conf, $user, $langs, $db;
289
+    	$conf = $this->savconf;
290
+    	$user = $this->savuser;
291
+    	$langs = $this->savlangs;
292
+    	$db = $this->savdb;
293 293
 
294
-    	$WS_METHOD  = 'getInvoice';
294
+    	$WS_METHOD = 'getInvoice';
295 295
 
296 296
     	// Call the WebService method and store its result in $result.
297
-    	$authentication=array(
297
+    	$authentication = array(
298 298
     	'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
299 299
     	'sourceapplication'=>'DEMO',
300 300
     	'login'=>'admin',
@@ -302,18 +302,18 @@  discard block
 block discarded – undo
302 302
     	'entity'=>'');
303 303
 
304 304
     	// Test URL
305
-    	$result='';
305
+    	$result = '';
306 306
     	$parameters = array('authentication'=>$authentication, 'id'=>null, 'ref'=>null, 'ref_ext'=>'ref-phpunit-2');
307 307
     	print __METHOD__." call method ".$WS_METHOD."\n";
308 308
     	try {
309
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,'');
309
+    		$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
310 310
     	}
311
-    	catch(SoapFault $exception)
311
+    	catch (SoapFault $exception)
312 312
     	{
313 313
     		echo $exception;
314
-    		$result=0;
314
+    		$result = 0;
315 315
     	}
316
-    	if (! $result || ! empty($result['faultstring']))
316
+    	if (!$result || !empty($result['faultstring']))
317 317
     	{
318 318
     		print $this->soapclient->error_str;
319 319
     		print "\n<br>\n";
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     		print "\n";
324 324
     	}
325 325
     	print __METHOD__." result=".$result['result']['result_code']."\n";
326
-    	$this->assertEquals('OK',$result['result']['result_code']);
326
+    	$this->assertEquals('OK', $result['result']['result_code']);
327 327
     	$this->assertEquals('ref-phpunit-2', $result['invoice']['ref_ext']);
328 328
 
329 329
 
@@ -341,16 +341,16 @@  discard block
 block discarded – undo
341 341
      */
342 342
     public function testWSInvoicesUpdateInvoiceByRefExt($result)
343 343
     {
344
-    	global $conf,$user,$langs,$db;
345
-    	$conf=$this->savconf;
346
-    	$user=$this->savuser;
347
-    	$langs=$this->savlangs;
348
-    	$db=$this->savdb;
344
+    	global $conf, $user, $langs, $db;
345
+    	$conf = $this->savconf;
346
+    	$user = $this->savuser;
347
+    	$langs = $this->savlangs;
348
+    	$db = $this->savdb;
349 349
 
350
-    	$WS_METHOD  = 'updateInvoice';
350
+    	$WS_METHOD = 'updateInvoice';
351 351
 
352 352
     	// update status to 2
353
-    	$body = array (
353
+    	$body = array(
354 354
     		"id" => null,
355 355
 			"ref" => null,
356 356
 			"ref_ext" => "ref-phpunit-2",
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			"note_private" => "Synchronised from Prestashop",
371 371
 			"note_public" => "",
372 372
 			"status" => "2",
373
-			"close_code" => null ,
373
+			"close_code" => null,
374 374
 			"close_note" => null,
375 375
 			"project_id" => null,
376 376
 			"lines"  => array(
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 			);
395 395
 
396 396
     	// Call the WebService method and store its result in $result.
397
-    	$authentication=array(
397
+    	$authentication = array(
398 398
     	'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
399 399
     	'sourceapplication'=>'DEMO',
400 400
     	'login'=>'admin',
@@ -402,18 +402,18 @@  discard block
 block discarded – undo
402 402
     	'entity'=>'');
403 403
 
404 404
     	// Test URL
405
-    	$result='';
406
-    	$parameters = array('authentication'=>$authentication,'invoice'=>$body);
405
+    	$result = '';
406
+    	$parameters = array('authentication'=>$authentication, 'invoice'=>$body);
407 407
     	print __METHOD__." call method ".$WS_METHOD."\n";
408 408
     	try {
409
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,'');
409
+    		$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
410 410
     	}
411
-    	catch(SoapFault $exception)
411
+    	catch (SoapFault $exception)
412 412
     	{
413 413
     		echo $exception;
414
-    		$result=0;
414
+    		$result = 0;
415 415
     	}
416
-    	if (! $result || ! empty($result['faultstring']))
416
+    	if (!$result || !empty($result['faultstring']))
417 417
     	{
418 418
     		print $this->soapclient->error_str;
419 419
     		print "\n<br>\n";
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     	}
425 425
 
426 426
     	print __METHOD__." result=".$result['result']['result_code'].$result['result']['result_label']."\n";
427
-    	$this->assertEquals('OK',$result['result']['result_code']);
427
+    	$this->assertEquals('OK', $result['result']['result_code']);
428 428
     	$this->assertEquals('ref-phpunit-2', $result['ref_ext']);
429 429
 
430 430
 
Please login to merge, or discard this patch.
dolibarr/test/phpunit/CommonInvoiceTest.php 1 patch
Spacing   +20 added lines, -20 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,13 +124,13 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function testCalculateDateLimReglement()
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 Facture($this->savdb);
133
+        $localobject = new Facture($this->savdb);
134 134
         $localobject->fetch(1);
135 135
         $localobject->date = dol_mktime(12, 0, 0, 1, 1, 2010);
136 136
 
Please login to merge, or discard this patch.
dolibarr/test/phpunit/AdminLibTest.php 1 patch
Spacing   +29 added lines, -29 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
     }
@@ -123,24 +123,24 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function testVersionCompare()
125 125
     {
126
-        global $conf,$user,$langs,$db;
127
-        $conf=$this->savconf;
128
-        $user=$this->savuser;
129
-        $langs=$this->savlangs;
130
-        $db=$this->savdb;
126
+        global $conf, $user, $langs, $db;
127
+        $conf = $this->savconf;
128
+        $user = $this->savuser;
129
+        $langs = $this->savlangs;
130
+        $db = $this->savdb;
131 131
 
132
-        $result=versioncompare(array(3,1,-4),array(3,1,1));
132
+        $result = versioncompare(array(3, 1, -4), array(3, 1, 1));
133 133
         print __METHOD__." result=".$result."\n";
134
-        $this->assertEquals(-3,$result);
135
-        $result=versioncompare(array(3,1,0),array(3,1,1));
134
+        $this->assertEquals(-3, $result);
135
+        $result = versioncompare(array(3, 1, 0), array(3, 1, 1));
136 136
         print __METHOD__." result=".$result."\n";
137
-        $this->assertEquals(-3,$result);
138
-        $result=versioncompare(array(3,1,0),array(3,2,0));
137
+        $this->assertEquals(-3, $result);
138
+        $result = versioncompare(array(3, 1, 0), array(3, 2, 0));
139 139
         print __METHOD__." result=".$result."\n";
140
-        $this->assertEquals(-2,$result);
141
-        $result=versioncompare(array(3,1,0),array(3,1,0));
140
+        $this->assertEquals(-2, $result);
141
+        $result = versioncompare(array(3, 1, 0), array(3, 1, 0));
142 142
         print __METHOD__." result=".$result."\n";
143
-        $this->assertEquals(0,$result);
143
+        $this->assertEquals(0, $result);
144 144
 
145 145
         return $result;
146 146
     }
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
 
157 157
 		require_once dirname(__FILE__).'/../../htdocs/core/modules/modExpenseReport.class.php';
158 158
 		print "Enable module modExpenseReport";
159
-		$moduledescriptor=new modExpenseReport($db);
159
+		$moduledescriptor = new modExpenseReport($db);
160 160
 		$moduledescriptor->init();
161 161
 		$conf->setValues($db);
162 162
 
163 163
 		require_once dirname(__FILE__).'/../../htdocs/core/modules/modApi.class.php';
164 164
 		print "Enable module modAPI";
165
-		$moduledescriptor=new modApi($db);
165
+		$moduledescriptor = new modApi($db);
166 166
 		$moduledescriptor->init();
167 167
 		$conf->setValues($db);
168 168
     }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/AccountingAccountTest.php 1 patch
Spacing   +44 added lines, -44 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
         if (empty($conf->accounting->enabled)) { print __METHOD__." module accouting must be enabled.\n"; die(); }
@@ -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
         //print $db->getVersion()."\n";
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function testAccountingAccountCreate()
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 AccountingAccount($this->savdb);
136
+        $localobject = new AccountingAccount($this->savdb);
137 137
         $localobject->fk_pcg_version = 'PCG99-ABREGE';
138 138
         $localobject->account_category = 0;
139 139
         $localobject->pcg_type = 'XXXXX';
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $localobject->account_parent = 0;
142 142
         $localobject->label = 'Account specimen';
143 143
         $localobject->active = 0;
144
-        $result=$localobject->create($user);
144
+        $result = $localobject->create($user);
145 145
 
146 146
         $this->assertLessThan($result, 0);
147 147
         print __METHOD__." result=".$result."\n";
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public function testAccountingAccountFetch($id)
161 161
     {
162
-        global $conf,$user,$langs,$db;
163
-        $conf=$this->savconf;
164
-        $user=$this->savuser;
165
-        $langs=$this->savlangs;
166
-        $db=$this->savdb;
162
+        global $conf, $user, $langs, $db;
163
+        $conf = $this->savconf;
164
+        $user = $this->savuser;
165
+        $langs = $this->savlangs;
166
+        $db = $this->savdb;
167 167
 
168
-        $localobject=new AccountingAccount($this->savdb);
169
-        $result=$localobject->fetch($id);
168
+        $localobject = new AccountingAccount($this->savdb);
169
+        $result = $localobject->fetch($id);
170 170
 
171 171
         $this->assertLessThan($result, 0);
172 172
         print __METHOD__." id=".$id." result=".$result."\n";
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function testAccountingAccountUpdate($localobject)
186 186
     {
187
-    	global $conf,$user,$langs,$db;
188
-    	$conf=$this->savconf;
189
-    	$user=$this->savuser;
190
-    	$langs=$this->savlangs;
191
-    	$db=$this->savdb;
187
+    	global $conf, $user, $langs, $db;
188
+    	$conf = $this->savconf;
189
+    	$user = $this->savuser;
190
+    	$langs = $this->savlangs;
191
+    	$db = $this->savdb;
192 192
 
193
-    	$localobject->label='New label';
194
-    	$result=$localobject->update($user);
193
+    	$localobject->label = 'New label';
194
+    	$result = $localobject->update($user);
195 195
 
196 196
     	$this->assertLessThan($result, 0);
197 197
     	print __METHOD__." id=".$id." result=".$result."\n";
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
      */
210 210
     public function testAccountingAccountDelete($id)
211 211
     {
212
-        global $conf,$user,$langs,$db;
213
-        $conf=$this->savconf;
214
-        $user=$this->savuser;
215
-        $langs=$this->savlangs;
216
-        $db=$this->savdb;
217
-
218
-        $localobject=new AccountingAccount($this->savdb);
219
-        $result=$localobject->fetch($id);
220
-        $result=$localobject->delete($user);
212
+        global $conf, $user, $langs, $db;
213
+        $conf = $this->savconf;
214
+        $user = $this->savuser;
215
+        $langs = $this->savlangs;
216
+        $db = $this->savdb;
217
+
218
+        $localobject = new AccountingAccount($this->savdb);
219
+        $result = $localobject->fetch($id);
220
+        $result = $localobject->delete($user);
221 221
 
222 222
         print __METHOD__." id=".$id." result=".$result."\n";
223 223
         $this->assertLessThan($result, 0);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/FactureTestRounding.php 1 patch
Spacing   +72 added lines, -72 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
     }
@@ -128,29 +128,29 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function testFactureRoundingCreate1()
130 130
     {
131
-        global $conf,$user,$langs,$db;
132
-        $conf=$this->savconf;
133
-        $user=$this->savuser;
134
-        $langs=$this->savlangs;
135
-        $db=$this->savdb;
131
+        global $conf, $user, $langs, $db;
132
+        $conf = $this->savconf;
133
+        $user = $this->savuser;
134
+        $langs = $this->savlangs;
135
+        $db = $this->savdb;
136 136
 
137
-		$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
137
+		$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0;
138 138
 
139
-        $localobject=new Facture($this->savdb);
139
+        $localobject = new Facture($this->savdb);
140 140
         $localobject->initAsSpecimen();
141
-        $localobject->lines=array();
141
+        $localobject->lines = array();
142 142
         unset($localobject->total_ht);
143 143
         unset($localobject->total_ttc);
144 144
         unset($localobject->total_tva);
145
-        $result=$localobject->create($user);
145
+        $result = $localobject->create($user);
146 146
 
147 147
         // Add two lines
148
-        for ($i=0; $i<2; $i++)
148
+        for ($i = 0; $i < 2; $i++)
149 149
         {
150 150
             $localobject->addline('Description '.$i, 1.24, 1, 10);
151 151
         }
152 152
 
153
-        $newlocalobject=new Facture($this->savdb);
153
+        $newlocalobject = new Facture($this->savdb);
154 154
         $newlocalobject->fetch($result);
155 155
         //var_dump($newlocalobject);
156 156
 
@@ -171,29 +171,29 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function testFactureRoundingCreate2()
173 173
     {
174
-        global $conf,$user,$langs,$db;
175
-        $conf=$this->savconf;
176
-        $user=$this->savuser;
177
-        $langs=$this->savlangs;
178
-        $db=$this->savdb;
174
+        global $conf, $user, $langs, $db;
175
+        $conf = $this->savconf;
176
+        $user = $this->savuser;
177
+        $langs = $this->savlangs;
178
+        $db = $this->savdb;
179 179
 
180
-        $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
180
+        $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0;
181 181
 
182
-        $localobject=new Facture($this->savdb);
182
+        $localobject = new Facture($this->savdb);
183 183
         $localobject->initAsSpecimen();
184
-        $localobject->lines=array();
184
+        $localobject->lines = array();
185 185
         unset($localobject->total_ht);
186 186
         unset($localobject->total_ttc);
187 187
         unset($localobject->total_vat);
188
-        $result=$localobject->create($user);
188
+        $result = $localobject->create($user);
189 189
 
190 190
         // Add two lines
191
-        for ($i=0; $i<2; $i++)
191
+        for ($i = 0; $i < 2; $i++)
192 192
         {
193 193
             $localobject->addline('Description '.$i, 1.24, 1, 10);
194 194
         }
195 195
 
196
-        $newlocalobject=new Facture($this->savdb);
196
+        $newlocalobject = new Facture($this->savdb);
197 197
         $newlocalobject->fetch($result);
198 198
         //var_dump($newlocalobject);
199 199
 
@@ -211,31 +211,31 @@  discard block
 block discarded – undo
211 211
      */
212 212
     public function testFactureAddLine1()
213 213
     {
214
-    	global $conf,$user,$langs,$db;
215
-    	$conf=$this->savconf;
216
-    	$user=$this->savuser;
217
-    	$langs=$this->savlangs;
218
-    	$db=$this->savdb;
214
+    	global $conf, $user, $langs, $db;
215
+    	$conf = $this->savconf;
216
+    	$user = $this->savuser;
217
+    	$langs = $this->savlangs;
218
+    	$db = $this->savdb;
219 219
 
220 220
     	// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0
221
-    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
221
+    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0;
222 222
 
223
-    	$localobject1a=new Facture($this->savdb);
223
+    	$localobject1a = new Facture($this->savdb);
224 224
     	$localobject1a->initAsSpecimen('nolines');
225
-    	$facid=$localobject1a->create($user);
226
-    	$localobject1a->addline('Line 1', 6.36, 15, 21);	// This include update_price
225
+    	$facid = $localobject1a->create($user);
226
+    	$localobject1a->addline('Line 1', 6.36, 15, 21); // This include update_price
227 227
     	print __METHOD__." id=".$facid." total_ttc=".$localobject1a->total_ttc."\n";
228 228
     	$this->assertEquals(95.40, $localobject1a->total_ht);
229 229
     	$this->assertEquals(20.03, $localobject1a->total_tva);
230 230
     	$this->assertEquals(115.43, $localobject1a->total_ttc);
231 231
 
232 232
     	// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1
233
-    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1;
233
+    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1;
234 234
 
235
-    	$localobject1b=new Facture($this->savdb);
235
+    	$localobject1b = new Facture($this->savdb);
236 236
     	$localobject1b->initAsSpecimen('nolines');
237
-    	$facid=$localobject1b->create($user);
238
-    	$localobject1b->addline('Line 1', 6.36, 15, 21);	// This include update_price
237
+    	$facid = $localobject1b->create($user);
238
+    	$localobject1b->addline('Line 1', 6.36, 15, 21); // This include update_price
239 239
     	print __METHOD__." id=".$facid." total_ttc=".$localobject1b->total_ttc."\n";
240 240
     	$this->assertEquals(95.40, $localobject1b->total_ht, 'testFactureAddLine1 total_ht');
241 241
     	$this->assertEquals(20.03, $localobject1b->total_tva, 'testFactureAddLine1 total_tva');
@@ -252,18 +252,18 @@  discard block
 block discarded – undo
252 252
      */
253 253
     public function testFactureAddLine2()
254 254
     {
255
-    	global $conf,$user,$langs,$db;
256
-    	$conf=$this->savconf;
257
-    	$user=$this->savuser;
258
-    	$langs=$this->savlangs;
259
-    	$db=$this->savdb;
255
+    	global $conf, $user, $langs, $db;
256
+    	$conf = $this->savconf;
257
+    	$user = $this->savuser;
258
+    	$langs = $this->savlangs;
259
+    	$db = $this->savdb;
260 260
 
261 261
     	// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0
262
-    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
262
+    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0;
263 263
 
264
-    	$localobject2=new Facture($this->savdb);
264
+    	$localobject2 = new Facture($this->savdb);
265 265
     	$localobject2->initAsSpecimen('nolines');
266
-    	$facid=$localobject2->create($user);
266
+    	$facid = $localobject2->create($user);
267 267
     	$localobject2->addline('Line 1', 6.36, 5, 21);
268 268
     	$localobject2->addline('Line 2', 6.36, 5, 21);
269 269
     	$localobject2->addline('Line 3', 6.36, 5, 21);
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
     	$this->assertEquals(115.44, $localobject2->total_ttc);
274 274
 
275 275
     	// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1
276
-    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1;
276
+    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1;
277 277
 
278
-    	$localobject2=new Facture($this->savdb);
278
+    	$localobject2 = new Facture($this->savdb);
279 279
     	$localobject2->initAsSpecimen('nolines');
280
-    	$facid=$localobject2->create($user);
280
+    	$facid = $localobject2->create($user);
281 281
     	$localobject2->addline('Line 1', 6.36, 5, 21);
282 282
     	$localobject2->addline('Line 2', 6.36, 5, 21);
283 283
     	$localobject2->addline('Line 3', 6.36, 5, 21);
@@ -297,18 +297,18 @@  discard block
 block discarded – undo
297 297
      */
298 298
     public function testFactureAddLine3()
299 299
     {
300
-    	global $conf,$user,$langs,$db;
301
-    	$conf=$this->savconf;
302
-    	$user=$this->savuser;
303
-    	$langs=$this->savlangs;
304
-    	$db=$this->savdb;
300
+    	global $conf, $user, $langs, $db;
301
+    	$conf = $this->savconf;
302
+    	$user = $this->savuser;
303
+    	$langs = $this->savlangs;
304
+    	$db = $this->savdb;
305 305
 
306 306
     	// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0
307
-    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
307
+    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0;
308 308
 
309
-    	$localobject3=new Facture($this->savdb);
309
+    	$localobject3 = new Facture($this->savdb);
310 310
     	$localobject3->initAsSpecimen('nolines');
311
-    	$facid=$localobject3->create($user);
311
+    	$facid = $localobject3->create($user);
312 312
     	$localobject3->addline('Line 1', 6.36, 3, 21);
313 313
     	$localobject3->addline('Line 2', 6.36, 3, 21);
314 314
     	$localobject3->addline('Line 3', 6.36, 3, 21);
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
     	$this->assertEquals(115.45, $localobject3->total_ttc);
321 321
 
322 322
     	// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1
323
-    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1;
323
+    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1;
324 324
 
325
-    	$localobject3=new Facture($this->savdb);
325
+    	$localobject3 = new Facture($this->savdb);
326 326
     	$localobject3->initAsSpecimen('nolines');
327
-    	$facid=$localobject3->create($user);
327
+    	$facid = $localobject3->create($user);
328 328
     	$localobject3->addline('Line 1', 6.36, 3, 21);
329 329
     	$localobject3->addline('Line 2', 6.36, 3, 21);
330 330
     	$localobject3->addline('Line 3', 6.36, 3, 21);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/ImportTest.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -23,21 +23,21 @@  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';
30 30
 
31
-if (! defined('NOREQUIREUSER'))  define('NOREQUIREUSER','1');
32
-if (! defined('NOREQUIREDB'))    define('NOREQUIREDB','1');
33
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
34
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
35
-if (! defined('NOCSRFCHECK'))    define('NOCSRFCHECK','1');
36
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
37
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1'); // If there is no menu to show
38
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
39
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
40
-if (! defined("NOLOGIN"))        define("NOLOGIN",'1');       // If this page is public (can be called outside logged session)
31
+if (!defined('NOREQUIREUSER'))  define('NOREQUIREUSER', '1');
32
+if (!defined('NOREQUIREDB'))    define('NOREQUIREDB', '1');
33
+if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
34
+if (!defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
35
+if (!defined('NOCSRFCHECK'))    define('NOCSRFCHECK', '1');
36
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
37
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1'); // If there is no menu to show
38
+if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
39
+if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
40
+if (!defined("NOLOGIN"))        define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
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,7 +79,7 @@  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
 		//$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
84 84
 
85 85
     	print __METHOD__."\n";
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     // tear down after class
89 89
     public static function tearDownAfterClass()
90 90
     {
91
-    	global $conf,$user,$langs,$db;
91
+    	global $conf, $user, $langs, $db;
92 92
 		//$db->rollback();
93 93
 
94 94
 		print __METHOD__."\n";
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
     protected function setUp()
103 103
     {
104
-    	global $conf,$user,$langs,$db;
105
-		$conf=$this->savconf;
106
-		$user=$this->savuser;
107
-		$langs=$this->savlangs;
108
-		$db=$this->savdb;
104
+    	global $conf, $user, $langs, $db;
105
+		$conf = $this->savconf;
106
+		$user = $this->savuser;
107
+		$langs = $this->savlangs;
108
+		$db = $this->savdb;
109 109
 
110 110
 		print __METHOD__."\n";
111 111
     }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function testImportSample1()
129 129
     {
130
-        $file=dirname(__FILE__).'/Example_import_company_1.csv';
130
+        $file = dirname(__FILE__).'/Example_import_company_1.csv';
131 131
 
132 132
         // TODO
133 133
         // Run import on file and check the record with field "auto" are filled
Please login to merge, or discard this patch.
dolibarr/test/phpunit/JsonLibTest.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -23,21 +23,21 @@  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';
30 30
 
31
-if (! defined('NOREQUIREUSER'))  define('NOREQUIREUSER','1');
32
-if (! defined('NOREQUIREDB'))    define('NOREQUIREDB','1');
33
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
34
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
35
-if (! defined('NOCSRFCHECK'))    define('NOCSRFCHECK','1');
36
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
37
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1'); // If there is no menu to show
38
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
39
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
40
-if (! defined("NOLOGIN"))        define("NOLOGIN",'1');       // If this page is public (can be called outside logged session)
31
+if (!defined('NOREQUIREUSER'))  define('NOREQUIREUSER', '1');
32
+if (!defined('NOREQUIREDB'))    define('NOREQUIREDB', '1');
33
+if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
34
+if (!defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
35
+if (!defined('NOCSRFCHECK'))    define('NOCSRFCHECK', '1');
36
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
37
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1'); // If there is no menu to show
38
+if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
39
+if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
40
+if (!defined("NOLOGIN"))        define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
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,7 +79,7 @@  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
         //$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
84 84
 
85 85
         print __METHOD__."\n";
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     // tear down after class
89 89
     public static function tearDownAfterClass()
90 90
     {
91
-        global $conf,$user,$langs,$db;
91
+        global $conf, $user, $langs, $db;
92 92
         //$db->rollback();
93 93
 
94 94
         print __METHOD__."\n";
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
     protected function setUp()
103 103
     {
104
-        global $conf,$user,$langs,$db;
105
-        $conf=$this->savconf;
106
-        $user=$this->savuser;
107
-        $langs=$this->savlangs;
108
-        $db=$this->savdb;
104
+        global $conf, $user, $langs, $db;
105
+        $conf = $this->savconf;
106
+        $user = $this->savuser;
107
+        $langs = $this->savlangs;
108
+        $db = $this->savdb;
109 109
 
110 110
         print __METHOD__."\n";
111 111
     }
@@ -127,47 +127,47 @@  discard block
 block discarded – undo
127 127
     public function testJsonEncode()
128 128
     {
129 129
         //$this->sharedFixture
130
-        global $conf,$user,$langs,$db;
131
-        $this->savconf=$conf;
132
-        $this->savuser=$user;
133
-        $this->savlangs=$langs;
134
-        $this->savdb=$db;
130
+        global $conf, $user, $langs, $db;
131
+        $this->savconf = $conf;
132
+        $this->savuser = $user;
133
+        $this->savlangs = $langs;
134
+        $this->savdb = $db;
135 135
 
136 136
         // Do a test with an array starting with 0
137
-        $arraytotest=array(0=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "'));
138
-		$arrayencodedexpected='[{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}]';
137
+        $arraytotest = array(0=>array('key'=>1, 'value'=>'PRODREF', 'label'=>'Product ref with é and special chars \\ \' "'));
138
+		$arrayencodedexpected = '[{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}]';
139 139
 
140
-        $encoded=json_encode($arraytotest);
141
-        $this->assertEquals($arrayencodedexpected,$encoded);
142
-        $decoded=json_decode($encoded,true);
143
-        $this->assertEquals($arraytotest,$decoded,'test for json_xxx');
140
+        $encoded = json_encode($arraytotest);
141
+        $this->assertEquals($arrayencodedexpected, $encoded);
142
+        $decoded = json_decode($encoded, true);
143
+        $this->assertEquals($arraytotest, $decoded, 'test for json_xxx');
144 144
 
145
-        $encoded=dol_json_encode($arraytotest);
146
-        $this->assertEquals($arrayencodedexpected,$encoded);
147
-        $decoded=dol_json_decode($encoded,true);
148
-        $this->assertEquals($arraytotest,$decoded,'test for dol_json_xxx');
145
+        $encoded = dol_json_encode($arraytotest);
146
+        $this->assertEquals($arrayencodedexpected, $encoded);
147
+        $decoded = dol_json_decode($encoded, true);
148
+        $this->assertEquals($arraytotest, $decoded, 'test for dol_json_xxx');
149 149
 
150 150
 		// Same test but array start with 2 instead of 0
151
-        $arraytotest=array(2=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "'));
152
-		$arrayencodedexpected='{"2":{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}}';
151
+        $arraytotest = array(2=>array('key'=>1, 'value'=>'PRODREF', 'label'=>'Product ref with é and special chars \\ \' "'));
152
+		$arrayencodedexpected = '{"2":{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}}';
153 153
 
154
-        $encoded=json_encode($arraytotest);
155
-        $this->assertEquals($arrayencodedexpected,$encoded);
156
-        $decoded=json_decode($encoded,true);
157
-        $this->assertEquals($arraytotest,$decoded,'test for json_xxx');
154
+        $encoded = json_encode($arraytotest);
155
+        $this->assertEquals($arrayencodedexpected, $encoded);
156
+        $decoded = json_decode($encoded, true);
157
+        $this->assertEquals($arraytotest, $decoded, 'test for json_xxx');
158 158
 
159
-        $encoded=dol_json_encode($arraytotest);
160
-        $this->assertEquals($arrayencodedexpected,$encoded);
161
-        $decoded=dol_json_decode($encoded,true);
162
-        $this->assertEquals($arraytotest,$decoded,'test for dol_json_xxx');
159
+        $encoded = dol_json_encode($arraytotest);
160
+        $this->assertEquals($arrayencodedexpected, $encoded);
161
+        $decoded = dol_json_decode($encoded, true);
162
+        $this->assertEquals($arraytotest, $decoded, 'test for dol_json_xxx');
163 163
 
164 164
         // Test with object
165
-        $now=gmmktime(12,0,0,1,1,1970);
166
-        $objecttotest=new stdClass();
167
-        $objecttotest->property1='abc';
168
-        $objecttotest->property2=1234;
169
-        $objecttotest->property3=$now;
170
-        $encoded=dol_json_encode($objecttotest);
171
-        $this->assertEquals('{"property1":"abc","property2":1234,"property3":43200}',$encoded);
165
+        $now = gmmktime(12, 0, 0, 1, 1, 1970);
166
+        $objecttotest = new stdClass();
167
+        $objecttotest->property1 = 'abc';
168
+        $objecttotest->property2 = 1234;
169
+        $objecttotest->property3 = $now;
170
+        $encoded = dol_json_encode($objecttotest);
171
+        $this->assertEquals('{"property1":"abc","property2":1234,"property3":43200}', $encoded);
172 172
     }
173 173
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/TicketTest.php 1 patch
Spacing   +88 added lines, -88 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,25 +124,25 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function testTicketCreate()
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 133
 		// Try to create one with bad values
134
-		$localobject=new Ticket($this->savdb);
134
+		$localobject = new Ticket($this->savdb);
135 135
 		$localobject->initAsSpecimen();
136 136
 		$localobject->ref = '';
137
-		$result=$localobject->create($user);
137
+		$result = $localobject->create($user);
138 138
 
139 139
 		print __METHOD__." result=".$result."\n";
140 140
 		$this->assertEquals(-3, $result, $localobject->error.join(',', $localobject->errors));
141 141
 
142 142
 		// Try to create one with correct values
143
-		$localobject=new Ticket($this->savdb);
143
+		$localobject = new Ticket($this->savdb);
144 144
 		$localobject->initAsSpecimen();
145
-		$result=$localobject->create($user);
145
+		$result = $localobject->create($user);
146 146
 
147 147
 		print __METHOD__." result=".$result."\n";
148 148
 		$this->assertGreaterThan(0, $result, $localobject->error.join(',', $localobject->errors));
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	public function testTicketFetch($id)
163 163
 	{
164
-		global $conf,$user,$langs,$db;
165
-		$conf=$this->savconf;
166
-		$user=$this->savuser;
167
-		$langs=$this->savlangs;
168
-		$db=$this->savdb;
164
+		global $conf, $user, $langs, $db;
165
+		$conf = $this->savconf;
166
+		$user = $this->savuser;
167
+		$langs = $this->savlangs;
168
+		$db = $this->savdb;
169 169
 
170
-		$localobject=new Ticket($this->savdb);
171
-		$result=$localobject->fetch($id);
170
+		$localobject = new Ticket($this->savdb);
171
+		$result = $localobject->fetch($id);
172 172
 
173 173
 		print __METHOD__." id=".$id." result=".$result."\n";
174 174
 		$this->assertGreaterThan(0, $result);
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public function testTicketmarkAsRead($localobject)
189 189
 	{
190
-		global $conf,$user,$langs,$db;
191
-		$conf=$this->savconf;
192
-		$user=$this->savuser;
193
-		$langs=$this->savlangs;
194
-		$db=$this->savdb;
190
+		global $conf, $user, $langs, $db;
191
+		$conf = $this->savconf;
192
+		$user = $this->savuser;
193
+		$langs = $this->savlangs;
194
+		$db = $this->savdb;
195 195
 
196
-		$result=$localobject->markAsRead($user);
196
+		$result = $localobject->markAsRead($user);
197 197
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
198 198
 
199 199
 		$this->assertGreaterThan(0, $result);
@@ -211,15 +211,15 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	public function testTicketsetProject($localobject)
213 213
 	{
214
-		global $conf,$user,$langs,$db;
215
-		$conf=$this->savconf;
216
-		$user=$this->savuser;
217
-		$langs=$this->savlangs;
218
-		$db=$this->savdb;
214
+		global $conf, $user, $langs, $db;
215
+		$conf = $this->savconf;
216
+		$user = $this->savuser;
217
+		$langs = $this->savlangs;
218
+		$db = $this->savdb;
219 219
 
220 220
 		$project_id = 1;
221 221
 
222
-		$result=$localobject->setProject($project_id);
222
+		$result = $localobject->setProject($project_id);
223 223
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
224 224
 
225 225
 		$this->assertGreaterThan(0, $result);
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
 	 */
238 238
 	public function testTicketsetContract($localobject)
239 239
 	{
240
-		global $conf,$user,$langs,$db;
241
-		$conf=$this->savconf;
242
-		$user=$this->savuser;
243
-		$langs=$this->savlangs;
244
-		$db=$this->savdb;
240
+		global $conf, $user, $langs, $db;
241
+		$conf = $this->savconf;
242
+		$user = $this->savuser;
243
+		$langs = $this->savlangs;
244
+		$db = $this->savdb;
245 245
 
246 246
 		$contract_id = 1;
247 247
 
248
-		$result=$localobject->setContract($contract_id);
248
+		$result = $localobject->setContract($contract_id);
249 249
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
250 250
 
251 251
 		$this->assertGreaterThan(0, $result);
@@ -263,15 +263,15 @@  discard block
 block discarded – undo
263 263
 	 */
264 264
 	public function testTicketsetProgression($localobject)
265 265
 	{
266
-		global $conf,$user,$langs,$db;
267
-		$conf=$this->savconf;
268
-		$user=$this->savuser;
269
-		$langs=$this->savlangs;
270
-		$db=$this->savdb;
266
+		global $conf, $user, $langs, $db;
267
+		$conf = $this->savconf;
268
+		$user = $this->savuser;
269
+		$langs = $this->savlangs;
270
+		$db = $this->savdb;
271 271
 
272 272
 		$percent = 80;
273 273
 
274
-		$result=$localobject->setProgression($percent);
274
+		$result = $localobject->setProgression($percent);
275 275
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
276 276
 
277 277
 		$this->assertGreaterThan(0, $result);
@@ -289,15 +289,15 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public function testTicketassignUser($localobject)
291 291
 	{
292
-		global $conf,$user,$langs,$db;
293
-		$conf=$this->savconf;
294
-		$user=$this->savuser;
295
-		$langs=$this->savlangs;
296
-		$db=$this->savdb;
292
+		global $conf, $user, $langs, $db;
293
+		$conf = $this->savconf;
294
+		$user = $this->savuser;
295
+		$langs = $this->savlangs;
296
+		$db = $this->savdb;
297 297
 
298 298
 		$user_id_to_assign = 1;
299 299
 
300
-		$result=$localobject->assignUser($user, $user_id_to_assign);
300
+		$result = $localobject->assignUser($user, $user_id_to_assign);
301 301
         ;
302 302
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
303 303
 
@@ -316,15 +316,15 @@  discard block
 block discarded – undo
316 316
 	 */
317 317
 	public function testTicketassignUserOther($localobject)
318 318
 	{
319
-		global $conf,$user,$langs,$db;
320
-		$conf=$this->savconf;
321
-		$user=$this->savuser;
322
-		$langs=$this->savlangs;
323
-		$db=$this->savdb;
319
+		global $conf, $user, $langs, $db;
320
+		$conf = $this->savconf;
321
+		$user = $this->savuser;
322
+		$langs = $this->savlangs;
323
+		$db = $this->savdb;
324 324
 
325 325
 		$user_id_to_assign = 2;
326 326
 
327
-		$result=$localobject->assignUser($user, $user_id_to_assign);
327
+		$result = $localobject->assignUser($user, $user_id_to_assign);
328 328
 		;
329 329
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
330 330
 
@@ -343,16 +343,16 @@  discard block
 block discarded – undo
343 343
 	 */
344 344
 	public function testTicketcreateTicketLog($localobject)
345 345
 	{
346
-		global $conf,$user,$langs,$db;
347
-		$conf=$this->savconf;
348
-		$user=$this->savuser;
349
-		$langs=$this->savlangs;
350
-		$db=$this->savdb;
346
+		global $conf, $user, $langs, $db;
347
+		$conf = $this->savconf;
348
+		$user = $this->savuser;
349
+		$langs = $this->savlangs;
350
+		$db = $this->savdb;
351 351
 
352 352
 
353 353
 		$message = 'Test ticket log';
354 354
 		$noemail = 1;
355
-		$result=$localobject->createTicketLog($user, $message, $noemail);
355
+		$result = $localobject->createTicketLog($user, $message, $noemail);
356 356
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
357 357
 
358 358
 		$this->assertGreaterThan(0, $result);
@@ -370,13 +370,13 @@  discard block
 block discarded – undo
370 370
 	 */
371 371
 	public function testTicketclose($localobject)
372 372
 	{
373
-		global $conf,$user,$langs,$db;
374
-		$conf=$this->savconf;
375
-		$user=$this->savuser;
376
-		$langs=$this->savlangs;
377
-		$db=$this->savdb;
373
+		global $conf, $user, $langs, $db;
374
+		$conf = $this->savconf;
375
+		$user = $this->savuser;
376
+		$langs = $this->savlangs;
377
+		$db = $this->savdb;
378 378
 
379
-		$result=$localobject->close();
379
+		$result = $localobject->close();
380 380
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
381 381
 
382 382
 		$this->assertGreaterThan(0, $result);
@@ -395,15 +395,15 @@  discard block
 block discarded – undo
395 395
 	 */
396 396
 	public function testTicketDelete($id)
397 397
 	{
398
-		global $conf,$user,$langs,$db;
399
-		$conf=$this->savconf;
400
-		$user=$this->savuser;
401
-		$langs=$this->savlangs;
402
-		$db=$this->savdb;
403
-
404
-		$localobject=new Ticket($this->savdb);
405
-		$result=$localobject->fetch($id);
406
-		$result=$localobject->delete($user);
398
+		global $conf, $user, $langs, $db;
399
+		$conf = $this->savconf;
400
+		$user = $this->savuser;
401
+		$langs = $this->savlangs;
402
+		$db = $this->savdb;
403
+
404
+		$localobject = new Ticket($this->savdb);
405
+		$result = $localobject->fetch($id);
406
+		$result = $localobject->delete($user);
407 407
 
408 408
 		print __METHOD__." id=".$id." result=".$result."\n";
409 409
 		$this->assertGreaterThan(0, $result);
Please login to merge, or discard this patch.