@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * See also BuildDocTest to PDF generation |
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'; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $user->fetch(1); |
41 | 41 | $user->getrights(); |
42 | 42 | } |
43 | -$conf->global->MAIN_DISABLE_ALL_MAILS=1; |
|
43 | +$conf->global->MAIN_DISABLE_ALL_MAILS = 1; |
|
44 | 44 | |
45 | 45 | |
46 | 46 | /** |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function testPdfDocGetLineDesc() |
61 | 61 | { |
62 | - global $conf,$user,$langs,$db; |
|
63 | - $conf=$this->savconf; |
|
64 | - $user=$this->savuser; |
|
65 | - $langs=$this->savlangs; |
|
66 | - $db=$this->savdb; |
|
62 | + global $conf, $user, $langs, $db; |
|
63 | + $conf = $this->savconf; |
|
64 | + $user = $this->savuser; |
|
65 | + $langs = $this->savlangs; |
|
66 | + $db = $this->savdb; |
|
67 | 67 | |
68 | - $localproduct=new Product($db); |
|
68 | + $localproduct = new Product($db); |
|
69 | 69 | $result = $localproduct->fetch(0, 'PINKDRESS'); |
70 | 70 | if ($result < 0) { |
71 | 71 | print "\n".__METHOD__." Failed to make the fetch of product PINKDRESS. ".$localproduct->error; |
@@ -77,19 +77,19 @@ discard block |
||
77 | 77 | die(1); |
78 | 78 | } |
79 | 79 | |
80 | - $localobject=new Facture($db); |
|
80 | + $localobject = new Facture($db); |
|
81 | 81 | $localobject->initAsSpecimen(); |
82 | - $localobject->lines=array(); |
|
83 | - $localobject->lines[0]=new FactureLigne($db); |
|
84 | - $localobject->lines[0]->fk_product=$product_id; |
|
85 | - $localobject->lines[0]->label='Label 1'; |
|
86 | - $localobject->lines[0]->desc="This is a description with a é accent\n(Country of origin: France)"; |
|
82 | + $localobject->lines = array(); |
|
83 | + $localobject->lines[0] = new FactureLigne($db); |
|
84 | + $localobject->lines[0]->fk_product = $product_id; |
|
85 | + $localobject->lines[0]->label = 'Label 1'; |
|
86 | + $localobject->lines[0]->desc = "This is a description with a é accent\n(Country of origin: France)"; |
|
87 | 87 | |
88 | - $result=pdf_getlinedesc($localobject, 0, $langs); |
|
88 | + $result = pdf_getlinedesc($localobject, 0, $langs); |
|
89 | 89 | print __METHOD__." result=".$result."\n"; |
90 | 90 | $this->assertEquals("PINKDRESS - Label 1<br>This is a description with a é accent<br>(Country of origin: France)", $result); |
91 | 91 | |
92 | - $result=doc_getlinedesc($localobject->lines[0], $langs); |
|
92 | + $result = doc_getlinedesc($localobject->lines[0], $langs); |
|
93 | 93 | print __METHOD__." result=".$result."\n"; |
94 | 94 | $this->assertEquals("PINKDRESS - Label 1\nThis is a description with a é accent\n(Country of origin: France)", $result); |
95 | 95 | } |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function testPdfGetHeightForLogo() |
103 | 103 | { |
104 | - $file=dirname(__FILE__).'/img250x50.jpg'; |
|
105 | - $result=pdf_getHeightForLogo($file); |
|
104 | + $file = dirname(__FILE__).'/img250x50.jpg'; |
|
105 | + $result = pdf_getHeightForLogo($file); |
|
106 | 106 | print __METHOD__." result=".$result."\n"; |
107 | 107 | $this->assertEquals($result, 20); |
108 | - $file=dirname(__FILE__).'/img250x20.png'; |
|
109 | - $result=pdf_getHeightForLogo($file); |
|
108 | + $file = dirname(__FILE__).'/img250x20.png'; |
|
109 | + $result = pdf_getHeightForLogo($file); |
|
110 | 110 | print __METHOD__." result=".$result."\n"; |
111 | 111 | $this->assertEquals($result, 10.4); |
112 | 112 | } |
@@ -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'; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $user->fetch(1); |
37 | 37 | $user->getrights(); |
38 | 38 | } |
39 | -$conf->global->MAIN_DISABLE_ALL_MAILS=1; |
|
39 | +$conf->global->MAIN_DISABLE_ALL_MAILS = 1; |
|
40 | 40 | |
41 | 41 | $langs->load("main"); |
42 | 42 | |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function testBarcodeZATCAEncode() |
59 | 59 | { |
60 | - global $conf,$user,$langs,$db; |
|
61 | - $conf=$this->savconf; |
|
62 | - $user=$this->savuser; |
|
63 | - $langs=$this->savlangs; |
|
64 | - $db=$this->savdb; |
|
60 | + global $conf, $user, $langs, $db; |
|
61 | + $conf = $this->savconf; |
|
62 | + $user = $this->savuser; |
|
63 | + $langs = $this->savlangs; |
|
64 | + $db = $this->savdb; |
|
65 | 65 | |
66 | 66 | $company = new Societe($db); |
67 | 67 | $company->name = 'Specimen company'; |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function testBarcodeZATCADecode() |
93 | 93 | { |
94 | - global $conf,$user,$langs,$db; |
|
95 | - $conf=$this->savconf; |
|
96 | - $user=$this->savuser; |
|
97 | - $langs=$this->savlangs; |
|
98 | - $db=$this->savdb; |
|
94 | + global $conf, $user, $langs, $db; |
|
95 | + $conf = $this->savconf; |
|
96 | + $user = $this->savuser; |
|
97 | + $langs = $this->savlangs; |
|
98 | + $db = $this->savdb; |
|
99 | 99 | |
100 | 100 | //$string_zatca_base64 = "AQZSYWZlZXECDTEyMzQ1Njc4OVQxMjUDFDIwMjEtMDctMTJUMTQ6MjU6MDlaBAM3ODYFAjI1"; |
101 | 101 | $string_zatca_base64 = "ARBTcGVjaW1lbiBjb21wYW55AgkxMjM0NTY3ODkDFDIwMjAtMDEtMDFUMDk6MzQ6NTZaBAMxMjAFAjIw"; |
@@ -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 | require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; |
30 | 30 | require_once dirname(__FILE__).'/../../htdocs/core/class/evalmath.class.php'; |
31 | 31 | require_once dirname(__FILE__).'/CommonClassTest.class.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 | /** |
@@ -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'; |
@@ -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 | $langs->load("main"); |
43 | 43 | |
@@ -58,16 +58,16 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function testBankAccountCreate() |
60 | 60 | { |
61 | - global $conf,$user,$langs,$db; |
|
62 | - $conf=$this->savconf; |
|
63 | - $user=$this->savuser; |
|
64 | - $langs=$this->savlangs; |
|
65 | - $db=$this->savdb; |
|
61 | + global $conf, $user, $langs, $db; |
|
62 | + $conf = $this->savconf; |
|
63 | + $user = $this->savuser; |
|
64 | + $langs = $this->savlangs; |
|
65 | + $db = $this->savdb; |
|
66 | 66 | |
67 | 67 | $localobject = new Account($db); |
68 | 68 | $localobject->initAsSpecimen(); |
69 | 69 | $localobject->date_solde = dol_now(); |
70 | - $result=$localobject->create($user); |
|
70 | + $result = $localobject->create($user); |
|
71 | 71 | |
72 | 72 | print __METHOD__." result=".$result."\n"; |
73 | 73 | $this->assertLessThan($result, 0); |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function testBankAccountFetch($id) |
88 | 88 | { |
89 | - global $conf,$user,$langs,$db; |
|
90 | - $conf=$this->savconf; |
|
91 | - $user=$this->savuser; |
|
92 | - $langs=$this->savlangs; |
|
93 | - $db=$this->savdb; |
|
89 | + global $conf, $user, $langs, $db; |
|
90 | + $conf = $this->savconf; |
|
91 | + $user = $this->savuser; |
|
92 | + $langs = $this->savlangs; |
|
93 | + $db = $this->savdb; |
|
94 | 94 | |
95 | - $localobject=new Account($db); |
|
96 | - $result=$localobject->fetch($id); |
|
95 | + $localobject = new Account($db); |
|
96 | + $result = $localobject->fetch($id); |
|
97 | 97 | |
98 | 98 | print __METHOD__." id=".$id." result=".$result."\n"; |
99 | 99 | $this->assertLessThan($result, 0); |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function testBankAccountOther($localobject) |
114 | 114 | { |
115 | - global $conf,$user,$langs,$db; |
|
116 | - $conf=$this->savconf; |
|
117 | - $user=$this->savuser; |
|
118 | - $langs=$this->savlangs; |
|
119 | - $db=$this->savdb; |
|
115 | + global $conf, $user, $langs, $db; |
|
116 | + $conf = $this->savconf; |
|
117 | + $user = $this->savuser; |
|
118 | + $langs = $this->savlangs; |
|
119 | + $db = $this->savdb; |
|
120 | 120 | |
121 | 121 | /*$result=$localobject->setstatus(0); |
122 | 122 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $this->assertTrue($result); |
136 | 136 | |
137 | 137 | // Test checkIbanForAccount for CI account |
138 | - $localobject2=new Account($db); |
|
138 | + $localobject2 = new Account($db); |
|
139 | 139 | $localobject2->country = 'CI'; |
140 | 140 | $localobject2->iban = 'CI77A12312341234123412341234'; |
141 | 141 | $result = checkIbanForAccount($localobject2); |
@@ -156,15 +156,15 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function testBankAccountDelete($id) |
158 | 158 | { |
159 | - global $conf,$user,$langs,$db; |
|
160 | - $conf=$this->savconf; |
|
161 | - $user=$this->savuser; |
|
162 | - $langs=$this->savlangs; |
|
163 | - $db=$this->savdb; |
|
164 | - |
|
165 | - $localobject=new Account($db); |
|
166 | - $result=$localobject->fetch($id); |
|
167 | - $result=$localobject->delete($user); |
|
159 | + global $conf, $user, $langs, $db; |
|
160 | + $conf = $this->savconf; |
|
161 | + $user = $this->savuser; |
|
162 | + $langs = $this->savlangs; |
|
163 | + $db = $this->savdb; |
|
164 | + |
|
165 | + $localobject = new Account($db); |
|
166 | + $result = $localobject->fetch($id); |
|
167 | + $result = $localobject->delete($user); |
|
168 | 168 | |
169 | 169 | print __METHOD__." id=".$id." result=".$result."\n"; |
170 | 170 | $this->assertLessThan($result, 0); |
@@ -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'; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $user->fetch(1); |
39 | 39 | $user->getrights(); |
40 | 40 | } |
41 | -$conf->global->MAIN_DISABLE_ALL_MAILS=1; |
|
41 | +$conf->global->MAIN_DISABLE_ALL_MAILS = 1; |
|
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public static function setUpBeforeClass(): void |
59 | 59 | { |
60 | - global $conf,$user,$langs,$db; |
|
60 | + global $conf, $user, $langs, $db; |
|
61 | 61 | $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
62 | 62 | |
63 | 63 | if (getDolGlobalString('MAIN_FIRSTNAME_NAME_POSITION')) { |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function testAdherentTypeCreate() |
86 | 86 | { |
87 | - global $conf,$user,$langs,$db; |
|
88 | - $conf=$this->savconf; |
|
89 | - $user=$this->savuser; |
|
90 | - $langs=$this->savlangs; |
|
91 | - $db=$this->savdb; |
|
92 | - |
|
93 | - $localobject=new AdherentType($db); |
|
94 | - $localobject->statut=1; |
|
95 | - $localobject->label='Adherent type test'; |
|
96 | - $localobject->subscription=1; |
|
97 | - $localobject->amount=0; |
|
98 | - $localobject->vote=1; |
|
99 | - $localobject->company='Old company label'; |
|
100 | - $result=$localobject->create($user); |
|
87 | + global $conf, $user, $langs, $db; |
|
88 | + $conf = $this->savconf; |
|
89 | + $user = $this->savuser; |
|
90 | + $langs = $this->savlangs; |
|
91 | + $db = $this->savdb; |
|
92 | + |
|
93 | + $localobject = new AdherentType($db); |
|
94 | + $localobject->statut = 1; |
|
95 | + $localobject->label = 'Adherent type test'; |
|
96 | + $localobject->subscription = 1; |
|
97 | + $localobject->amount = 0; |
|
98 | + $localobject->vote = 1; |
|
99 | + $localobject->company = 'Old company label'; |
|
100 | + $result = $localobject->create($user); |
|
101 | 101 | print __METHOD__." result=".$result."\n"; |
102 | 102 | $this->assertLessThan($result, 0); |
103 | 103 | |
@@ -115,16 +115,16 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function testAdherentCreate($fk_adherent_type) |
117 | 117 | { |
118 | - global $conf,$user,$langs,$db; |
|
119 | - $conf=$this->savconf; |
|
120 | - $user=$this->savuser; |
|
121 | - $langs=$this->savlangs; |
|
122 | - $db=$this->savdb; |
|
118 | + global $conf, $user, $langs, $db; |
|
119 | + $conf = $this->savconf; |
|
120 | + $user = $this->savuser; |
|
121 | + $langs = $this->savlangs; |
|
122 | + $db = $this->savdb; |
|
123 | 123 | |
124 | - $localobject=new Adherent($db); |
|
124 | + $localobject = new Adherent($db); |
|
125 | 125 | $localobject->initAsSpecimen(); |
126 | - $localobject->typeid=$fk_adherent_type; |
|
127 | - $result=$localobject->create($user); |
|
126 | + $localobject->typeid = $fk_adherent_type; |
|
127 | + $result = $localobject->create($user); |
|
128 | 128 | print __METHOD__." result=".$result."\n"; |
129 | 129 | if ($result < 0) { |
130 | 130 | print $localobject->error; |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function testAdherentFetch($id) |
147 | 147 | { |
148 | - global $conf,$user,$langs,$db; |
|
149 | - $conf=$this->savconf; |
|
150 | - $user=$this->savuser; |
|
151 | - $langs=$this->savlangs; |
|
152 | - $db=$this->savdb; |
|
153 | - |
|
154 | - $localobject=new Adherent($db); |
|
155 | - $result=$localobject->fetch($id); |
|
148 | + global $conf, $user, $langs, $db; |
|
149 | + $conf = $this->savconf; |
|
150 | + $user = $this->savuser; |
|
151 | + $langs = $this->savlangs; |
|
152 | + $db = $this->savdb; |
|
153 | + |
|
154 | + $localobject = new Adherent($db); |
|
155 | + $result = $localobject->fetch($id); |
|
156 | 156 | print __METHOD__." id=".$id." result=".$result."\n"; |
157 | 157 | $this->assertLessThan($result, 0); |
158 | 158 | return $localobject; |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function testAdherentFetchLogin(Adherent $localobject) |
171 | 171 | { |
172 | - global $conf,$user,$langs,$db; |
|
173 | - $conf=$this->savconf; |
|
174 | - $user=$this->savuser; |
|
175 | - $langs=$this->savlangs; |
|
176 | - $db=$this->savdb; |
|
172 | + global $conf, $user, $langs, $db; |
|
173 | + $conf = $this->savconf; |
|
174 | + $user = $this->savuser; |
|
175 | + $langs = $this->savlangs; |
|
176 | + $db = $this->savdb; |
|
177 | 177 | |
178 | 178 | $newobject = new Adherent($db); |
179 | 179 | $result = $newobject->fetch_login($localobject->login); |
@@ -194,45 +194,45 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function testAdherentUpdate(Adherent $localobject) |
196 | 196 | { |
197 | - global $conf,$user,$langs,$db; |
|
198 | - $conf=$this->savconf; |
|
199 | - $user=$this->savuser; |
|
200 | - $langs=$this->savlangs; |
|
201 | - $db=$this->savdb; |
|
197 | + global $conf, $user, $langs, $db; |
|
198 | + $conf = $this->savconf; |
|
199 | + $user = $this->savuser; |
|
200 | + $langs = $this->savlangs; |
|
201 | + $db = $this->savdb; |
|
202 | 202 | |
203 | 203 | $timestamp = dol_now(); |
204 | 204 | |
205 | 205 | $localobject->civility_id = 0; |
206 | - $localobject->login='newlogin'; |
|
207 | - $localobject->company='New company label'; |
|
208 | - $localobject->note_public='New note public after update'; |
|
209 | - $localobject->note_private='New note private after update'; |
|
210 | - $localobject->lastname='New name'; |
|
211 | - $localobject->firstname='New firstname'; |
|
212 | - $localobject->gender='man'; |
|
213 | - $localobject->address='New address'; |
|
214 | - $localobject->zip='New zip'; |
|
215 | - $localobject->town='New town'; |
|
216 | - $localobject->country_id=2; |
|
217 | - $localobject->statut=0; |
|
218 | - $localobject->morphy=0; |
|
219 | - $localobject->phone='New tel pro'; |
|
220 | - $localobject->phone_perso='New tel perso'; |
|
221 | - $localobject->phone_mobile='New tel mobile'; |
|
222 | - $localobject->email='[email protected]'; |
|
223 | - $localobject->birth=$timestamp; |
|
224 | - $result=$localobject->update($user); |
|
206 | + $localobject->login = 'newlogin'; |
|
207 | + $localobject->company = 'New company label'; |
|
208 | + $localobject->note_public = 'New note public after update'; |
|
209 | + $localobject->note_private = 'New note private after update'; |
|
210 | + $localobject->lastname = 'New name'; |
|
211 | + $localobject->firstname = 'New firstname'; |
|
212 | + $localobject->gender = 'man'; |
|
213 | + $localobject->address = 'New address'; |
|
214 | + $localobject->zip = 'New zip'; |
|
215 | + $localobject->town = 'New town'; |
|
216 | + $localobject->country_id = 2; |
|
217 | + $localobject->statut = 0; |
|
218 | + $localobject->morphy = 0; |
|
219 | + $localobject->phone = 'New tel pro'; |
|
220 | + $localobject->phone_perso = 'New tel perso'; |
|
221 | + $localobject->phone_mobile = 'New tel mobile'; |
|
222 | + $localobject->email = '[email protected]'; |
|
223 | + $localobject->birth = $timestamp; |
|
224 | + $result = $localobject->update($user); |
|
225 | 225 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
226 | 226 | $this->assertLessThan($result, 0); |
227 | - $result=$localobject->update_note($localobject->note_private, '_private'); |
|
227 | + $result = $localobject->update_note($localobject->note_private, '_private'); |
|
228 | 228 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
229 | 229 | $this->assertLessThan($result, 0); |
230 | - $result=$localobject->update_note($localobject->note_public, '_public'); |
|
230 | + $result = $localobject->update_note($localobject->note_public, '_public'); |
|
231 | 231 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
232 | 232 | $this->assertLessThan($result, 0); |
233 | 233 | |
234 | - $newobject=new Adherent($db); |
|
235 | - $result=$newobject->fetch($localobject->id); |
|
234 | + $newobject = new Adherent($db); |
|
235 | + $result = $newobject->fetch($localobject->id); |
|
236 | 236 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
237 | 237 | $this->assertLessThan($result, 0); |
238 | 238 | |
@@ -273,13 +273,13 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function testAdherentMakeSubstitution(Adherent $localobject) |
275 | 275 | { |
276 | - global $conf,$user,$langs,$db; |
|
277 | - $conf=$this->savconf; |
|
278 | - $user=$this->savuser; |
|
279 | - $langs=$this->savlangs; |
|
280 | - $db=$this->savdb; |
|
276 | + global $conf, $user, $langs, $db; |
|
277 | + $conf = $this->savconf; |
|
278 | + $user = $this->savuser; |
|
279 | + $langs = $this->savlangs; |
|
280 | + $db = $this->savdb; |
|
281 | 281 | |
282 | - $conf->global->MAIN_FIRSTNAME_NAME_POSITION = 0; // Force setup for firstname+lastname |
|
282 | + $conf->global->MAIN_FIRSTNAME_NAME_POSITION = 0; // Force setup for firstname+lastname |
|
283 | 283 | |
284 | 284 | $template = '__CIVILITY__,__FIRSTNAME__,__LASTNAME__,__FULLNAME__,__COMPANY__,'; |
285 | 285 | $template .= '__ADDRESS__,__ZIP__,__TOWN__,__COUNTRY__,__EMAIL__,__BIRTH__,__PHOTO__,__LOGIN__'; |
@@ -307,11 +307,11 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public function testAdherentSetUserId(Adherent $localobject) |
309 | 309 | { |
310 | - global $conf,$user,$langs,$db; |
|
311 | - $conf=$this->savconf; |
|
312 | - $user=$this->savuser; |
|
313 | - $langs=$this->savlangs; |
|
314 | - $db=$this->savdb; |
|
310 | + global $conf, $user, $langs, $db; |
|
311 | + $conf = $this->savconf; |
|
312 | + $user = $this->savuser; |
|
313 | + $langs = $this->savlangs; |
|
314 | + $db = $this->savdb; |
|
315 | 315 | |
316 | 316 | //We associate member with user |
317 | 317 | $result = $localobject->setUserId($user->id); |
@@ -349,11 +349,11 @@ discard block |
||
349 | 349 | */ |
350 | 350 | public function testAdherentSetThirdPartyId(Adherent $localobject) |
351 | 351 | { |
352 | - global $conf,$user,$langs,$db; |
|
353 | - $conf=$this->savconf; |
|
354 | - $user=$this->savuser; |
|
355 | - $langs=$this->savlangs; |
|
356 | - $db=$this->savdb; |
|
352 | + global $conf, $user, $langs, $db; |
|
353 | + $conf = $this->savconf; |
|
354 | + $user = $this->savuser; |
|
355 | + $langs = $this->savlangs; |
|
356 | + $db = $this->savdb; |
|
357 | 357 | |
358 | 358 | //Create a Third Party |
359 | 359 | $thirdparty = new Societe($db); |
@@ -398,13 +398,13 @@ discard block |
||
398 | 398 | */ |
399 | 399 | public function testAdherentValidate(Adherent $localobject) |
400 | 400 | { |
401 | - global $conf,$user,$langs,$db; |
|
402 | - $conf=$this->savconf; |
|
403 | - $user=$this->savuser; |
|
404 | - $langs=$this->savlangs; |
|
405 | - $db=$this->savdb; |
|
401 | + global $conf, $user, $langs, $db; |
|
402 | + $conf = $this->savconf; |
|
403 | + $user = $this->savuser; |
|
404 | + $langs = $this->savlangs; |
|
405 | + $db = $this->savdb; |
|
406 | 406 | |
407 | - $result=$localobject->validate($user); |
|
407 | + $result = $localobject->validate($user); |
|
408 | 408 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
409 | 409 | $this->assertLessThan($result, 0); |
410 | 410 | |
@@ -422,11 +422,11 @@ discard block |
||
422 | 422 | */ |
423 | 423 | public function testAdherentOther(Adherent $localobject) |
424 | 424 | { |
425 | - global $conf,$user,$langs,$db; |
|
426 | - $conf=$this->savconf; |
|
427 | - $user=$this->savuser; |
|
428 | - $langs=$this->savlangs; |
|
429 | - $db=$this->savdb; |
|
425 | + global $conf, $user, $langs, $db; |
|
426 | + $conf = $this->savconf; |
|
427 | + $user = $this->savuser; |
|
428 | + $langs = $this->savlangs; |
|
429 | + $db = $this->savdb; |
|
430 | 430 | |
431 | 431 | /*$result=$localobject->setstatus(0); |
432 | 432 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
@@ -451,11 +451,11 @@ discard block |
||
451 | 451 | */ |
452 | 452 | public function testAdherentResiliate(Adherent $localobject) |
453 | 453 | { |
454 | - global $conf,$user,$langs,$db; |
|
455 | - $conf=$this->savconf; |
|
456 | - $user=$this->savuser; |
|
457 | - $langs=$this->savlangs; |
|
458 | - $db=$this->savdb; |
|
454 | + global $conf, $user, $langs, $db; |
|
455 | + $conf = $this->savconf; |
|
456 | + $user = $this->savuser; |
|
457 | + $langs = $this->savlangs; |
|
458 | + $db = $this->savdb; |
|
459 | 459 | |
460 | 460 | //Let's resilie un adherent |
461 | 461 | $result = $localobject->resiliate($user); |
@@ -488,13 +488,13 @@ discard block |
||
488 | 488 | */ |
489 | 489 | public function testAdherentDelete($localobject) |
490 | 490 | { |
491 | - global $conf,$user,$langs,$db; |
|
492 | - $conf=$this->savconf; |
|
493 | - $user=$this->savuser; |
|
494 | - $langs=$this->savlangs; |
|
495 | - $db=$this->savdb; |
|
491 | + global $conf, $user, $langs, $db; |
|
492 | + $conf = $this->savconf; |
|
493 | + $user = $this->savuser; |
|
494 | + $langs = $this->savlangs; |
|
495 | + $db = $this->savdb; |
|
496 | 496 | |
497 | - $result=$localobject->delete($localobject->id, $user); |
|
497 | + $result = $localobject->delete($localobject->id, $user); |
|
498 | 498 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
499 | 499 | $this->assertLessThan($result, 0); |
500 | 500 | |
@@ -513,15 +513,15 @@ discard block |
||
513 | 513 | */ |
514 | 514 | public function testAdherentTypeDelete($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; |
|
521 | - |
|
522 | - $localobjectat=new AdherentType($db); |
|
523 | - $result=$localobjectat->fetch($localobject->typeid); |
|
524 | - $result=$localobjectat->delete($user); |
|
516 | + global $conf, $user, $langs, $db; |
|
517 | + $conf = $this->savconf; |
|
518 | + $user = $this->savuser; |
|
519 | + $langs = $this->savlangs; |
|
520 | + $db = $this->savdb; |
|
521 | + |
|
522 | + $localobjectat = new AdherentType($db); |
|
523 | + $result = $localobjectat->fetch($localobject->typeid); |
|
524 | + $result = $localobjectat->delete($user); |
|
525 | 525 | print __METHOD__." result=".$result."\n"; |
526 | 526 | $this->assertLessThan($result, 0); |
527 | 527 |
@@ -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'; |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function testHolidayCreate() |
60 | 60 | { |
61 | - global $conf,$user,$langs,$db; |
|
62 | - $conf=$this->savconf; |
|
63 | - $user=$this->savuser; |
|
64 | - $langs=$this->savlangs; |
|
65 | - $db=$this->savdb; |
|
61 | + global $conf, $user, $langs, $db; |
|
62 | + $conf = $this->savconf; |
|
63 | + $user = $this->savuser; |
|
64 | + $langs = $this->savlangs; |
|
65 | + $db = $this->savdb; |
|
66 | 66 | |
67 | - $localobject=new Holiday($db); |
|
67 | + $localobject = new Holiday($db); |
|
68 | 68 | $localobject->initAsSpecimen(); |
69 | - $result=$localobject->create($user); |
|
69 | + $result = $localobject->create($user); |
|
70 | 70 | |
71 | 71 | print __METHOD__." result=".$result."\n"; |
72 | 72 | $this->assertLessThan($result, 0); |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function testHolidayFetch($id) |
86 | 86 | { |
87 | - global $conf,$user,$langs,$db; |
|
88 | - $conf=$this->savconf; |
|
89 | - $user=$this->savuser; |
|
90 | - $langs=$this->savlangs; |
|
91 | - $db=$this->savdb; |
|
87 | + global $conf, $user, $langs, $db; |
|
88 | + $conf = $this->savconf; |
|
89 | + $user = $this->savuser; |
|
90 | + $langs = $this->savlangs; |
|
91 | + $db = $this->savdb; |
|
92 | 92 | |
93 | - $localobject=new Holiday($db); |
|
94 | - $result=$localobject->fetch($id); |
|
93 | + $localobject = new Holiday($db); |
|
94 | + $result = $localobject->fetch($id); |
|
95 | 95 | |
96 | 96 | print __METHOD__." id=".$id." result=".$result."\n"; |
97 | 97 | $this->assertLessThan($result, 0); |
@@ -110,46 +110,46 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function testHolidayUpdate($localobject) |
112 | 112 | { |
113 | - global $conf,$user,$langs,$db; |
|
114 | - $conf=$this->savconf; |
|
115 | - $user=$this->savuser; |
|
116 | - $langs=$this->savlangs; |
|
117 | - $db=$this->savdb; |
|
113 | + global $conf, $user, $langs, $db; |
|
114 | + $conf = $this->savconf; |
|
115 | + $user = $this->savuser; |
|
116 | + $langs = $this->savlangs; |
|
117 | + $db = $this->savdb; |
|
118 | 118 | |
119 | 119 | $localobject->oldcopy = clone $localobject; |
120 | 120 | |
121 | - $localobject->note_private='New private note after update'; |
|
122 | - $localobject->note_public='New public note after update'; |
|
123 | - $localobject->lastname='New name'; |
|
124 | - $localobject->firstname='New firstname'; |
|
125 | - $localobject->address='New address'; |
|
126 | - $localobject->zip='New zip'; |
|
127 | - $localobject->town='New town'; |
|
128 | - $localobject->country_id=2; |
|
121 | + $localobject->note_private = 'New private note after update'; |
|
122 | + $localobject->note_public = 'New public note after update'; |
|
123 | + $localobject->lastname = 'New name'; |
|
124 | + $localobject->firstname = 'New firstname'; |
|
125 | + $localobject->address = 'New address'; |
|
126 | + $localobject->zip = 'New zip'; |
|
127 | + $localobject->town = 'New town'; |
|
128 | + $localobject->country_id = 2; |
|
129 | 129 | //$localobject->status=0; |
130 | - $localobject->phone_pro='New tel pro'; |
|
131 | - $localobject->phone_perso='New tel perso'; |
|
132 | - $localobject->phone_mobile='New tel mobile'; |
|
133 | - $localobject->fax='New fax'; |
|
134 | - $localobject->email='[email protected]'; |
|
135 | - $localobject->jabberid='New im id'; |
|
136 | - $localobject->default_lang='es_ES'; |
|
137 | - |
|
138 | - $result=$localobject->update($localobject->id, $user); |
|
130 | + $localobject->phone_pro = 'New tel pro'; |
|
131 | + $localobject->phone_perso = 'New tel perso'; |
|
132 | + $localobject->phone_mobile = 'New tel mobile'; |
|
133 | + $localobject->fax = 'New fax'; |
|
134 | + $localobject->email = '[email protected]'; |
|
135 | + $localobject->jabberid = 'New im id'; |
|
136 | + $localobject->default_lang = 'es_ES'; |
|
137 | + |
|
138 | + $result = $localobject->update($localobject->id, $user); |
|
139 | 139 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
140 | 140 | $this->assertLessThan($result, 0, 'Holiday::update error'); |
141 | 141 | |
142 | - $result=$localobject->update_note($localobject->note_private, '_private'); |
|
142 | + $result = $localobject->update_note($localobject->note_private, '_private'); |
|
143 | 143 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
144 | 144 | $this->assertLessThan($result, 0, 'Holiday::update_note (private) error'); |
145 | 145 | |
146 | - $result=$localobject->update_note($localobject->note_public, '_public'); |
|
146 | + $result = $localobject->update_note($localobject->note_public, '_public'); |
|
147 | 147 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
148 | 148 | $this->assertLessThan($result, 0, 'Holiday::update_note (public) error'); |
149 | 149 | |
150 | 150 | |
151 | - $newobject=new Holiday($db); |
|
152 | - $result=$newobject->fetch($localobject->id); |
|
151 | + $newobject = new Holiday($db); |
|
152 | + $result = $newobject->fetch($localobject->id); |
|
153 | 153 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
154 | 154 | $this->assertLessThan($result, 0, 'Holiday::fetch error'); |
155 | 155 | |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function testHolidayOther($localobject) |
174 | 174 | { |
175 | - global $conf,$user,$langs,$db; |
|
176 | - $conf=$this->savconf; |
|
177 | - $user=$this->savuser; |
|
178 | - $langs=$this->savlangs; |
|
179 | - $db=$this->savdb; |
|
175 | + global $conf, $user, $langs, $db; |
|
176 | + $conf = $this->savconf; |
|
177 | + $user = $this->savuser; |
|
178 | + $langs = $this->savlangs; |
|
179 | + $db = $this->savdb; |
|
180 | 180 | |
181 | 181 | $result = $localobject->fetchUsers(true, true, ''); |
182 | 182 | $this->assertNotEquals($result, -1); |
@@ -204,16 +204,16 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function testHolidayDelete($id) |
206 | 206 | { |
207 | - global $conf,$user,$langs,$db; |
|
208 | - $conf=$this->savconf; |
|
209 | - $user=$this->savuser; |
|
210 | - $langs=$this->savlangs; |
|
211 | - $db=$this->savdb; |
|
207 | + global $conf, $user, $langs, $db; |
|
208 | + $conf = $this->savconf; |
|
209 | + $user = $this->savuser; |
|
210 | + $langs = $this->savlangs; |
|
211 | + $db = $this->savdb; |
|
212 | 212 | |
213 | - $localobject=new Holiday($db); |
|
214 | - $result=$localobject->fetch($id); |
|
213 | + $localobject = new Holiday($db); |
|
214 | + $result = $localobject->fetch($id); |
|
215 | 215 | |
216 | - $result=$localobject->delete($user); |
|
216 | + $result = $localobject->delete($user); |
|
217 | 217 | print __METHOD__." id=".$id." result=".$result."\n"; |
218 | 218 | $this->assertLessThan($result, 0); |
219 | 219 | |
@@ -227,55 +227,55 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function testVerifDateHolidayCP() |
229 | 229 | { |
230 | - global $conf,$user,$langs,$db; |
|
231 | - $conf=$this->savconf; |
|
232 | - $user=$this->savuser; |
|
233 | - $langs=$this->savlangs; |
|
234 | - $db=$this->savdb; |
|
230 | + global $conf, $user, $langs, $db; |
|
231 | + $conf = $this->savconf; |
|
232 | + $user = $this->savuser; |
|
233 | + $langs = $this->savlangs; |
|
234 | + $db = $this->savdb; |
|
235 | 235 | |
236 | 236 | // Create a leave request the 1st morning only |
237 | - $localobjecta=new Holiday($db); |
|
237 | + $localobjecta = new Holiday($db); |
|
238 | 238 | $localobjecta->initAsSpecimen(); |
239 | 239 | $localobjecta->date_debut = dol_mktime(0, 0, 0, 1, 1, 2020); |
240 | 240 | $localobjecta->date_fin = dol_mktime(0, 0, 0, 1, 1, 2020); |
241 | 241 | $localobjecta->halfday = 1; |
242 | - $result=$localobjecta->create($user); |
|
242 | + $result = $localobjecta->create($user); |
|
243 | 243 | |
244 | 244 | // Create a leave request the 2 afternoon only |
245 | - $localobjectb=new Holiday($db); |
|
245 | + $localobjectb = new Holiday($db); |
|
246 | 246 | $localobjectb->initAsSpecimen(); |
247 | 247 | $localobjectb->date_debut = dol_mktime(0, 0, 0, 1, 2, 2020); |
248 | 248 | $localobjectb->date_fin = dol_mktime(0, 0, 0, 1, 2, 2020); |
249 | 249 | $localobjectb->halfday = -1; |
250 | - $result=$localobjectb->create($user); |
|
250 | + $result = $localobjectb->create($user); |
|
251 | 251 | |
252 | 252 | $date_debut = dol_mktime(0, 0, 0, 1, 1, 2020); |
253 | 253 | $date_fin = dol_mktime(0, 0, 0, 1, 2, 2020); |
254 | 254 | |
255 | - $localobjectc=new Holiday($db); |
|
255 | + $localobjectc = new Holiday($db); |
|
256 | 256 | |
257 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 0); |
|
257 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 0); |
|
258 | 258 | $this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.'); |
259 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 0); |
|
259 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 0); |
|
260 | 260 | $this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.'); |
261 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 0); |
|
261 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 0); |
|
262 | 262 | $this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.'); |
263 | 263 | |
264 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 1); |
|
264 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 1); |
|
265 | 265 | $this->assertFalse($result, 'result should be false, there is overlapping, morning of first day is not available.'); |
266 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 1); |
|
266 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 1); |
|
267 | 267 | $this->assertFalse($result, 'result should be false, there is overlapping, morning of first day is not available.'); |
268 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 1); |
|
268 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 1); |
|
269 | 269 | $this->assertTrue($result, 'result should be true, there is no overlapping'); |
270 | 270 | |
271 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, -1); |
|
271 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, -1); |
|
272 | 272 | $this->assertTrue($result, 'result should be true, there is no overlapping'); |
273 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, -1); |
|
273 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, -1); |
|
274 | 274 | $this->assertFalse($result, 'result should be false, there is overlapping, afternoon of second day is not available'); |
275 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, -1); |
|
275 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, -1); |
|
276 | 276 | $this->assertFalse($result, 'result should be false, there is overlapping, afternoon of second day is not available'); |
277 | 277 | |
278 | - $result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 2); // start afternoon and end morning |
|
278 | + $result = $localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 2); // start afternoon and end morning |
|
279 | 279 | $this->assertTrue($result, 'result should be true, there is no overlapping'); |
280 | 280 | } |
281 | 281 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | { |
289 | 289 | global $db; |
290 | 290 | |
291 | - $localobjecta=new Holiday($db); |
|
291 | + $localobjecta = new Holiday($db); |
|
292 | 292 | |
293 | 293 | $localobjecta->updateConfCP('lastUpdate', '20100101120000'); |
294 | 294 | $result = $localobjecta->updateBalance(); |
@@ -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'; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | $user->getrights(); |
41 | 41 | } |
42 | -$conf->global->MAIN_DISABLE_ALL_MAILS=1; |
|
42 | +$conf->global->MAIN_DISABLE_ALL_MAILS = 1; |
|
43 | 43 | |
44 | 44 | |
45 | 45 | /** |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public static function setUpBeforeClass(): void |
60 | 60 | { |
61 | - global $conf,$user,$langs,$db; |
|
62 | - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
|
61 | + global $conf, $user, $langs, $db; |
|
62 | + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
|
63 | 63 | |
64 | 64 | if (!getDolGlobalString('MAIN_MODULE_SUPPLIERPROPOSAL')) { |
65 | 65 | print "\n".__METHOD__." module Supplier proposal must be enabled.\n"; |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | */ |
77 | 77 | protected function setUp(): void |
78 | 78 | { |
79 | - global $conf,$user,$langs,$db; |
|
80 | - $conf=$this->savconf; |
|
81 | - $user=$this->savuser; |
|
82 | - $langs=$this->savlangs; |
|
83 | - $db=$this->savdb; |
|
79 | + global $conf, $user, $langs, $db; |
|
80 | + $conf = $this->savconf; |
|
81 | + $user = $this->savuser; |
|
82 | + $langs = $this->savlangs; |
|
83 | + $db = $this->savdb; |
|
84 | 84 | |
85 | 85 | print __METHOD__."\n"; |
86 | 86 | //print $db->getVersion()."\n"; |
@@ -97,15 +97,15 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function testSupplierProposalCreate() |
99 | 99 | { |
100 | - global $conf,$user,$langs,$db; |
|
101 | - $conf=$this->savconf; |
|
102 | - $user=$this->savuser; |
|
103 | - $langs=$this->savlangs; |
|
104 | - $db=$this->savdb; |
|
100 | + global $conf, $user, $langs, $db; |
|
101 | + $conf = $this->savconf; |
|
102 | + $user = $this->savuser; |
|
103 | + $langs = $this->savlangs; |
|
104 | + $db = $this->savdb; |
|
105 | 105 | |
106 | - $localobject=new SupplierProposal($db); |
|
106 | + $localobject = new SupplierProposal($db); |
|
107 | 107 | $localobject->initAsSpecimen(); |
108 | - $result=$localobject->create($user); |
|
108 | + $result = $localobject->create($user); |
|
109 | 109 | |
110 | 110 | $this->assertLessThan($result, 0); |
111 | 111 | print __METHOD__." result=".$result."\n"; |
@@ -123,14 +123,14 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function testSupplierProposalFetch($id) |
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 | - $localobject=new SupplierProposal($db); |
|
133 | - $result=$localobject->fetch($id); |
|
132 | + $localobject = new SupplierProposal($db); |
|
133 | + $result = $localobject->fetch($id); |
|
134 | 134 | |
135 | 135 | $this->assertLessThan($result, 0); |
136 | 136 | print __METHOD__." id=".$id." result=".$result."\n"; |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function testSupplierProposalAddLine($localobject) |
150 | 150 | { |
151 | - global $conf,$user,$langs,$db; |
|
152 | - $conf=$this->savconf; |
|
153 | - $user=$this->savuser; |
|
154 | - $langs=$this->savlangs; |
|
155 | - $db=$this->savdb; |
|
151 | + global $conf, $user, $langs, $db; |
|
152 | + $conf = $this->savconf; |
|
153 | + $user = $this->savuser; |
|
154 | + $langs = $this->savlangs; |
|
155 | + $db = $this->savdb; |
|
156 | 156 | |
157 | 157 | $localobject->fetch_thirdparty(); |
158 | - $result=$localobject->addline('Added line', 10, 2, 19.6); |
|
158 | + $result = $localobject->addline('Added line', 10, 2, 19.6); |
|
159 | 159 | |
160 | 160 | $this->assertLessThan($result, 0); |
161 | 161 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function testSupplierProposalValid($localobject) |
175 | 175 | { |
176 | - global $conf,$user,$langs,$db; |
|
177 | - $conf=$this->savconf; |
|
178 | - $user=$this->savuser; |
|
179 | - $langs=$this->savlangs; |
|
180 | - $db=$this->savdb; |
|
176 | + global $conf, $user, $langs, $db; |
|
177 | + $conf = $this->savconf; |
|
178 | + $user = $this->savuser; |
|
179 | + $langs = $this->savlangs; |
|
180 | + $db = $this->savdb; |
|
181 | 181 | |
182 | 182 | $result = $user->addrights(0, 'supplier_proposal'); |
183 | 183 | $this->assertLessThan($result, 0); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $result = $user->getrights('supplier_proposal', 1); |
186 | 186 | //$this->assertLessThan($result, 0); |
187 | 187 | |
188 | - $result=$localobject->valid($user); |
|
188 | + $result = $localobject->valid($user); |
|
189 | 189 | $this->assertLessThan($result, 0); |
190 | 190 | |
191 | 191 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function testSupplierProposalOther($localobject) |
206 | 206 | { |
207 | - global $conf,$user,$langs,$db; |
|
208 | - $conf=$this->savconf; |
|
209 | - $user=$this->savuser; |
|
210 | - $langs=$this->savlangs; |
|
211 | - $db=$this->savdb; |
|
207 | + global $conf, $user, $langs, $db; |
|
208 | + $conf = $this->savconf; |
|
209 | + $user = $this->savuser; |
|
210 | + $langs = $this->savlangs; |
|
211 | + $db = $this->savdb; |
|
212 | 212 | |
213 | 213 | /*$result=$localobject->setstatus(0); |
214 | 214 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
@@ -233,15 +233,15 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function testSupplierProposalDelete($id) |
235 | 235 | { |
236 | - global $conf,$user,$langs,$db; |
|
237 | - $conf=$this->savconf; |
|
238 | - $user=$this->savuser; |
|
239 | - $langs=$this->savlangs; |
|
240 | - $db=$this->savdb; |
|
241 | - |
|
242 | - $localobject=new SupplierProposal($db); |
|
243 | - $result=$localobject->fetch($id); |
|
244 | - $result=$localobject->delete($user); |
|
236 | + global $conf, $user, $langs, $db; |
|
237 | + $conf = $this->savconf; |
|
238 | + $user = $this->savuser; |
|
239 | + $langs = $this->savlangs; |
|
240 | + $db = $this->savdb; |
|
241 | + |
|
242 | + $localobject = new SupplierProposal($db); |
|
243 | + $result = $localobject->fetch($id); |
|
244 | + $result = $localobject->delete($user); |
|
245 | 245 | |
246 | 246 | print __METHOD__." id=".$id." result=".$result."\n"; |
247 | 247 | $this->assertLessThan($result, 0); |
@@ -23,7 +23,7 @@ discard block |
||
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 |
||
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 | /** |
@@ -55,28 +55,28 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function testFactureRoundingCreate1() |
57 | 57 | { |
58 | - global $conf,$user,$langs,$db; |
|
59 | - $conf=$this->savconf; |
|
60 | - $user=$this->savuser; |
|
61 | - $langs=$this->savlangs; |
|
62 | - $db=$this->savdb; |
|
58 | + global $conf, $user, $langs, $db; |
|
59 | + $conf = $this->savconf; |
|
60 | + $user = $this->savuser; |
|
61 | + $langs = $this->savlangs; |
|
62 | + $db = $this->savdb; |
|
63 | 63 | |
64 | - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; |
|
64 | + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0; |
|
65 | 65 | |
66 | - $localobject=new Facture($db); |
|
66 | + $localobject = new Facture($db); |
|
67 | 67 | $localobject->initAsSpecimen(); |
68 | - $localobject->lines=array(); |
|
68 | + $localobject->lines = array(); |
|
69 | 69 | unset($localobject->total_ht); |
70 | 70 | unset($localobject->total_ttc); |
71 | 71 | unset($localobject->total_tva); |
72 | - $result=$localobject->create($user); |
|
72 | + $result = $localobject->create($user); |
|
73 | 73 | |
74 | 74 | // Add two lines |
75 | - for ($i=0; $i<2; $i++) { |
|
75 | + for ($i = 0; $i < 2; $i++) { |
|
76 | 76 | $localobject->addline('Description '.$i, 1.24, 1, 10); |
77 | 77 | } |
78 | 78 | |
79 | - $newlocalobject=new Facture($db); |
|
79 | + $newlocalobject = new Facture($db); |
|
80 | 80 | $newlocalobject->fetch($result); |
81 | 81 | //var_dump($newlocalobject); |
82 | 82 | |
@@ -97,28 +97,28 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function testFactureRoundingCreate2() |
99 | 99 | { |
100 | - global $conf,$user,$langs,$db; |
|
101 | - $conf=$this->savconf; |
|
102 | - $user=$this->savuser; |
|
103 | - $langs=$this->savlangs; |
|
104 | - $db=$this->savdb; |
|
100 | + global $conf, $user, $langs, $db; |
|
101 | + $conf = $this->savconf; |
|
102 | + $user = $this->savuser; |
|
103 | + $langs = $this->savlangs; |
|
104 | + $db = $this->savdb; |
|
105 | 105 | |
106 | - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; |
|
106 | + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0; |
|
107 | 107 | |
108 | - $localobject=new Facture($db); |
|
108 | + $localobject = new Facture($db); |
|
109 | 109 | $localobject->initAsSpecimen(); |
110 | - $localobject->lines=array(); |
|
110 | + $localobject->lines = array(); |
|
111 | 111 | unset($localobject->total_ht); |
112 | 112 | unset($localobject->total_ttc); |
113 | 113 | unset($localobject->total_vat); |
114 | - $result=$localobject->create($user); |
|
114 | + $result = $localobject->create($user); |
|
115 | 115 | |
116 | 116 | // Add two lines |
117 | - for ($i=0; $i<2; $i++) { |
|
117 | + for ($i = 0; $i < 2; $i++) { |
|
118 | 118 | $localobject->addline('Description '.$i, 1.24, 1, 10); |
119 | 119 | } |
120 | 120 | |
121 | - $newlocalobject=new Facture($db); |
|
121 | + $newlocalobject = new Facture($db); |
|
122 | 122 | $newlocalobject->fetch($result); |
123 | 123 | //var_dump($newlocalobject); |
124 | 124 | |
@@ -136,31 +136,31 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function testFactureAddLine1() |
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 | 145 | // With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0 |
146 | - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; |
|
146 | + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0; |
|
147 | 147 | |
148 | - $localobject1a=new Facture($db); |
|
148 | + $localobject1a = new Facture($db); |
|
149 | 149 | $localobject1a->initAsSpecimen('nolines'); |
150 | - $facid=$localobject1a->create($user); |
|
151 | - $localobject1a->addline('Line 1', 6.36, 15, 21); // This include update_price |
|
150 | + $facid = $localobject1a->create($user); |
|
151 | + $localobject1a->addline('Line 1', 6.36, 15, 21); // This include update_price |
|
152 | 152 | print __METHOD__." id=".$facid." total_ttc=".$localobject1a->total_ttc."\n"; |
153 | 153 | $this->assertEquals(95.40, $localobject1a->total_ht); |
154 | 154 | $this->assertEquals(20.03, $localobject1a->total_tva); |
155 | 155 | $this->assertEquals(115.43, $localobject1a->total_ttc); |
156 | 156 | |
157 | 157 | // With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1 |
158 | - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1; |
|
158 | + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1; |
|
159 | 159 | |
160 | - $localobject1b=new Facture($db); |
|
160 | + $localobject1b = new Facture($db); |
|
161 | 161 | $localobject1b->initAsSpecimen('nolines'); |
162 | - $facid=$localobject1b->create($user); |
|
163 | - $localobject1b->addline('Line 1', 6.36, 15, 21); // This include update_price |
|
162 | + $facid = $localobject1b->create($user); |
|
163 | + $localobject1b->addline('Line 1', 6.36, 15, 21); // This include update_price |
|
164 | 164 | print __METHOD__." id=".$facid." total_ttc=".$localobject1b->total_ttc."\n"; |
165 | 165 | $this->assertEquals(95.40, $localobject1b->total_ht, 'testFactureAddLine1 total_ht'); |
166 | 166 | $this->assertEquals(20.03, $localobject1b->total_tva, 'testFactureAddLine1 total_tva'); |
@@ -177,18 +177,18 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function testFactureAddLine2() |
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 | 186 | // With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0 |
187 | - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; |
|
187 | + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0; |
|
188 | 188 | |
189 | - $localobject2=new Facture($db); |
|
189 | + $localobject2 = new Facture($db); |
|
190 | 190 | $localobject2->initAsSpecimen('nolines'); |
191 | - $facid=$localobject2->create($user); |
|
191 | + $facid = $localobject2->create($user); |
|
192 | 192 | $localobject2->addline('Line 1', 6.36, 5, 21); |
193 | 193 | $localobject2->addline('Line 2', 6.36, 5, 21); |
194 | 194 | $localobject2->addline('Line 3', 6.36, 5, 21); |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | $this->assertEquals(115.44, $localobject2->total_ttc); |
199 | 199 | |
200 | 200 | // With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1 |
201 | - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1; |
|
201 | + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1; |
|
202 | 202 | |
203 | - $localobject2=new Facture($db); |
|
203 | + $localobject2 = new Facture($db); |
|
204 | 204 | $localobject2->initAsSpecimen('nolines'); |
205 | - $facid=$localobject2->create($user); |
|
205 | + $facid = $localobject2->create($user); |
|
206 | 206 | $localobject2->addline('Line 1', 6.36, 5, 21); |
207 | 207 | $localobject2->addline('Line 2', 6.36, 5, 21); |
208 | 208 | $localobject2->addline('Line 3', 6.36, 5, 21); |
@@ -222,18 +222,18 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public function testFactureAddLine3() |
224 | 224 | { |
225 | - global $conf,$user,$langs,$db; |
|
226 | - $conf=$this->savconf; |
|
227 | - $user=$this->savuser; |
|
228 | - $langs=$this->savlangs; |
|
229 | - $db=$this->savdb; |
|
225 | + global $conf, $user, $langs, $db; |
|
226 | + $conf = $this->savconf; |
|
227 | + $user = $this->savuser; |
|
228 | + $langs = $this->savlangs; |
|
229 | + $db = $this->savdb; |
|
230 | 230 | |
231 | 231 | // With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0 |
232 | - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; |
|
232 | + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0; |
|
233 | 233 | |
234 | - $localobject3=new Facture($db); |
|
234 | + $localobject3 = new Facture($db); |
|
235 | 235 | $localobject3->initAsSpecimen('nolines'); |
236 | - $facid=$localobject3->create($user); |
|
236 | + $facid = $localobject3->create($user); |
|
237 | 237 | $localobject3->addline('Line 1', 6.36, 3, 21); |
238 | 238 | $localobject3->addline('Line 2', 6.36, 3, 21); |
239 | 239 | $localobject3->addline('Line 3', 6.36, 3, 21); |
@@ -245,11 +245,11 @@ discard block |
||
245 | 245 | $this->assertEquals(115.45, $localobject3->total_ttc); |
246 | 246 | |
247 | 247 | // With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1 |
248 | - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1; |
|
248 | + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1; |
|
249 | 249 | |
250 | - $localobject3=new Facture($db); |
|
250 | + $localobject3 = new Facture($db); |
|
251 | 251 | $localobject3->initAsSpecimen('nolines'); |
252 | - $facid=$localobject3->create($user); |
|
252 | + $facid = $localobject3->create($user); |
|
253 | 253 | $localobject3->addline('Line 1', 6.36, 3, 21); |
254 | 254 | $localobject3->addline('Line 2', 6.36, 3, 21); |
255 | 255 | $localobject3->addline('Line 3', 6.36, 3, 21); |
@@ -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'; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $user->fetch(1); |
39 | 39 | $user->getrights(); |
40 | 40 | } |
41 | -$conf->global->MAIN_DISABLE_ALL_MAILS=1; |
|
41 | +$conf->global->MAIN_DISABLE_ALL_MAILS = 1; |
|
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | */ |
58 | 58 | protected function setUp(): void |
59 | 59 | { |
60 | - global $conf,$user,$langs,$db; |
|
61 | - $conf=$this->savconf; |
|
62 | - $user=$this->savuser; |
|
63 | - $langs=$this->savlangs; |
|
64 | - $db=$this->savdb; |
|
60 | + global $conf, $user, $langs, $db; |
|
61 | + $conf = $this->savconf; |
|
62 | + $user = $this->savuser; |
|
63 | + $langs = $this->savlangs; |
|
64 | + $db = $this->savdb; |
|
65 | 65 | |
66 | 66 | if (!isModEnabled('productbatch')) { |
67 | 67 | print "\n".__METHOD__." module Lot/Serial must be enabled.\n"; |
@@ -79,98 +79,98 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function testMouvementCreate() |
81 | 81 | { |
82 | - global $conf,$user,$langs,$db; |
|
83 | - $conf=$this->savconf; |
|
84 | - $user=$this->savuser; |
|
85 | - $langs=$this->savlangs; |
|
86 | - $db=$this->savdb; |
|
82 | + global $conf, $user, $langs, $db; |
|
83 | + $conf = $this->savconf; |
|
84 | + $user = $this->savuser; |
|
85 | + $langs = $this->savlangs; |
|
86 | + $db = $this->savdb; |
|
87 | 87 | |
88 | 88 | // We create a product for tests |
89 | - $product0=new Product($db); |
|
89 | + $product0 = new Product($db); |
|
90 | 90 | $product0->initAsSpecimen(); |
91 | - $product0->ref.=' phpunit 0'; |
|
92 | - $product0->label.=' phpunit 0'; |
|
91 | + $product0->ref .= ' phpunit 0'; |
|
92 | + $product0->label .= ' phpunit 0'; |
|
93 | 93 | $product0->status_batch = 1; |
94 | - $product0id=$product0->create($user); |
|
94 | + $product0id = $product0->create($user); |
|
95 | 95 | |
96 | 96 | print __METHOD__." product0id=".$product0id."\n"; |
97 | 97 | $this->assertGreaterThan(0, $product0id, 'Failed to create product'); |
98 | 98 | |
99 | - $product1=new Product($db); |
|
99 | + $product1 = new Product($db); |
|
100 | 100 | $product1->initAsSpecimen(); |
101 | - $product1->ref.=' phpunit 1'; |
|
102 | - $product1->label.=' phpunit 1'; |
|
103 | - $product1id=$product1->create($user); |
|
101 | + $product1->ref .= ' phpunit 1'; |
|
102 | + $product1->label .= ' phpunit 1'; |
|
103 | + $product1id = $product1->create($user); |
|
104 | 104 | |
105 | - $product2=new Product($db); |
|
105 | + $product2 = new Product($db); |
|
106 | 106 | $product2->initAsSpecimen(); |
107 | - $product2->ref.=' phpunit 2'; |
|
108 | - $product2->label.=' phpunit 2'; |
|
109 | - $product2id=$product2->create($user); |
|
107 | + $product2->ref .= ' phpunit 2'; |
|
108 | + $product2->label .= ' phpunit 2'; |
|
109 | + $product2id = $product2->create($user); |
|
110 | 110 | |
111 | 111 | // We create a product for tests |
112 | - $warehouse0=new Entrepot($db); |
|
112 | + $warehouse0 = new Entrepot($db); |
|
113 | 113 | $warehouse0->initAsSpecimen(); |
114 | - $warehouse0->label.=' phpunit 0'; |
|
115 | - $warehouse0->description.=' phpunit 0'; |
|
114 | + $warehouse0->label .= ' phpunit 0'; |
|
115 | + $warehouse0->description .= ' phpunit 0'; |
|
116 | 116 | $warehouse0->statut = 0; |
117 | - $warehouse0id=$warehouse0->create($user); |
|
117 | + $warehouse0id = $warehouse0->create($user); |
|
118 | 118 | |
119 | - $warehouse1=new Entrepot($db); |
|
119 | + $warehouse1 = new Entrepot($db); |
|
120 | 120 | $warehouse1->initAsSpecimen(); |
121 | - $warehouse1->label.=' phpunit 1'; |
|
122 | - $warehouse1->description.=' phpunit 1'; |
|
123 | - $warehouse1id=$warehouse1->create($user); |
|
121 | + $warehouse1->label .= ' phpunit 1'; |
|
122 | + $warehouse1->description .= ' phpunit 1'; |
|
123 | + $warehouse1id = $warehouse1->create($user); |
|
124 | 124 | |
125 | - $warehouse2=new Entrepot($db); |
|
125 | + $warehouse2 = new Entrepot($db); |
|
126 | 126 | $warehouse2->initAsSpecimen(); |
127 | - $warehouse2->label.=' phpunit 2'; |
|
128 | - $warehouse2->description.=' phpunit 2'; |
|
129 | - $warehouse2id=$warehouse2->create($user); |
|
127 | + $warehouse2->label .= ' phpunit 2'; |
|
128 | + $warehouse2->description .= ' phpunit 2'; |
|
129 | + $warehouse2id = $warehouse2->create($user); |
|
130 | 130 | |
131 | - $localobject=new MouvementStock($db); |
|
131 | + $localobject = new MouvementStock($db); |
|
132 | 132 | |
133 | 133 | $datetest1 = dol_mktime(0, 0, 0, 1, 1, 2000); |
134 | 134 | $datetest2 = dol_mktime(0, 0, 0, 1, 2, 2000); |
135 | 135 | |
136 | 136 | // Create an input movement movement (type = 3) with value for eatby date and a lot $datetest1 |
137 | - $result=$localobject->reception($user, $product0id, $warehouse0id, 5, 999, 'Movement for unit test with batch', $datetest1, $datetest1, 'anotyetuselotnumberA', '', 0, 'Inventory Code Test with batch'); |
|
137 | + $result = $localobject->reception($user, $product0id, $warehouse0id, 5, 999, 'Movement for unit test with batch', $datetest1, $datetest1, 'anotyetuselotnumberA', '', 0, 'Inventory Code Test with batch'); |
|
138 | 138 | print __METHOD__." result=".$result."\n"; |
139 | 139 | $this->assertGreaterThan(0, $result, 'Failed to create a movement with a lot number '.$datetest1.' for product id='.$product0id.' with status_batch=1'); |
140 | 140 | |
141 | - $result=$localobject->reception($user, $product0id, $warehouse0id, 5, 999, 'Movement for unit test with batch', $datetest1, $datetest1, 'anotyetuselotnumberB', '', 0, 'Inventory Code Test with batch'); |
|
141 | + $result = $localobject->reception($user, $product0id, $warehouse0id, 5, 999, 'Movement for unit test with batch', $datetest1, $datetest1, 'anotyetuselotnumberB', '', 0, 'Inventory Code Test with batch'); |
|
142 | 142 | print __METHOD__." result=".$result."\n"; |
143 | 143 | $this->assertGreaterThan(0, $result, 'Test to check we can create a movement a eatby dare different when lot number is different'); |
144 | 144 | |
145 | 145 | // Create same input movement movement (type = 3) with same lot but a different value of eatby date |
146 | - $result=$localobject->reception($user, $product0id, $warehouse0id, 5, 999, 'Movement for unit test with batch', $datetest2, $datetest1, 'anotyetuselotnumberA', '', 0, 'Inventory Code Test with batch'); |
|
146 | + $result = $localobject->reception($user, $product0id, $warehouse0id, 5, 999, 'Movement for unit test with batch', $datetest2, $datetest1, 'anotyetuselotnumberA', '', 0, 'Inventory Code Test with batch'); |
|
147 | 147 | print __METHOD__." result=".$result."\n"; |
148 | 148 | $this->assertEquals(-3, $result, 'Test to check we can t create a movement for a lot with a different eatby date'); |
149 | 149 | |
150 | 150 | // Do a list of movement into warehouse 1 |
151 | 151 | |
152 | 152 | // Create an input movement (type = 3) of price 9.9 -> should update PMP to 9.9 |
153 | - $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.9, 'Movement for unit test 1', '', '', '', '', 0, 'Inventory Code Test'); |
|
153 | + $result = $localobject->reception($user, $product1id, $warehouse1id, 10, 9.9, 'Movement for unit test 1', '', '', '', '', 0, 'Inventory Code Test'); |
|
154 | 154 | print __METHOD__." result=".$result."\n"; |
155 | 155 | $this->assertGreaterThan(0, $result, 'Return code of 0 was expected for the reception test 1'); |
156 | 156 | |
157 | 157 | // Create an input movement (type = 3) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 |
158 | - $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.7, 'Movement for unit test 2', '', '', '', '', 0, 'Inventory Code Test'); |
|
158 | + $result = $localobject->reception($user, $product1id, $warehouse1id, 10, 9.7, 'Movement for unit test 2', '', '', '', '', 0, 'Inventory Code Test'); |
|
159 | 159 | print __METHOD__." result=".$result."\n"; |
160 | 160 | $this->assertGreaterThan(0, $result); |
161 | 161 | |
162 | 162 | // Create an output movement (type = 2) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 |
163 | - $result=$localobject->livraison($user, $product1id, $warehouse1id, 5, 999, 'Movement for unit test 3', '', '', '', '', 0, 'Inventory Code Test'); |
|
163 | + $result = $localobject->livraison($user, $product1id, $warehouse1id, 5, 999, 'Movement for unit test 3', '', '', '', '', 0, 'Inventory Code Test'); |
|
164 | 164 | print __METHOD__." result=".$result."\n"; |
165 | 165 | $this->assertGreaterThan(0, $result); |
166 | 166 | |
167 | 167 | // Create an output movement (type = 1) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 |
168 | - $result=$localobject->_create($user, $product1id, $warehouse1id, 1, 0, 0, 'Input from transfer', 'Transfert X'); |
|
168 | + $result = $localobject->_create($user, $product1id, $warehouse1id, 1, 0, 0, 'Input from transfer', 'Transfert X'); |
|
169 | 169 | print __METHOD__." result=".$result."\n"; |
170 | 170 | $this->assertGreaterThan(0, $result); |
171 | 171 | |
172 | 172 | // Create an output movement (type = 1) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 |
173 | - $result=$localobject->_create($user, $product1id, $warehouse1id, -2, 1, 0, 'Output from transfer', 'Transfert Y'); |
|
173 | + $result = $localobject->_create($user, $product1id, $warehouse1id, -2, 1, 0, 'Output from transfer', 'Transfert Y'); |
|
174 | 174 | print __METHOD__." result=".$result."\n"; |
175 | 175 | $this->assertGreaterThan(0, $result); |
176 | 176 | |
@@ -178,27 +178,27 @@ discard block |
||
178 | 178 | // Do same but into warehouse 2 |
179 | 179 | |
180 | 180 | // Create an input movement (type = 3) of price 9.9 -> should update PMP to 9.9 |
181 | - $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.9, 'Movement for unit test 1 wh 2', '', '', '', '', 0, 'Inventory Code Test 2'); |
|
181 | + $result = $localobject->reception($user, $product1id, $warehouse2id, 10, 9.9, 'Movement for unit test 1 wh 2', '', '', '', '', 0, 'Inventory Code Test 2'); |
|
182 | 182 | print __METHOD__." result=".$result."\n"; |
183 | 183 | $this->assertGreaterThan(0, $result); |
184 | 184 | |
185 | 185 | // Create an input movement (type = 3) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 |
186 | - $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.7, 'Movement for unit test 2 wh 2', '', '', '', '', 0, 'Inventory Code Test 2'); |
|
186 | + $result = $localobject->reception($user, $product1id, $warehouse2id, 10, 9.7, 'Movement for unit test 2 wh 2', '', '', '', '', 0, 'Inventory Code Test 2'); |
|
187 | 187 | print __METHOD__." result=".$result."\n"; |
188 | 188 | $this->assertGreaterThan(0, $result); |
189 | 189 | |
190 | 190 | // Create an output movement (type = 2) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 |
191 | - $result=$localobject->livraison($user, $product1id, $warehouse2id, 5, 999, 'Movement for unit test 3 wh 2', '', '', '', '', 0, 'Inventory Code Test 2'); |
|
191 | + $result = $localobject->livraison($user, $product1id, $warehouse2id, 5, 999, 'Movement for unit test 3 wh 2', '', '', '', '', 0, 'Inventory Code Test 2'); |
|
192 | 192 | print __METHOD__." result=".$result."\n"; |
193 | 193 | $this->assertGreaterThan(0, $result); |
194 | 194 | |
195 | 195 | // Create an output movement (type = 1) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 |
196 | - $result=$localobject->_create($user, $product1id, $warehouse2id, 1, 0, 0, 'Input from transfer wh 2', 'Transfert X 2'); |
|
196 | + $result = $localobject->_create($user, $product1id, $warehouse2id, 1, 0, 0, 'Input from transfer wh 2', 'Transfert X 2'); |
|
197 | 197 | print __METHOD__." result=".$result."\n"; |
198 | 198 | $this->assertGreaterThan(0, $result, 'Test create A'); |
199 | 199 | |
200 | 200 | // Create an output movement (type = 1) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 |
201 | - $result=$localobject->_create($user, $product1id, $warehouse2id, -2, 1, 0, 'Output from transfer wh 2', 'Transfert Y 2'); |
|
201 | + $result = $localobject->_create($user, $product1id, $warehouse2id, -2, 1, 0, 'Output from transfer wh 2', 'Transfert Y 2'); |
|
202 | 202 | print __METHOD__." result=".$result."\n"; |
203 | 203 | $this->assertGreaterThan(0, $result, 'Test create B'); |
204 | 204 | |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function testMouvementCheck($localobject) |
218 | 218 | { |
219 | - global $conf,$user,$langs,$db; |
|
220 | - $conf=$this->savconf; |
|
221 | - $user=$this->savuser; |
|
222 | - $langs=$this->savlangs; |
|
223 | - $db=$this->savdb; |
|
219 | + global $conf, $user, $langs, $db; |
|
220 | + $conf = $this->savconf; |
|
221 | + $user = $this->savuser; |
|
222 | + $langs = $this->savlangs; |
|
223 | + $db = $this->savdb; |
|
224 | 224 | |
225 | 225 | $productid = $localobject->product_id; |
226 | 226 | $warehouseid = $localobject->entrepot_id; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $producttotest->fetch($productid); |
232 | 232 | |
233 | 233 | print __METHOD__." producttotest->stock_reel=".$producttotest->stock_reel."\n"; |
234 | - $this->assertEquals($producttotest->stock_reel, 28); // 28 is result of stock movement defined into testMouvementCreate |
|
234 | + $this->assertEquals($producttotest->stock_reel, 28); // 28 is result of stock movement defined into testMouvementCreate |
|
235 | 235 | |
236 | 236 | print __METHOD__." producttotest->pmp=".$producttotest->pmp."\n"; |
237 | 237 | $this->assertEquals($producttotest->pmp, 9.8); |