@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \remarks To run this script as CLI: phpunit filename.php |
26 | 26 | */ |
27 | 27 | |
28 | -global $conf,$user,$langs,$db; |
|
28 | +global $conf, $user, $langs, $db; |
|
29 | 29 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
30 | 30 | //require_once 'PHPUnit/Autoload.php'; |
31 | 31 | require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; |
@@ -37,7 +37,7 @@ discard block |
||
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 | 42 | |
43 | 43 | /** |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | parent::__construct($name); |
67 | 67 | |
68 | 68 | //$this->sharedFixture |
69 | - global $conf,$user,$langs,$db; |
|
70 | - $this->savconf=$conf; |
|
71 | - $this->savuser=$user; |
|
72 | - $this->savlangs=$langs; |
|
73 | - $this->savdb=$db; |
|
69 | + global $conf, $user, $langs, $db; |
|
70 | + $this->savconf = $conf; |
|
71 | + $this->savuser = $user; |
|
72 | + $this->savlangs = $langs; |
|
73 | + $this->savdb = $db; |
|
74 | 74 | |
75 | 75 | print __METHOD__." db->type=".$db->type." user->id=".$user->id; |
76 | 76 | //print " - db ".$db->db; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function setUpBeforeClass(): void |
86 | 86 | { |
87 | - global $conf,$user,$langs,$db; |
|
87 | + global $conf, $user, $langs, $db; |
|
88 | 88 | $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
89 | 89 | |
90 | 90 | if (getDolGlobalString('MAIN_FIRSTNAME_NAME_POSITION')) { |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public static function tearDownAfterClass(): void |
110 | 110 | { |
111 | - global $conf,$user,$langs,$db; |
|
111 | + global $conf, $user, $langs, $db; |
|
112 | 112 | $db->rollback(); |
113 | 113 | |
114 | 114 | print __METHOD__."\n"; |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected function setUp(): void |
123 | 123 | { |
124 | - global $conf,$user,$langs,$db; |
|
125 | - $conf=$this->savconf; |
|
126 | - $user=$this->savuser; |
|
127 | - $langs=$this->savlangs; |
|
128 | - $db=$this->savdb; |
|
124 | + global $conf, $user, $langs, $db; |
|
125 | + $conf = $this->savconf; |
|
126 | + $user = $this->savuser; |
|
127 | + $langs = $this->savlangs; |
|
128 | + $db = $this->savdb; |
|
129 | 129 | |
130 | 130 | print __METHOD__."\n"; |
131 | 131 | } |
@@ -146,20 +146,20 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function testAdherentTypeCreate() |
148 | 148 | { |
149 | - global $conf,$user,$langs,$db; |
|
150 | - $conf=$this->savconf; |
|
151 | - $user=$this->savuser; |
|
152 | - $langs=$this->savlangs; |
|
153 | - $db=$this->savdb; |
|
154 | - |
|
155 | - $localobject=new AdherentType($db); |
|
156 | - $localobject->statut=1; |
|
157 | - $localobject->label='Adherent type test'; |
|
158 | - $localobject->subscription=1; |
|
159 | - $localobject->amount=0; |
|
160 | - $localobject->vote=1; |
|
161 | - $localobject->company='Old company label'; |
|
162 | - $result=$localobject->create($user); |
|
149 | + global $conf, $user, $langs, $db; |
|
150 | + $conf = $this->savconf; |
|
151 | + $user = $this->savuser; |
|
152 | + $langs = $this->savlangs; |
|
153 | + $db = $this->savdb; |
|
154 | + |
|
155 | + $localobject = new AdherentType($db); |
|
156 | + $localobject->statut = 1; |
|
157 | + $localobject->label = 'Adherent type test'; |
|
158 | + $localobject->subscription = 1; |
|
159 | + $localobject->amount = 0; |
|
160 | + $localobject->vote = 1; |
|
161 | + $localobject->company = 'Old company label'; |
|
162 | + $result = $localobject->create($user); |
|
163 | 163 | print __METHOD__." result=".$result."\n"; |
164 | 164 | $this->assertLessThan($result, 0); |
165 | 165 | |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function testAdherentCreate($fk_adherent_type) |
179 | 179 | { |
180 | - global $conf,$user,$langs,$db; |
|
181 | - $conf=$this->savconf; |
|
182 | - $user=$this->savuser; |
|
183 | - $langs=$this->savlangs; |
|
184 | - $db=$this->savdb; |
|
180 | + global $conf, $user, $langs, $db; |
|
181 | + $conf = $this->savconf; |
|
182 | + $user = $this->savuser; |
|
183 | + $langs = $this->savlangs; |
|
184 | + $db = $this->savdb; |
|
185 | 185 | |
186 | - $localobject=new Adherent($db); |
|
186 | + $localobject = new Adherent($db); |
|
187 | 187 | $localobject->initAsSpecimen(); |
188 | - $localobject->typeid=$fk_adherent_type; |
|
189 | - $result=$localobject->create($user); |
|
188 | + $localobject->typeid = $fk_adherent_type; |
|
189 | + $result = $localobject->create($user); |
|
190 | 190 | print __METHOD__." result=".$result."\n"; |
191 | 191 | if ($result < 0) { |
192 | 192 | print $localobject->error; |
@@ -207,14 +207,14 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function testAdherentFetch($id) |
209 | 209 | { |
210 | - global $conf,$user,$langs,$db; |
|
211 | - $conf=$this->savconf; |
|
212 | - $user=$this->savuser; |
|
213 | - $langs=$this->savlangs; |
|
214 | - $db=$this->savdb; |
|
215 | - |
|
216 | - $localobject=new Adherent($db); |
|
217 | - $result=$localobject->fetch($id); |
|
210 | + global $conf, $user, $langs, $db; |
|
211 | + $conf = $this->savconf; |
|
212 | + $user = $this->savuser; |
|
213 | + $langs = $this->savlangs; |
|
214 | + $db = $this->savdb; |
|
215 | + |
|
216 | + $localobject = new Adherent($db); |
|
217 | + $result = $localobject->fetch($id); |
|
218 | 218 | print __METHOD__." id=".$id." result=".$result."\n"; |
219 | 219 | $this->assertLessThan($result, 0); |
220 | 220 | return $localobject; |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function testAdherentFetchLogin(Adherent $localobject) |
233 | 233 | { |
234 | - global $conf,$user,$langs,$db; |
|
235 | - $conf=$this->savconf; |
|
236 | - $user=$this->savuser; |
|
237 | - $langs=$this->savlangs; |
|
238 | - $db=$this->savdb; |
|
234 | + global $conf, $user, $langs, $db; |
|
235 | + $conf = $this->savconf; |
|
236 | + $user = $this->savuser; |
|
237 | + $langs = $this->savlangs; |
|
238 | + $db = $this->savdb; |
|
239 | 239 | |
240 | 240 | $newobject = new Adherent($db); |
241 | 241 | $result = $newobject->fetch_login($localobject->login); |
@@ -256,45 +256,45 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function testAdherentUpdate(Adherent $localobject) |
258 | 258 | { |
259 | - global $conf,$user,$langs,$db; |
|
260 | - $conf=$this->savconf; |
|
261 | - $user=$this->savuser; |
|
262 | - $langs=$this->savlangs; |
|
263 | - $db=$this->savdb; |
|
259 | + global $conf, $user, $langs, $db; |
|
260 | + $conf = $this->savconf; |
|
261 | + $user = $this->savuser; |
|
262 | + $langs = $this->savlangs; |
|
263 | + $db = $this->savdb; |
|
264 | 264 | |
265 | 265 | $timestamp = dol_now(); |
266 | 266 | |
267 | 267 | $localobject->civility_id = 0; |
268 | - $localobject->login='newlogin'; |
|
269 | - $localobject->company='New company label'; |
|
270 | - $localobject->note_public='New note public after update'; |
|
271 | - $localobject->note_private='New note private after update'; |
|
272 | - $localobject->lastname='New name'; |
|
273 | - $localobject->firstname='New firstname'; |
|
274 | - $localobject->gender='man'; |
|
275 | - $localobject->address='New address'; |
|
276 | - $localobject->zip='New zip'; |
|
277 | - $localobject->town='New town'; |
|
278 | - $localobject->country_id=2; |
|
279 | - $localobject->statut=0; |
|
280 | - $localobject->morphy=0; |
|
281 | - $localobject->phone='New tel pro'; |
|
282 | - $localobject->phone_perso='New tel perso'; |
|
283 | - $localobject->phone_mobile='New tel mobile'; |
|
284 | - $localobject->email='[email protected]'; |
|
285 | - $localobject->birth=$timestamp; |
|
286 | - $result=$localobject->update($user); |
|
268 | + $localobject->login = 'newlogin'; |
|
269 | + $localobject->company = 'New company label'; |
|
270 | + $localobject->note_public = 'New note public after update'; |
|
271 | + $localobject->note_private = 'New note private after update'; |
|
272 | + $localobject->lastname = 'New name'; |
|
273 | + $localobject->firstname = 'New firstname'; |
|
274 | + $localobject->gender = 'man'; |
|
275 | + $localobject->address = 'New address'; |
|
276 | + $localobject->zip = 'New zip'; |
|
277 | + $localobject->town = 'New town'; |
|
278 | + $localobject->country_id = 2; |
|
279 | + $localobject->statut = 0; |
|
280 | + $localobject->morphy = 0; |
|
281 | + $localobject->phone = 'New tel pro'; |
|
282 | + $localobject->phone_perso = 'New tel perso'; |
|
283 | + $localobject->phone_mobile = 'New tel mobile'; |
|
284 | + $localobject->email = '[email protected]'; |
|
285 | + $localobject->birth = $timestamp; |
|
286 | + $result = $localobject->update($user); |
|
287 | 287 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
288 | 288 | $this->assertLessThan($result, 0); |
289 | - $result=$localobject->update_note($localobject->note_private, '_private'); |
|
289 | + $result = $localobject->update_note($localobject->note_private, '_private'); |
|
290 | 290 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
291 | 291 | $this->assertLessThan($result, 0); |
292 | - $result=$localobject->update_note($localobject->note_public, '_public'); |
|
292 | + $result = $localobject->update_note($localobject->note_public, '_public'); |
|
293 | 293 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
294 | 294 | $this->assertLessThan($result, 0); |
295 | 295 | |
296 | - $newobject=new Adherent($db); |
|
297 | - $result=$newobject->fetch($localobject->id); |
|
296 | + $newobject = new Adherent($db); |
|
297 | + $result = $newobject->fetch($localobject->id); |
|
298 | 298 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
299 | 299 | $this->assertLessThan($result, 0); |
300 | 300 | |
@@ -335,13 +335,13 @@ discard block |
||
335 | 335 | */ |
336 | 336 | public function testAdherentMakeSubstitution(Adherent $localobject) |
337 | 337 | { |
338 | - global $conf,$user,$langs,$db; |
|
339 | - $conf=$this->savconf; |
|
340 | - $user=$this->savuser; |
|
341 | - $langs=$this->savlangs; |
|
342 | - $db=$this->savdb; |
|
338 | + global $conf, $user, $langs, $db; |
|
339 | + $conf = $this->savconf; |
|
340 | + $user = $this->savuser; |
|
341 | + $langs = $this->savlangs; |
|
342 | + $db = $this->savdb; |
|
343 | 343 | |
344 | - $conf->global->MAIN_FIRSTNAME_NAME_POSITION = 0; // Force setup for firstname+lastname |
|
344 | + $conf->global->MAIN_FIRSTNAME_NAME_POSITION = 0; // Force setup for firstname+lastname |
|
345 | 345 | |
346 | 346 | $template = '__CIVILITY__,__FIRSTNAME__,__LASTNAME__,__FULLNAME__,__COMPANY__,'; |
347 | 347 | $template .= '__ADDRESS__,__ZIP__,__TOWN__,__COUNTRY__,__EMAIL__,__BIRTH__,__PHOTO__,__LOGIN__'; |
@@ -369,11 +369,11 @@ discard block |
||
369 | 369 | */ |
370 | 370 | public function testAdherentSetUserId(Adherent $localobject) |
371 | 371 | { |
372 | - global $conf,$user,$langs,$db; |
|
373 | - $conf=$this->savconf; |
|
374 | - $user=$this->savuser; |
|
375 | - $langs=$this->savlangs; |
|
376 | - $db=$this->savdb; |
|
372 | + global $conf, $user, $langs, $db; |
|
373 | + $conf = $this->savconf; |
|
374 | + $user = $this->savuser; |
|
375 | + $langs = $this->savlangs; |
|
376 | + $db = $this->savdb; |
|
377 | 377 | |
378 | 378 | //We associate member with user |
379 | 379 | $result = $localobject->setUserId($user->id); |
@@ -411,11 +411,11 @@ discard block |
||
411 | 411 | */ |
412 | 412 | public function testAdherentSetThirdPartyId(Adherent $localobject) |
413 | 413 | { |
414 | - global $conf,$user,$langs,$db; |
|
415 | - $conf=$this->savconf; |
|
416 | - $user=$this->savuser; |
|
417 | - $langs=$this->savlangs; |
|
418 | - $db=$this->savdb; |
|
414 | + global $conf, $user, $langs, $db; |
|
415 | + $conf = $this->savconf; |
|
416 | + $user = $this->savuser; |
|
417 | + $langs = $this->savlangs; |
|
418 | + $db = $this->savdb; |
|
419 | 419 | |
420 | 420 | //Create a Third Party |
421 | 421 | $thirdparty = new Societe($db); |
@@ -460,13 +460,13 @@ discard block |
||
460 | 460 | */ |
461 | 461 | public function testAdherentValidate(Adherent $localobject) |
462 | 462 | { |
463 | - global $conf,$user,$langs,$db; |
|
464 | - $conf=$this->savconf; |
|
465 | - $user=$this->savuser; |
|
466 | - $langs=$this->savlangs; |
|
467 | - $db=$this->savdb; |
|
463 | + global $conf, $user, $langs, $db; |
|
464 | + $conf = $this->savconf; |
|
465 | + $user = $this->savuser; |
|
466 | + $langs = $this->savlangs; |
|
467 | + $db = $this->savdb; |
|
468 | 468 | |
469 | - $result=$localobject->validate($user); |
|
469 | + $result = $localobject->validate($user); |
|
470 | 470 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
471 | 471 | $this->assertLessThan($result, 0); |
472 | 472 | |
@@ -484,11 +484,11 @@ discard block |
||
484 | 484 | */ |
485 | 485 | public function testAdherentOther(Adherent $localobject) |
486 | 486 | { |
487 | - global $conf,$user,$langs,$db; |
|
488 | - $conf=$this->savconf; |
|
489 | - $user=$this->savuser; |
|
490 | - $langs=$this->savlangs; |
|
491 | - $db=$this->savdb; |
|
487 | + global $conf, $user, $langs, $db; |
|
488 | + $conf = $this->savconf; |
|
489 | + $user = $this->savuser; |
|
490 | + $langs = $this->savlangs; |
|
491 | + $db = $this->savdb; |
|
492 | 492 | |
493 | 493 | /*$result=$localobject->setstatus(0); |
494 | 494 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
@@ -513,11 +513,11 @@ discard block |
||
513 | 513 | */ |
514 | 514 | public function testAdherentResiliate(Adherent $localobject) |
515 | 515 | { |
516 | - global $conf,$user,$langs,$db; |
|
517 | - $conf=$this->savconf; |
|
518 | - $user=$this->savuser; |
|
519 | - $langs=$this->savlangs; |
|
520 | - $db=$this->savdb; |
|
516 | + global $conf, $user, $langs, $db; |
|
517 | + $conf = $this->savconf; |
|
518 | + $user = $this->savuser; |
|
519 | + $langs = $this->savlangs; |
|
520 | + $db = $this->savdb; |
|
521 | 521 | |
522 | 522 | //Let's resilie un adherent |
523 | 523 | $result = $localobject->resiliate($user); |
@@ -550,13 +550,13 @@ discard block |
||
550 | 550 | */ |
551 | 551 | public function testAdherentDelete($localobject) |
552 | 552 | { |
553 | - global $conf,$user,$langs,$db; |
|
554 | - $conf=$this->savconf; |
|
555 | - $user=$this->savuser; |
|
556 | - $langs=$this->savlangs; |
|
557 | - $db=$this->savdb; |
|
553 | + global $conf, $user, $langs, $db; |
|
554 | + $conf = $this->savconf; |
|
555 | + $user = $this->savuser; |
|
556 | + $langs = $this->savlangs; |
|
557 | + $db = $this->savdb; |
|
558 | 558 | |
559 | - $result=$localobject->delete($localobject->id, $user); |
|
559 | + $result = $localobject->delete($localobject->id, $user); |
|
560 | 560 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
561 | 561 | $this->assertLessThan($result, 0); |
562 | 562 | |
@@ -575,15 +575,15 @@ discard block |
||
575 | 575 | */ |
576 | 576 | public function testAdherentTypeDelete($localobject) |
577 | 577 | { |
578 | - global $conf,$user,$langs,$db; |
|
579 | - $conf=$this->savconf; |
|
580 | - $user=$this->savuser; |
|
581 | - $langs=$this->savlangs; |
|
582 | - $db=$this->savdb; |
|
583 | - |
|
584 | - $localobjectat=new AdherentType($db); |
|
585 | - $result=$localobjectat->fetch($localobject->typeid); |
|
586 | - $result=$localobjectat->delete($user); |
|
578 | + global $conf, $user, $langs, $db; |
|
579 | + $conf = $this->savconf; |
|
580 | + $user = $this->savuser; |
|
581 | + $langs = $this->savlangs; |
|
582 | + $db = $this->savdb; |
|
583 | + |
|
584 | + $localobjectat = new AdherentType($db); |
|
585 | + $result = $localobjectat->fetch($localobject->typeid); |
|
586 | + $result = $localobjectat->delete($user); |
|
587 | 587 | print __METHOD__." result=".$result."\n"; |
588 | 588 | $this->assertLessThan($result, 0); |
589 | 589 |
@@ -24,7 +24,7 @@ discard block |
||
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'; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $user->getrights(); |
43 | 43 | } |
44 | 44 | |
45 | -$conf->global->MAIN_DISABLE_ALL_MAILS=1; |
|
45 | +$conf->global->MAIN_DISABLE_ALL_MAILS = 1; |
|
46 | 46 | |
47 | 47 | |
48 | 48 | /** |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | parent::__construct($name); |
72 | 72 | |
73 | 73 | //$this->sharedFixture |
74 | - global $conf,$user,$langs,$db; |
|
75 | - $this->savconf=$conf; |
|
76 | - $this->savuser=$user; |
|
77 | - $this->savlangs=$langs; |
|
78 | - $this->savdb=$db; |
|
74 | + global $conf, $user, $langs, $db; |
|
75 | + $this->savconf = $conf; |
|
76 | + $this->savuser = $user; |
|
77 | + $this->savlangs = $langs; |
|
78 | + $this->savdb = $db; |
|
79 | 79 | |
80 | 80 | print __METHOD__." db->type=".$db->type." user->id=".$user->id; |
81 | 81 | //print " - db ".$db->db; |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public static function setUpBeforeClass(): void |
91 | 91 | { |
92 | - global $conf,$user,$langs,$db; |
|
92 | + global $conf, $user, $langs, $db; |
|
93 | 93 | |
94 | - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
|
94 | + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
|
95 | 95 | |
96 | 96 | print __METHOD__."\n"; |
97 | 97 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public static function tearDownAfterClass(): void |
105 | 105 | { |
106 | - global $conf,$user,$langs,$db; |
|
106 | + global $conf, $user, $langs, $db; |
|
107 | 107 | $db->rollback(); |
108 | 108 | |
109 | 109 | print __METHOD__."\n"; |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | */ |
117 | 117 | protected function setUp(): void |
118 | 118 | { |
119 | - global $conf,$user,$langs,$db; |
|
120 | - $conf=$this->savconf; |
|
121 | - $user=$this->savuser; |
|
122 | - $langs=$this->savlangs; |
|
123 | - $db=$this->savdb; |
|
119 | + global $conf, $user, $langs, $db; |
|
120 | + $conf = $this->savconf; |
|
121 | + $user = $this->savuser; |
|
122 | + $langs = $this->savlangs; |
|
123 | + $db = $this->savdb; |
|
124 | 124 | |
125 | 125 | print __METHOD__."\n"; |
126 | 126 | } |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function testContactCreate() |
143 | 143 | { |
144 | - global $conf,$user,$langs,$db; |
|
145 | - $conf=$this->savconf; |
|
146 | - $user=$this->savuser; |
|
147 | - $langs=$this->savlangs; |
|
148 | - $db=$this->savdb; |
|
144 | + global $conf, $user, $langs, $db; |
|
145 | + $conf = $this->savconf; |
|
146 | + $user = $this->savuser; |
|
147 | + $langs = $this->savlangs; |
|
148 | + $db = $this->savdb; |
|
149 | 149 | |
150 | - $localobject=new Contact($db); |
|
150 | + $localobject = new Contact($db); |
|
151 | 151 | $localobject->initAsSpecimen(); |
152 | - $result=$localobject->create($user); |
|
152 | + $result = $localobject->create($user); |
|
153 | 153 | |
154 | 154 | print __METHOD__." result=".$result."\n"; |
155 | 155 | $this->assertLessThan($result, 0); |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function testContactFetch($id) |
169 | 169 | { |
170 | - global $conf,$user,$langs,$db; |
|
171 | - $conf=$this->savconf; |
|
172 | - $user=$this->savuser; |
|
173 | - $langs=$this->savlangs; |
|
174 | - $db=$this->savdb; |
|
170 | + global $conf, $user, $langs, $db; |
|
171 | + $conf = $this->savconf; |
|
172 | + $user = $this->savuser; |
|
173 | + $langs = $this->savlangs; |
|
174 | + $db = $this->savdb; |
|
175 | 175 | |
176 | - $localobject=new Contact($db); |
|
177 | - $result=$localobject->fetch($id); |
|
176 | + $localobject = new Contact($db); |
|
177 | + $result = $localobject->fetch($id); |
|
178 | 178 | |
179 | 179 | print __METHOD__." id=".$id." result=".$result."\n"; |
180 | 180 | $this->assertLessThan($result, 0); |
@@ -193,45 +193,45 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function testContactUpdate($localobject) |
195 | 195 | { |
196 | - global $conf,$user,$langs,$db; |
|
197 | - $conf=$this->savconf; |
|
198 | - $user=$this->savuser; |
|
199 | - $langs=$this->savlangs; |
|
200 | - $db=$this->savdb; |
|
196 | + global $conf, $user, $langs, $db; |
|
197 | + $conf = $this->savconf; |
|
198 | + $user = $this->savuser; |
|
199 | + $langs = $this->savlangs; |
|
200 | + $db = $this->savdb; |
|
201 | 201 | |
202 | 202 | $localobject->oldcopy = clone $localobject; |
203 | 203 | |
204 | - $localobject->note_private='New private note after update'; |
|
205 | - $localobject->note_public='New public note after update'; |
|
206 | - $localobject->lastname='New name'; |
|
207 | - $localobject->firstname='New firstname'; |
|
208 | - $localobject->address='New address'; |
|
209 | - $localobject->zip='New zip'; |
|
210 | - $localobject->town='New town'; |
|
211 | - $localobject->country_id=2; |
|
204 | + $localobject->note_private = 'New private note after update'; |
|
205 | + $localobject->note_public = 'New public note after update'; |
|
206 | + $localobject->lastname = 'New name'; |
|
207 | + $localobject->firstname = 'New firstname'; |
|
208 | + $localobject->address = 'New address'; |
|
209 | + $localobject->zip = 'New zip'; |
|
210 | + $localobject->town = 'New town'; |
|
211 | + $localobject->country_id = 2; |
|
212 | 212 | //$localobject->status=0; |
213 | - $localobject->phone_pro='New tel pro'; |
|
214 | - $localobject->phone_perso='New tel perso'; |
|
215 | - $localobject->phone_mobile='New tel mobile'; |
|
216 | - $localobject->fax='New fax'; |
|
217 | - $localobject->email='[email protected]'; |
|
218 | - $localobject->socialnetworks['jabber']='New im id'; |
|
219 | - $localobject->default_lang='es_ES'; |
|
220 | - |
|
221 | - $result=$localobject->update($localobject->id, $user); |
|
213 | + $localobject->phone_pro = 'New tel pro'; |
|
214 | + $localobject->phone_perso = 'New tel perso'; |
|
215 | + $localobject->phone_mobile = 'New tel mobile'; |
|
216 | + $localobject->fax = 'New fax'; |
|
217 | + $localobject->email = '[email protected]'; |
|
218 | + $localobject->socialnetworks['jabber'] = 'New im id'; |
|
219 | + $localobject->default_lang = 'es_ES'; |
|
220 | + |
|
221 | + $result = $localobject->update($localobject->id, $user); |
|
222 | 222 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
223 | 223 | $this->assertLessThan($result, 0, 'Contact::update error'); |
224 | 224 | |
225 | - $result=$localobject->update_note($localobject->note_private, '_private'); |
|
225 | + $result = $localobject->update_note($localobject->note_private, '_private'); |
|
226 | 226 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
227 | 227 | $this->assertLessThan($result, 0, 'Contact::update_note (private) error'); |
228 | 228 | |
229 | - $result=$localobject->update_note($localobject->note_public, '_public'); |
|
229 | + $result = $localobject->update_note($localobject->note_public, '_public'); |
|
230 | 230 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
231 | 231 | $this->assertLessThan($result, 0, 'Contact::update_note (public) error'); |
232 | 232 | |
233 | - $newobject=new Contact($db); |
|
234 | - $result=$newobject->fetch($localobject->id); |
|
233 | + $newobject = new Contact($db); |
|
234 | + $result = $newobject->fetch($localobject->id); |
|
235 | 235 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
236 | 236 | $this->assertLessThan($result, 0, 'Contact::fetch error'); |
237 | 237 | |
@@ -284,19 +284,19 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function testContactOther($localobject) |
286 | 286 | { |
287 | - global $conf,$user,$langs,$db; |
|
288 | - $conf=$this->savconf; |
|
289 | - $user=$this->savuser; |
|
290 | - $langs=$this->savlangs; |
|
291 | - $db=$this->savdb; |
|
287 | + global $conf, $user, $langs, $db; |
|
288 | + $conf = $this->savconf; |
|
289 | + $user = $this->savuser; |
|
290 | + $langs = $this->savlangs; |
|
291 | + $db = $this->savdb; |
|
292 | 292 | |
293 | 293 | //$localobject->fetch($localobject->id); |
294 | 294 | |
295 | - $result=$localobject->getNomUrl(1); |
|
295 | + $result = $localobject->getNomUrl(1); |
|
296 | 296 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
297 | 297 | $this->assertNotEquals($result, ''); |
298 | 298 | |
299 | - $result=$localobject->getFullAddress(1); |
|
299 | + $result = $localobject->getFullAddress(1); |
|
300 | 300 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
301 | 301 | $this->assertStringContainsString("New address\nNew zip New town\nBelgium", $result); |
302 | 302 | |
@@ -318,16 +318,16 @@ discard block |
||
318 | 318 | */ |
319 | 319 | public function testContactDelete($id) |
320 | 320 | { |
321 | - global $conf,$user,$langs,$db; |
|
322 | - $conf=$this->savconf; |
|
323 | - $user=$this->savuser; |
|
324 | - $langs=$this->savlangs; |
|
325 | - $db=$this->savdb; |
|
321 | + global $conf, $user, $langs, $db; |
|
322 | + $conf = $this->savconf; |
|
323 | + $user = $this->savuser; |
|
324 | + $langs = $this->savlangs; |
|
325 | + $db = $this->savdb; |
|
326 | 326 | |
327 | - $localobject=new Contact($db); |
|
328 | - $result=$localobject->fetch($id); |
|
327 | + $localobject = new Contact($db); |
|
328 | + $result = $localobject->fetch($id); |
|
329 | 329 | |
330 | - $result=$localobject->delete($user); |
|
330 | + $result = $localobject->delete($user); |
|
331 | 331 | print __METHOD__." id=".$id." result=".$result."\n"; |
332 | 332 | $this->assertLessThan($result, 0); |
333 | 333 | |
@@ -341,56 +341,56 @@ discard block |
||
341 | 341 | */ |
342 | 342 | public function testContactGetFullAddress() |
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 | - $localobjectadd=new Contact($db); |
|
350 | + $localobjectadd = new Contact($db); |
|
351 | 351 | $localobjectadd->initAsSpecimen(); |
352 | 352 | |
353 | 353 | // France |
354 | 354 | unset($localobjectadd->country_code); |
355 | - $localobjectadd->country_id=1; |
|
356 | - $localobjectadd->name='New name'; |
|
357 | - $localobjectadd->address='New address'; |
|
358 | - $localobjectadd->zip='New zip'; |
|
359 | - $localobjectadd->town='New town'; |
|
360 | - $result=$localobjectadd->getFullAddress(1); |
|
355 | + $localobjectadd->country_id = 1; |
|
356 | + $localobjectadd->name = 'New name'; |
|
357 | + $localobjectadd->address = 'New address'; |
|
358 | + $localobjectadd->zip = 'New zip'; |
|
359 | + $localobjectadd->town = 'New town'; |
|
360 | + $result = $localobjectadd->getFullAddress(1); |
|
361 | 361 | print __METHOD__." id=".$localobjectadd->id." result=".$result."\n"; |
362 | 362 | $this->assertStringContainsString("New address\nNew zip New town\nFrance", $result); |
363 | 363 | |
364 | 364 | // Belgium |
365 | 365 | unset($localobjectadd->country_code); |
366 | - $localobjectadd->country_id=2; |
|
367 | - $localobjectadd->name='New name'; |
|
368 | - $localobjectadd->address='New address'; |
|
369 | - $localobjectadd->zip='New zip'; |
|
370 | - $localobjectadd->town='New town'; |
|
371 | - $result=$localobjectadd->getFullAddress(1); |
|
366 | + $localobjectadd->country_id = 2; |
|
367 | + $localobjectadd->name = 'New name'; |
|
368 | + $localobjectadd->address = 'New address'; |
|
369 | + $localobjectadd->zip = 'New zip'; |
|
370 | + $localobjectadd->town = 'New town'; |
|
371 | + $result = $localobjectadd->getFullAddress(1); |
|
372 | 372 | print __METHOD__." id=".$localobjectadd->id." result=".$result."\n"; |
373 | 373 | $this->assertStringContainsString("New address\nNew zip New town\nBelgium", $result); |
374 | 374 | |
375 | 375 | // Switzerland |
376 | 376 | unset($localobjectadd->country_code); |
377 | - $localobjectadd->country_id=6; |
|
378 | - $localobjectadd->name='New name'; |
|
379 | - $localobjectadd->address='New address'; |
|
380 | - $localobjectadd->zip='New zip'; |
|
381 | - $localobjectadd->town='New town'; |
|
382 | - $result=$localobjectadd->getFullAddress(1); |
|
377 | + $localobjectadd->country_id = 6; |
|
378 | + $localobjectadd->name = 'New name'; |
|
379 | + $localobjectadd->address = 'New address'; |
|
380 | + $localobjectadd->zip = 'New zip'; |
|
381 | + $localobjectadd->town = 'New town'; |
|
382 | + $result = $localobjectadd->getFullAddress(1); |
|
383 | 383 | print __METHOD__." id=".$localobjectadd->id." result=".$result."\n"; |
384 | 384 | $this->assertStringContainsString("New address\nNew zip New town\nSwitzerland", $result); |
385 | 385 | |
386 | 386 | // USA |
387 | 387 | unset($localobjectadd->country_code); |
388 | - $localobjectadd->country_id=11; |
|
389 | - $localobjectadd->name='New name'; |
|
390 | - $localobjectadd->address='New address'; |
|
391 | - $localobjectadd->zip='New zip'; |
|
392 | - $localobjectadd->town='New town'; |
|
393 | - $result=$localobjectadd->getFullAddress(1); |
|
388 | + $localobjectadd->country_id = 11; |
|
389 | + $localobjectadd->name = 'New name'; |
|
390 | + $localobjectadd->address = 'New address'; |
|
391 | + $localobjectadd->zip = 'New zip'; |
|
392 | + $localobjectadd->town = 'New town'; |
|
393 | + $result = $localobjectadd->getFullAddress(1); |
|
394 | 394 | print __METHOD__." id=".$localobjectadd->id." result=".$result."\n"; |
395 | 395 | $this->assertStringContainsString("New address\nNew town, New zip\nUnited States", $result); |
396 | 396 |
@@ -24,7 +24,7 @@ discard block |
||
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'; |
@@ -35,7 +35,7 @@ discard block |
||
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 | /** |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | parent::__construct($name); |
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; |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public static function setUpBeforeClass(): void |
84 | 84 | { |
85 | - global $conf,$user,$langs,$db; |
|
86 | - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
|
85 | + global $conf, $user, $langs, $db; |
|
86 | + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
|
87 | 87 | |
88 | 88 | print __METHOD__."\n"; |
89 | 89 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public static function tearDownAfterClass(): void |
97 | 97 | { |
98 | - global $conf,$user,$langs,$db; |
|
98 | + global $conf, $user, $langs, $db; |
|
99 | 99 | $db->rollback(); |
100 | 100 | |
101 | 101 | print __METHOD__."\n"; |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function setUp(): void |
110 | 110 | { |
111 | - global $conf,$user,$langs,$db; |
|
112 | - $conf=$this->savconf; |
|
113 | - $user=$this->savuser; |
|
114 | - $langs=$this->savlangs; |
|
115 | - $db=$this->savdb; |
|
111 | + global $conf, $user, $langs, $db; |
|
112 | + $conf = $this->savconf; |
|
113 | + $user = $this->savuser; |
|
114 | + $langs = $this->savlangs; |
|
115 | + $db = $this->savdb; |
|
116 | 116 | |
117 | 117 | print __METHOD__."\n"; |
118 | 118 | } |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function testChargeSocialesCreate() |
135 | 135 | { |
136 | - global $conf,$user,$langs,$db; |
|
137 | - $conf=$this->savconf; |
|
138 | - $user=$this->savuser; |
|
139 | - $langs=$this->savlangs; |
|
140 | - $db=$this->savdb; |
|
136 | + global $conf, $user, $langs, $db; |
|
137 | + $conf = $this->savconf; |
|
138 | + $user = $this->savuser; |
|
139 | + $langs = $this->savlangs; |
|
140 | + $db = $this->savdb; |
|
141 | 141 | |
142 | - $localobject=new ChargeSociales($db); |
|
142 | + $localobject = new ChargeSociales($db); |
|
143 | 143 | $localobject->initAsSpecimen(); |
144 | - $result=$localobject->create($user, $langs, $conf); |
|
144 | + $result = $localobject->create($user, $langs, $conf); |
|
145 | 145 | print __METHOD__." result=".$result."\n"; |
146 | 146 | |
147 | 147 | $this->assertLessThan($result, 0); |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function testChargeSocialesFetch($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; |
|
167 | - |
|
168 | - $localobject=new ChargeSociales($db); |
|
169 | - $result=$localobject->fetch($id); |
|
162 | + global $conf, $user, $langs, $db; |
|
163 | + $conf = $this->savconf; |
|
164 | + $user = $this->savuser; |
|
165 | + $langs = $this->savlangs; |
|
166 | + $db = $this->savdb; |
|
167 | + |
|
168 | + $localobject = new ChargeSociales($db); |
|
169 | + $result = $localobject->fetch($id); |
|
170 | 170 | print __METHOD__." id=".$id." result=".$result."\n"; |
171 | 171 | |
172 | 172 | $this->assertLessThan($result, 0); |
@@ -184,13 +184,13 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function testChargeSocialesValid($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 | - $result=$localobject->setPaid($user); |
|
193 | + $result = $localobject->setPaid($user); |
|
194 | 194 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
195 | 195 | |
196 | 196 | $this->assertLessThan($result, 0); |
@@ -208,17 +208,17 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function testChargeSocialesOther($localobject) |
210 | 210 | { |
211 | - global $conf,$user,$langs,$db; |
|
212 | - $conf=$this->savconf; |
|
213 | - $user=$this->savuser; |
|
214 | - $langs=$this->savlangs; |
|
215 | - $db=$this->savdb; |
|
211 | + global $conf, $user, $langs, $db; |
|
212 | + $conf = $this->savconf; |
|
213 | + $user = $this->savuser; |
|
214 | + $langs = $this->savlangs; |
|
215 | + $db = $this->savdb; |
|
216 | 216 | |
217 | - $result=$localobject->getNomUrl(1); |
|
217 | + $result = $localobject->getNomUrl(1); |
|
218 | 218 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
219 | 219 | $this->assertNotEquals($result, ''); |
220 | 220 | |
221 | - $result=$localobject->getSommePaiement(); |
|
221 | + $result = $localobject->getSommePaiement(); |
|
222 | 222 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
223 | 223 | $this->assertLessThanOrEqual($result, 0); |
224 | 224 | |
@@ -236,16 +236,16 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function testChargeSocialesDelete($id) |
238 | 238 | { |
239 | - global $conf,$user,$langs,$db; |
|
239 | + global $conf, $user, $langs, $db; |
|
240 | 240 | |
241 | - $conf=$this->savconf; |
|
242 | - $user=$this->savuser; |
|
243 | - $langs=$this->savlangs; |
|
244 | - $db=$this->savdb; |
|
241 | + $conf = $this->savconf; |
|
242 | + $user = $this->savuser; |
|
243 | + $langs = $this->savlangs; |
|
244 | + $db = $this->savdb; |
|
245 | 245 | |
246 | - $localobject=new ChargeSociales($db); |
|
247 | - $result=$localobject->fetch($id); |
|
248 | - $result=$localobject->delete($user); |
|
246 | + $localobject = new ChargeSociales($db); |
|
247 | + $result = $localobject->fetch($id); |
|
248 | + $result = $localobject->delete($user); |
|
249 | 249 | |
250 | 250 | print __METHOD__." id=".$id." result=".$result."\n"; |
251 | 251 | $this->assertLessThan($result, 0); |
@@ -24,7 +24,7 @@ discard block |
||
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'; |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | parent::__construct($name); |
67 | 67 | |
68 | 68 | //$this->sharedFixture |
69 | - global $conf,$user,$langs,$db; |
|
70 | - $this->savconf=$conf; |
|
71 | - $this->savuser=$user; |
|
72 | - $this->savlangs=$langs; |
|
73 | - $this->savdb=$db; |
|
69 | + global $conf, $user, $langs, $db; |
|
70 | + $this->savconf = $conf; |
|
71 | + $this->savuser = $user; |
|
72 | + $this->savlangs = $langs; |
|
73 | + $this->savdb = $db; |
|
74 | 74 | |
75 | 75 | print __METHOD__." db->type=".$db->type." user->id=".$user->id; |
76 | 76 | //print " - db ".$db->db; |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function setUpBeforeClass(): void |
86 | 86 | { |
87 | - global $conf,$user,$langs,$db; |
|
87 | + global $conf, $user, $langs, $db; |
|
88 | 88 | |
89 | - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
|
89 | + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
|
90 | 90 | |
91 | 91 | print __METHOD__."\n"; |
92 | 92 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public static function tearDownAfterClass(): void |
100 | 100 | { |
101 | - global $conf,$user,$langs,$db; |
|
101 | + global $conf, $user, $langs, $db; |
|
102 | 102 | $db->rollback(); |
103 | 103 | |
104 | 104 | print __METHOD__."\n"; |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | */ |
112 | 112 | protected function setUp(): void |
113 | 113 | { |
114 | - global $conf,$user,$langs,$db; |
|
115 | - $conf=$this->savconf; |
|
116 | - $user=$this->savuser; |
|
117 | - $langs=$this->savlangs; |
|
118 | - $db=$this->savdb; |
|
114 | + global $conf, $user, $langs, $db; |
|
115 | + $conf = $this->savconf; |
|
116 | + $user = $this->savuser; |
|
117 | + $langs = $this->savlangs; |
|
118 | + $db = $this->savdb; |
|
119 | 119 | |
120 | 120 | print __METHOD__."\n"; |
121 | 121 | } |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function testHolidayCreate() |
138 | 138 | { |
139 | - global $conf,$user,$langs,$db; |
|
140 | - $conf=$this->savconf; |
|
141 | - $user=$this->savuser; |
|
142 | - $langs=$this->savlangs; |
|
143 | - $db=$this->savdb; |
|
139 | + global $conf, $user, $langs, $db; |
|
140 | + $conf = $this->savconf; |
|
141 | + $user = $this->savuser; |
|
142 | + $langs = $this->savlangs; |
|
143 | + $db = $this->savdb; |
|
144 | 144 | |
145 | - $localobject=new Holiday($db); |
|
145 | + $localobject = new Holiday($db); |
|
146 | 146 | $localobject->initAsSpecimen(); |
147 | - $result=$localobject->create($user); |
|
147 | + $result = $localobject->create($user); |
|
148 | 148 | |
149 | 149 | print __METHOD__." result=".$result."\n"; |
150 | 150 | $this->assertLessThan($result, 0); |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function testHolidayFetch($id) |
164 | 164 | { |
165 | - global $conf,$user,$langs,$db; |
|
166 | - $conf=$this->savconf; |
|
167 | - $user=$this->savuser; |
|
168 | - $langs=$this->savlangs; |
|
169 | - $db=$this->savdb; |
|
165 | + global $conf, $user, $langs, $db; |
|
166 | + $conf = $this->savconf; |
|
167 | + $user = $this->savuser; |
|
168 | + $langs = $this->savlangs; |
|
169 | + $db = $this->savdb; |
|
170 | 170 | |
171 | - $localobject=new Holiday($db); |
|
172 | - $result=$localobject->fetch($id); |
|
171 | + $localobject = new Holiday($db); |
|
172 | + $result = $localobject->fetch($id); |
|
173 | 173 | |
174 | 174 | print __METHOD__." id=".$id." result=".$result."\n"; |
175 | 175 | $this->assertLessThan($result, 0); |
@@ -188,46 +188,46 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function testHolidayUpdate($localobject) |
190 | 190 | { |
191 | - global $conf,$user,$langs,$db; |
|
192 | - $conf=$this->savconf; |
|
193 | - $user=$this->savuser; |
|
194 | - $langs=$this->savlangs; |
|
195 | - $db=$this->savdb; |
|
191 | + global $conf, $user, $langs, $db; |
|
192 | + $conf = $this->savconf; |
|
193 | + $user = $this->savuser; |
|
194 | + $langs = $this->savlangs; |
|
195 | + $db = $this->savdb; |
|
196 | 196 | |
197 | 197 | $localobject->oldcopy = clone $localobject; |
198 | 198 | |
199 | - $localobject->note_private='New private note after update'; |
|
200 | - $localobject->note_public='New public note after update'; |
|
201 | - $localobject->lastname='New name'; |
|
202 | - $localobject->firstname='New firstname'; |
|
203 | - $localobject->address='New address'; |
|
204 | - $localobject->zip='New zip'; |
|
205 | - $localobject->town='New town'; |
|
206 | - $localobject->country_id=2; |
|
199 | + $localobject->note_private = 'New private note after update'; |
|
200 | + $localobject->note_public = 'New public note after update'; |
|
201 | + $localobject->lastname = 'New name'; |
|
202 | + $localobject->firstname = 'New firstname'; |
|
203 | + $localobject->address = 'New address'; |
|
204 | + $localobject->zip = 'New zip'; |
|
205 | + $localobject->town = 'New town'; |
|
206 | + $localobject->country_id = 2; |
|
207 | 207 | //$localobject->status=0; |
208 | - $localobject->phone_pro='New tel pro'; |
|
209 | - $localobject->phone_perso='New tel perso'; |
|
210 | - $localobject->phone_mobile='New tel mobile'; |
|
211 | - $localobject->fax='New fax'; |
|
212 | - $localobject->email='[email protected]'; |
|
213 | - $localobject->jabberid='New im id'; |
|
214 | - $localobject->default_lang='es_ES'; |
|
215 | - |
|
216 | - $result=$localobject->update($localobject->id, $user); |
|
208 | + $localobject->phone_pro = 'New tel pro'; |
|
209 | + $localobject->phone_perso = 'New tel perso'; |
|
210 | + $localobject->phone_mobile = 'New tel mobile'; |
|
211 | + $localobject->fax = 'New fax'; |
|
212 | + $localobject->email = '[email protected]'; |
|
213 | + $localobject->jabberid = 'New im id'; |
|
214 | + $localobject->default_lang = 'es_ES'; |
|
215 | + |
|
216 | + $result = $localobject->update($localobject->id, $user); |
|
217 | 217 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
218 | 218 | $this->assertLessThan($result, 0, 'Holiday::update error'); |
219 | 219 | |
220 | - $result=$localobject->update_note($localobject->note_private, '_private'); |
|
220 | + $result = $localobject->update_note($localobject->note_private, '_private'); |
|
221 | 221 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
222 | 222 | $this->assertLessThan($result, 0, 'Holiday::update_note (private) error'); |
223 | 223 | |
224 | - $result=$localobject->update_note($localobject->note_public, '_public'); |
|
224 | + $result = $localobject->update_note($localobject->note_public, '_public'); |
|
225 | 225 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
226 | 226 | $this->assertLessThan($result, 0, 'Holiday::update_note (public) error'); |
227 | 227 | |
228 | 228 | |
229 | - $newobject=new Holiday($db); |
|
230 | - $result=$newobject->fetch($localobject->id); |
|
229 | + $newobject = new Holiday($db); |
|
230 | + $result = $newobject->fetch($localobject->id); |
|
231 | 231 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
232 | 232 | $this->assertLessThan($result, 0, 'Holiday::fetch error'); |
233 | 233 | |
@@ -250,11 +250,11 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function testHolidayOther($localobject) |
252 | 252 | { |
253 | - global $conf,$user,$langs,$db; |
|
254 | - $conf=$this->savconf; |
|
255 | - $user=$this->savuser; |
|
256 | - $langs=$this->savlangs; |
|
257 | - $db=$this->savdb; |
|
253 | + global $conf, $user, $langs, $db; |
|
254 | + $conf = $this->savconf; |
|
255 | + $user = $this->savuser; |
|
256 | + $langs = $this->savlangs; |
|
257 | + $db = $this->savdb; |
|
258 | 258 | |
259 | 259 | $result = $localobject->fetchUsers(true, true, ''); |
260 | 260 | $this->assertNotEquals($result, -1); |
@@ -282,16 +282,16 @@ discard block |
||
282 | 282 | */ |
283 | 283 | public function testHolidayDelete($id) |
284 | 284 | { |
285 | - global $conf,$user,$langs,$db; |
|
286 | - $conf=$this->savconf; |
|
287 | - $user=$this->savuser; |
|
288 | - $langs=$this->savlangs; |
|
289 | - $db=$this->savdb; |
|
285 | + global $conf, $user, $langs, $db; |
|
286 | + $conf = $this->savconf; |
|
287 | + $user = $this->savuser; |
|
288 | + $langs = $this->savlangs; |
|
289 | + $db = $this->savdb; |
|
290 | 290 | |
291 | - $localobject=new Holiday($db); |
|
292 | - $result=$localobject->fetch($id); |
|
291 | + $localobject = new Holiday($db); |
|
292 | + $result = $localobject->fetch($id); |
|
293 | 293 | |
294 | - $result=$localobject->delete($user); |
|
294 | + $result = $localobject->delete($user); |
|
295 | 295 | print __METHOD__." id=".$id." result=".$result."\n"; |
296 | 296 | $this->assertLessThan($result, 0); |
297 | 297 | |
@@ -305,55 +305,55 @@ discard block |
||
305 | 305 | */ |
306 | 306 | public function testVerifDateHolidayCP() |
307 | 307 | { |
308 | - global $conf,$user,$langs,$db; |
|
309 | - $conf=$this->savconf; |
|
310 | - $user=$this->savuser; |
|
311 | - $langs=$this->savlangs; |
|
312 | - $db=$this->savdb; |
|
308 | + global $conf, $user, $langs, $db; |
|
309 | + $conf = $this->savconf; |
|
310 | + $user = $this->savuser; |
|
311 | + $langs = $this->savlangs; |
|
312 | + $db = $this->savdb; |
|
313 | 313 | |
314 | 314 | // Create a leave request the 1st morning only |
315 | - $localobjecta=new Holiday($db); |
|
315 | + $localobjecta = new Holiday($db); |
|
316 | 316 | $localobjecta->initAsSpecimen(); |
317 | 317 | $localobjecta->date_debut = dol_mktime(0, 0, 0, 1, 1, 2020); |
318 | 318 | $localobjecta->date_fin = dol_mktime(0, 0, 0, 1, 1, 2020); |
319 | 319 | $localobjecta->halfday = 1; |
320 | - $result=$localobjecta->create($user); |
|
320 | + $result = $localobjecta->create($user); |
|
321 | 321 | |
322 | 322 | // Create a leave request the 2 afternoon only |
323 | - $localobjectb=new Holiday($db); |
|
323 | + $localobjectb = new Holiday($db); |
|
324 | 324 | $localobjectb->initAsSpecimen(); |
325 | 325 | $localobjectb->date_debut = dol_mktime(0, 0, 0, 1, 2, 2020); |
326 | 326 | $localobjectb->date_fin = dol_mktime(0, 0, 0, 1, 2, 2020); |
327 | 327 | $localobjectb->halfday = -1; |
328 | - $result=$localobjectb->create($user); |
|
328 | + $result = $localobjectb->create($user); |
|
329 | 329 | |
330 | 330 | $date_debut = dol_mktime(0, 0, 0, 1, 1, 2020); |
331 | 331 | $date_fin = dol_mktime(0, 0, 0, 1, 2, 2020); |
332 | 332 | |
333 | - $localobjectc=new Holiday($db); |
|
333 | + $localobjectc = new Holiday($db); |
|
334 | 334 | |
335 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 0); |
|
335 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 0); |
|
336 | 336 | $this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.'); |
337 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 0); |
|
337 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 0); |
|
338 | 338 | $this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.'); |
339 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 0); |
|
339 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 0); |
|
340 | 340 | $this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.'); |
341 | 341 | |
342 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 1); |
|
342 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 1); |
|
343 | 343 | $this->assertFalse($result, 'result should be false, there is overlapping, morning of first day is not available.'); |
344 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 1); |
|
344 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 1); |
|
345 | 345 | $this->assertFalse($result, 'result should be false, there is overlapping, morning of first day is not available.'); |
346 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 1); |
|
346 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 1); |
|
347 | 347 | $this->assertTrue($result, 'result should be true, there is no overlapping'); |
348 | 348 | |
349 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, -1); |
|
349 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, -1); |
|
350 | 350 | $this->assertTrue($result, 'result should be true, there is no overlapping'); |
351 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, -1); |
|
351 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, -1); |
|
352 | 352 | $this->assertFalse($result, 'result should be false, there is overlapping, afternoon of second day is not available'); |
353 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, -1); |
|
353 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, -1); |
|
354 | 354 | $this->assertFalse($result, 'result should be false, there is overlapping, afternoon of second day is not available'); |
355 | 355 | |
356 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 2); // start afternoon and end morning |
|
356 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 2); // start afternoon and end morning |
|
357 | 357 | $this->assertTrue($result, 'result should be true, there is no overlapping'); |
358 | 358 | } |
359 | 359 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | { |
367 | 367 | global $db; |
368 | 368 | |
369 | - $localobjecta=new Holiday($db); |
|
369 | + $localobjecta = new Holiday($db); |
|
370 | 370 | |
371 | 371 | $localobjecta->updateConfCP('lastUpdate', '20100101120000'); |
372 | 372 | $result = $localobjecta->updateBalance(); |