@@ -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 | |
42 | 42 | |
@@ -56,33 +56,33 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function testExpenseReportCreate() |
58 | 58 | { |
59 | - global $conf,$user,$langs,$db; |
|
60 | - $conf=$this->savconf; |
|
61 | - $user=$this->savuser; |
|
62 | - $langs=$this->savlangs; |
|
63 | - $db=$this->savdb; |
|
59 | + global $conf, $user, $langs, $db; |
|
60 | + $conf = $this->savconf; |
|
61 | + $user = $this->savuser; |
|
62 | + $langs = $this->savlangs; |
|
63 | + $db = $this->savdb; |
|
64 | 64 | |
65 | 65 | // Create supplier order with a too low quantity |
66 | - $localobject=new ExpenseReport($db); |
|
67 | - $localobject->initAsSpecimen(); // Init a specimen with lines |
|
66 | + $localobject = new ExpenseReport($db); |
|
67 | + $localobject->initAsSpecimen(); // Init a specimen with lines |
|
68 | 68 | $localobject->status = 0; |
69 | 69 | $localobject->fk_statut = 0; |
70 | - $localobject->date_fin = null; // Force bad value |
|
70 | + $localobject->date_fin = null; // Force bad value |
|
71 | 71 | |
72 | - $result=$localobject->create($user); |
|
72 | + $result = $localobject->create($user); |
|
73 | 73 | print __METHOD__." result=".$result."\n"; |
74 | - $this->assertEquals(-1, $result, "Error on test ExpenseReport create 1 : ".$localobject->error); // must be -1 because of missing mandatory fields |
|
74 | + $this->assertEquals(-1, $result, "Error on test ExpenseReport create 1 : ".$localobject->error); // must be -1 because of missing mandatory fields |
|
75 | 75 | |
76 | - $sql="DELETE FROM ".MAIN_DB_PREFIX."expensereport where ref=''"; |
|
76 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."expensereport where ref=''"; |
|
77 | 77 | $db->query($sql); |
78 | 78 | |
79 | 79 | // Create supplier order |
80 | - $localobject2=new ExpenseReport($db); |
|
81 | - $localobject2->initAsSpecimen(); // Init a specimen with lines |
|
80 | + $localobject2 = new ExpenseReport($db); |
|
81 | + $localobject2->initAsSpecimen(); // Init a specimen with lines |
|
82 | 82 | $localobject2->status = 0; |
83 | 83 | $localobject2->fk_statut = 0; |
84 | 84 | |
85 | - $result=$localobject2->create($user); |
|
85 | + $result = $localobject2->create($user); |
|
86 | 86 | print __METHOD__." result=".$result."\n"; |
87 | 87 | $this->assertGreaterThanOrEqual(0, $result, "Error on test ExpenseReport create 2 : ".$localobject2->error); |
88 | 88 | |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function testExpenseReportFetch($id) |
103 | 103 | { |
104 | - global $conf,$user,$langs,$db; |
|
105 | - $conf=$this->savconf; |
|
106 | - $user=$this->savuser; |
|
107 | - $langs=$this->savlangs; |
|
108 | - $db=$this->savdb; |
|
104 | + global $conf, $user, $langs, $db; |
|
105 | + $conf = $this->savconf; |
|
106 | + $user = $this->savuser; |
|
107 | + $langs = $this->savlangs; |
|
108 | + $db = $this->savdb; |
|
109 | 109 | |
110 | - $localobject=new ExpenseReport($db); |
|
111 | - $result=$localobject->fetch($id); |
|
110 | + $localobject = new ExpenseReport($db); |
|
111 | + $result = $localobject->fetch($id); |
|
112 | 112 | |
113 | 113 | print __METHOD__." id=".$id." result=".$result."\n"; |
114 | 114 | $this->assertLessThan($result, 0); |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function testExpenseReportValid($localobject) |
128 | 128 | { |
129 | - global $conf,$user,$langs,$db; |
|
130 | - $conf=$this->savconf; |
|
131 | - $user=$this->savuser; |
|
132 | - $langs=$this->savlangs; |
|
133 | - $db=$this->savdb; |
|
129 | + global $conf, $user, $langs, $db; |
|
130 | + $conf = $this->savconf; |
|
131 | + $user = $this->savuser; |
|
132 | + $langs = $this->savlangs; |
|
133 | + $db = $this->savdb; |
|
134 | 134 | |
135 | - $result=$localobject->setValidate($user); |
|
135 | + $result = $localobject->setValidate($user); |
|
136 | 136 | |
137 | 137 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
138 | 138 | $this->assertLessThan($result, 0); |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function testExpenseReportApprove($localobject) |
152 | 152 | { |
153 | - global $conf,$user,$langs,$db; |
|
154 | - $conf=$this->savconf; |
|
155 | - $user=$this->savuser; |
|
156 | - $langs=$this->savlangs; |
|
157 | - $db=$this->savdb; |
|
153 | + global $conf, $user, $langs, $db; |
|
154 | + $conf = $this->savconf; |
|
155 | + $user = $this->savuser; |
|
156 | + $langs = $this->savlangs; |
|
157 | + $db = $this->savdb; |
|
158 | 158 | |
159 | - $result=$localobject->setApproved($user); |
|
159 | + $result = $localobject->setApproved($user); |
|
160 | 160 | |
161 | 161 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
162 | 162 | $this->assertLessThan($result, 0); |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function testExpenseReportCancel($localobject) |
176 | 176 | { |
177 | - global $conf,$user,$langs,$db; |
|
178 | - $conf=$this->savconf; |
|
179 | - $user=$this->savuser; |
|
180 | - $langs=$this->savlangs; |
|
181 | - $db=$this->savdb; |
|
177 | + global $conf, $user, $langs, $db; |
|
178 | + $conf = $this->savconf; |
|
179 | + $user = $this->savuser; |
|
180 | + $langs = $this->savlangs; |
|
181 | + $db = $this->savdb; |
|
182 | 182 | |
183 | - $result=$localobject->set_cancel($user, 'Because...'); |
|
183 | + $result = $localobject->set_cancel($user, 'Because...'); |
|
184 | 184 | |
185 | 185 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
186 | 186 | $this->assertLessThan($result, 0); |
@@ -198,13 +198,13 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function testExpenseReportOther($localobject) |
200 | 200 | { |
201 | - global $conf,$user,$langs,$db; |
|
202 | - $conf=$this->savconf; |
|
203 | - $user=$this->savuser; |
|
204 | - $langs=$this->savlangs; |
|
205 | - $db=$this->savdb; |
|
201 | + global $conf, $user, $langs, $db; |
|
202 | + $conf = $this->savconf; |
|
203 | + $user = $this->savuser; |
|
204 | + $langs = $this->savlangs; |
|
205 | + $db = $this->savdb; |
|
206 | 206 | |
207 | - $result=$localobject->getSumPayments(); |
|
207 | + $result = $localobject->getSumPayments(); |
|
208 | 208 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
209 | 209 | $this->assertGreaterThanOrEqual(0, $result); |
210 | 210 | |
@@ -222,15 +222,15 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public function testExpenseReportDelete($id) |
224 | 224 | { |
225 | - global $conf,$user,$langs,$db; |
|
226 | - $conf=$this->savconf; |
|
227 | - $user=$this->savuser; |
|
228 | - $langs=$this->savlangs; |
|
229 | - $db=$this->savdb; |
|
230 | - |
|
231 | - $localobject=new ExpenseReport($db); |
|
232 | - $result=$localobject->fetch($id); |
|
233 | - $result=$localobject->delete($user); |
|
225 | + global $conf, $user, $langs, $db; |
|
226 | + $conf = $this->savconf; |
|
227 | + $user = $this->savuser; |
|
228 | + $langs = $this->savlangs; |
|
229 | + $db = $this->savdb; |
|
230 | + |
|
231 | + $localobject = new ExpenseReport($db); |
|
232 | + $result = $localobject->fetch($id); |
|
233 | + $result = $localobject->delete($user); |
|
234 | 234 | |
235 | 235 | print __METHOD__." id=".$id." result=".$result."\n"; |
236 | 236 | $this->assertGreaterThan(0, $result); |
@@ -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 | |
43 | 43 | /** |
@@ -56,37 +56,37 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function testCategorieCreate() |
58 | 58 | { |
59 | - global $conf,$user,$langs,$db; |
|
60 | - $conf=$this->savconf; |
|
61 | - $user=$this->savuser; |
|
62 | - $langs=$this->savlangs; |
|
63 | - $db=$this->savdb; |
|
59 | + global $conf, $user, $langs, $db; |
|
60 | + $conf = $this->savconf; |
|
61 | + $user = $this->savuser; |
|
62 | + $langs = $this->savlangs; |
|
63 | + $db = $this->savdb; |
|
64 | 64 | |
65 | 65 | |
66 | 66 | // We create a category |
67 | - $localobject=new Categorie($db); |
|
67 | + $localobject = new Categorie($db); |
|
68 | 68 | $localobject->initAsSpecimen(); |
69 | 69 | |
70 | 70 | // Check it does not exist (return 0) |
71 | - $resultCheck=$localobject->already_exists(); |
|
71 | + $resultCheck = $localobject->already_exists(); |
|
72 | 72 | print __METHOD__." resultCheck=".$resultCheck."\n"; |
73 | 73 | $this->assertEquals(0, $resultCheck); |
74 | 74 | |
75 | 75 | // Create |
76 | - $resultFirstCreate=$localobject->create($user); |
|
76 | + $resultFirstCreate = $localobject->create($user); |
|
77 | 77 | print __METHOD__." resultFirstCreate=".$resultFirstCreate."\n"; |
78 | 78 | $this->assertGreaterThan(0, $resultFirstCreate); |
79 | 79 | |
80 | 80 | // We try to create another one with same ref |
81 | - $localobject2=new Categorie($db); |
|
81 | + $localobject2 = new Categorie($db); |
|
82 | 82 | $localobject2->initAsSpecimen(); |
83 | 83 | |
84 | 84 | // Check it does exist (return 1) |
85 | - $resultCheck=$localobject2->already_exists(); |
|
85 | + $resultCheck = $localobject2->already_exists(); |
|
86 | 86 | print __METHOD__." resultCheck=".$resultCheck."\n"; |
87 | 87 | $this->assertGreaterThan(0, $resultCheck); |
88 | 88 | |
89 | - $resultSecondCreate=$localobject2->create($user); |
|
89 | + $resultSecondCreate = $localobject2->create($user); |
|
90 | 90 | print __METHOD__." result=".$resultSecondCreate."\n"; |
91 | 91 | $this->assertEquals(-4, $resultSecondCreate); |
92 | 92 | |
@@ -104,38 +104,38 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function testCategorieProduct($id) |
106 | 106 | { |
107 | - global $conf,$user,$langs,$db; |
|
108 | - $conf=$this->savconf; |
|
109 | - $user=$this->savuser; |
|
110 | - $langs=$this->savlangs; |
|
111 | - $db=$this->savdb; |
|
107 | + global $conf, $user, $langs, $db; |
|
108 | + $conf = $this->savconf; |
|
109 | + $user = $this->savuser; |
|
110 | + $langs = $this->savlangs; |
|
111 | + $db = $this->savdb; |
|
112 | 112 | |
113 | - $localobjecttmp=new Categorie($db); |
|
113 | + $localobjecttmp = new Categorie($db); |
|
114 | 114 | $localobjecttmp->initAsSpecimen(); |
115 | - $localobjecttmp->label='Specimen Category for product'; |
|
116 | - $localobjecttmp->type=0; // product category |
|
117 | - $catid=$localobjecttmp->create($user); |
|
115 | + $localobjecttmp->label = 'Specimen Category for product'; |
|
116 | + $localobjecttmp->type = 0; // product category |
|
117 | + $catid = $localobjecttmp->create($user); |
|
118 | 118 | |
119 | 119 | print __METHOD__." catid=".$catid."\n"; |
120 | 120 | $this->assertGreaterThan(0, $catid); |
121 | 121 | |
122 | 122 | // Try to create product linked to category |
123 | - $localobject2=new Product($db); |
|
123 | + $localobject2 = new Product($db); |
|
124 | 124 | $localobject2->initAsSpecimen(); |
125 | - $localobject2->ref.='-CATEG'; |
|
126 | - $localobject2->tva_npr=1; |
|
127 | - $result=$localobject2->create($user); |
|
125 | + $localobject2->ref .= '-CATEG'; |
|
126 | + $localobject2->tva_npr = 1; |
|
127 | + $result = $localobject2->create($user); |
|
128 | 128 | $cat = new Categorie($db); |
129 | 129 | $cat->id = $catid; |
130 | 130 | $cat->type = 0; |
131 | - $result=$cat->add_type($localobject2, "product"); |
|
131 | + $result = $cat->add_type($localobject2, "product"); |
|
132 | 132 | |
133 | 133 | print __METHOD__." result=".$result."\n"; |
134 | 134 | $this->assertGreaterThan(0, $result); |
135 | 135 | |
136 | 136 | // Get list of categories for product |
137 | - $localcateg=new Categorie($db); |
|
138 | - $listofcateg=$localcateg->containing($localobject2->id, Categorie::TYPE_PRODUCT, 'label'); |
|
137 | + $localcateg = new Categorie($db); |
|
138 | + $listofcateg = $localcateg->containing($localobject2->id, Categorie::TYPE_PRODUCT, 'label'); |
|
139 | 139 | $this->assertTrue(in_array('Specimen Category for product', $listofcateg), 'Categ not found linked to product when it should'); |
140 | 140 | |
141 | 141 | return $id; |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function testCategorieFetch($id) |
154 | 154 | { |
155 | - global $conf,$user,$langs,$db; |
|
156 | - $conf=$this->savconf; |
|
157 | - $user=$this->savuser; |
|
158 | - $langs=$this->savlangs; |
|
159 | - $db=$this->savdb; |
|
155 | + global $conf, $user, $langs, $db; |
|
156 | + $conf = $this->savconf; |
|
157 | + $user = $this->savuser; |
|
158 | + $langs = $this->savlangs; |
|
159 | + $db = $this->savdb; |
|
160 | 160 | |
161 | - $localobject=new Categorie($db); |
|
162 | - $result=$localobject->fetch($id); |
|
161 | + $localobject = new Categorie($db); |
|
162 | + $result = $localobject->fetch($id); |
|
163 | 163 | |
164 | 164 | print __METHOD__." id=".$id." result=".$result."\n"; |
165 | 165 | $this->assertGreaterThan(0, $result); |
@@ -177,14 +177,14 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function testCategorieUpdate($localobject) |
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->note_private ='New note after update'; |
|
187 | - $result=$localobject->update($user); |
|
186 | + $localobject->note_private = 'New note after update'; |
|
187 | + $result = $localobject->update($user); |
|
188 | 188 | |
189 | 189 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
190 | 190 | $this->assertGreaterThan(0, $result); |
@@ -203,18 +203,18 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function testCategorieOther($localobject) |
205 | 205 | { |
206 | - global $conf,$user,$langs,$db; |
|
207 | - $conf=$this->savconf; |
|
208 | - $user=$this->savuser; |
|
209 | - $langs=$this->savlangs; |
|
210 | - $db=$this->savdb; |
|
206 | + global $conf, $user, $langs, $db; |
|
207 | + $conf = $this->savconf; |
|
208 | + $user = $this->savuser; |
|
209 | + $langs = $this->savlangs; |
|
210 | + $db = $this->savdb; |
|
211 | 211 | |
212 | 212 | /*$result=$localobject->setstatus(0); |
213 | 213 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
214 | 214 | $this->assertLessThan($result, 0); |
215 | 215 | */ |
216 | 216 | |
217 | - $retarray=$localobject->liste_photos('/'); |
|
217 | + $retarray = $localobject->liste_photos('/'); |
|
218 | 218 | print __METHOD__." retarray size=".count($retarray)."\n"; |
219 | 219 | $this->assertTrue(is_array($retarray)); |
220 | 220 | |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function testCategorieDelete($id) |
234 | 234 | { |
235 | - global $conf,$user,$langs,$db; |
|
236 | - $conf=$this->savconf; |
|
237 | - $user=$this->savuser; |
|
238 | - $langs=$this->savlangs; |
|
239 | - $db=$this->savdb; |
|
235 | + global $conf, $user, $langs, $db; |
|
236 | + $conf = $this->savconf; |
|
237 | + $user = $this->savuser; |
|
238 | + $langs = $this->savlangs; |
|
239 | + $db = $this->savdb; |
|
240 | 240 | |
241 | - $localobject=new Categorie($db); |
|
242 | - $result=$localobject->fetch($id); |
|
243 | - $result=$localobject->delete($user); |
|
241 | + $localobject = new Categorie($db); |
|
242 | + $result = $localobject->fetch($id); |
|
243 | + $result = $localobject->delete($user); |
|
244 | 244 | |
245 | 245 | print __METHOD__." id=".$id." result=".$result."\n"; |
246 | 246 | $this->assertGreaterThan(0, $result); |
@@ -256,14 +256,14 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function testCategorieStatic() |
258 | 258 | { |
259 | - global $conf,$user,$langs,$db; |
|
260 | - $conf=$this->savconf; |
|
261 | - $user=$this->savuser; |
|
262 | - $langs=$this->savlangs; |
|
263 | - $db=$this->savdb; |
|
264 | - |
|
265 | - $localobject=new Categorie($db); |
|
266 | - $retarray=$localobject->get_full_arbo(3); |
|
259 | + global $conf, $user, $langs, $db; |
|
260 | + $conf = $this->savconf; |
|
261 | + $user = $this->savuser; |
|
262 | + $langs = $this->savlangs; |
|
263 | + $db = $this->savdb; |
|
264 | + |
|
265 | + $localobject = new Categorie($db); |
|
266 | + $retarray = $localobject->get_full_arbo(3); |
|
267 | 267 | |
268 | 268 | print __METHOD__." retarray size=".count($retarray)."\n"; |
269 | 269 | $this->assertTrue(is_array($retarray)); |
@@ -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 | |
42 | 42 | /** |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function testSelectPaperFormat() |
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 | - $localobject=new FormAdmin($db); |
|
65 | - $result=$localobject->select_paper_format('', 'paperformat_id', 'A4', 0, 1); |
|
64 | + $localobject = new FormAdmin($db); |
|
65 | + $result = $localobject->select_paper_format('', 'paperformat_id', 'A4', 0, 1); |
|
66 | 66 | |
67 | 67 | $this->assertEquals($result, '<select class="flat" id="paperformat_id" name="paperformat_id"><option value="EUA4">Format A4 - 210x297 mm</option></select>'); |
68 | 68 | print __METHOD__." result=".$result."\n"; |
@@ -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 | |
43 | 43 | /** |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public static function setUpBeforeClass(): void |
58 | 58 | { |
59 | - global $conf,$user,$langs,$db; |
|
59 | + global $conf, $user, $langs, $db; |
|
60 | 60 | |
61 | 61 | if (!isModEnabled('paypal')) { |
62 | 62 | print __METHOD__." Module Paypal must be enabled.\n"; |
63 | 63 | die(1); |
64 | 64 | } |
65 | 65 | |
66 | - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
|
66 | + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
|
67 | 67 | |
68 | 68 | print __METHOD__."\n"; |
69 | 69 | } |
@@ -76,16 +76,16 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function testPaypalOk() |
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 | - $urltotest=getOnlinePaymentUrl(0, 'free'); |
|
85 | + $urltotest = getOnlinePaymentUrl(0, 'free'); |
|
86 | 86 | print "urltotest=".$urltotest."\n"; |
87 | 87 | |
88 | - $result=getURLContent($urltotest, 'GET', '', 1, array(), array('http', 'https'), 2); |
|
88 | + $result = getURLContent($urltotest, 'GET', '', 1, array(), array('http', 'https'), 2); |
|
89 | 89 | |
90 | 90 | print __METHOD__." result=".$result['http_code']."\n"; |
91 | 91 | $this->assertEquals(200, $result['http_code']); |
@@ -24,41 +24,41 @@ 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'; |
31 | 31 | require_once dirname(__FILE__).'/CommonClassTest.class.php'; |
32 | 32 | |
33 | -if (! defined('NOREQUIREUSER')) { |
|
33 | +if (!defined('NOREQUIREUSER')) { |
|
34 | 34 | define('NOREQUIREUSER', '1'); |
35 | 35 | } |
36 | -if (! defined('NOREQUIREDB')) { |
|
36 | +if (!defined('NOREQUIREDB')) { |
|
37 | 37 | define('NOREQUIREDB', '1'); |
38 | 38 | } |
39 | -if (! defined('NOREQUIRESOC')) { |
|
39 | +if (!defined('NOREQUIRESOC')) { |
|
40 | 40 | define('NOREQUIRESOC', '1'); |
41 | 41 | } |
42 | -if (! defined('NOREQUIRETRAN')) { |
|
42 | +if (!defined('NOREQUIRETRAN')) { |
|
43 | 43 | define('NOREQUIRETRAN', '1'); |
44 | 44 | } |
45 | -if (! defined('NOCSRFCHECK')) { |
|
45 | +if (!defined('NOCSRFCHECK')) { |
|
46 | 46 | define('NOCSRFCHECK', '1'); |
47 | 47 | } |
48 | -if (! defined('NOTOKENRENEWAL')) { |
|
48 | +if (!defined('NOTOKENRENEWAL')) { |
|
49 | 49 | define('NOTOKENRENEWAL', '1'); |
50 | 50 | } |
51 | -if (! defined('NOREQUIREMENU')) { |
|
51 | +if (!defined('NOREQUIREMENU')) { |
|
52 | 52 | define('NOREQUIREMENU', '1'); // If there is no menu to show |
53 | 53 | } |
54 | -if (! defined('NOREQUIREHTML')) { |
|
54 | +if (!defined('NOREQUIREHTML')) { |
|
55 | 55 | define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php |
56 | 56 | } |
57 | -if (! defined('NOREQUIREAJAX')) { |
|
57 | +if (!defined('NOREQUIREAJAX')) { |
|
58 | 58 | define('NOREQUIREAJAX', '1'); |
59 | 59 | } |
60 | -if (! defined("NOLOGIN")) { |
|
61 | - define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
60 | +if (!defined("NOLOGIN")) { |
|
61 | + define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function testImportSample1() |
80 | 80 | { |
81 | - $file=dirname(__FILE__).'/Example_import_company_1.csv'; |
|
81 | + $file = dirname(__FILE__).'/Example_import_company_1.csv'; |
|
82 | 82 | |
83 | 83 | // TODO |
84 | 84 | // Run import on file and check the record with field "auto" are filled |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \brief PHPUnit test for odf class. |
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 | $langs->load("main"); |
41 | 41 | |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function testODFconvertVarToOdf() |
58 | 58 | { |
59 | - global $conf,$user,$langs,$db; |
|
60 | - $conf=$this->savconf; |
|
61 | - $user=$this->savuser; |
|
62 | - $langs=$this->savlangs; |
|
63 | - $db=$this->savdb; |
|
59 | + global $conf, $user, $langs, $db; |
|
60 | + $conf = $this->savconf; |
|
61 | + $user = $this->savuser; |
|
62 | + $langs = $this->savlangs; |
|
63 | + $db = $this->savdb; |
|
64 | 64 | |
65 | 65 | // we test using template_invoice, it does not matter, we just need a valid odt. |
66 | 66 | $filename = '../../htdocs/install/doctemplates/invoices/template_invoice.odt'; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | ], |
284 | 284 | ]; |
285 | 285 | |
286 | - $odf=new Odf($filename, array()); |
|
286 | + $odf = new Odf($filename, array()); |
|
287 | 287 | if (is_object($odf)) { |
288 | 288 | $result = 1; |
289 | 289 | } // Just to test |
@@ -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 | |
42 | 42 | /** |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function testLoanCreate() |
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 | - $localobject=new Loan($db); |
|
64 | + $localobject = new Loan($db); |
|
65 | 65 | $localobject->initAsSpecimen(); |
66 | - $result=$localobject->create($user); |
|
66 | + $result = $localobject->create($user); |
|
67 | 67 | |
68 | 68 | $this->assertLessThan($result, 0); |
69 | 69 | print __METHOD__." result=".$result."\n"; |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function testLoanFetch($id) |
83 | 83 | { |
84 | - global $conf,$user,$langs,$db; |
|
85 | - $conf=$this->savconf; |
|
86 | - $user=$this->savuser; |
|
87 | - $langs=$this->savlangs; |
|
88 | - $db=$this->savdb; |
|
84 | + global $conf, $user, $langs, $db; |
|
85 | + $conf = $this->savconf; |
|
86 | + $user = $this->savuser; |
|
87 | + $langs = $this->savlangs; |
|
88 | + $db = $this->savdb; |
|
89 | 89 | |
90 | - $localobject=new Loan($db); |
|
91 | - $result=$localobject->fetch($id); |
|
90 | + $localobject = new Loan($db); |
|
91 | + $result = $localobject->fetch($id); |
|
92 | 92 | |
93 | 93 | $this->assertLessThan($result, 0); |
94 | 94 | print __METHOD__." id=".$id." result=".$result."\n"; |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function testLoanOther($localobject) |
108 | 108 | { |
109 | - global $conf,$user,$langs,$db; |
|
110 | - $conf=$this->savconf; |
|
111 | - $user=$this->savuser; |
|
112 | - $langs=$this->savlangs; |
|
113 | - $db=$this->savdb; |
|
109 | + global $conf, $user, $langs, $db; |
|
110 | + $conf = $this->savconf; |
|
111 | + $user = $this->savuser; |
|
112 | + $langs = $this->savlangs; |
|
113 | + $db = $this->savdb; |
|
114 | 114 | |
115 | - $result=$localobject->setPaid($user); |
|
115 | + $result = $localobject->setPaid($user); |
|
116 | 116 | |
117 | 117 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
118 | 118 | $this->assertLessThan($result, 0); |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function testLoanDelete($id) |
132 | 132 | { |
133 | - global $conf,$user,$langs,$db; |
|
134 | - $conf=$this->savconf; |
|
135 | - $user=$this->savuser; |
|
136 | - $langs=$this->savlangs; |
|
137 | - $db=$this->savdb; |
|
138 | - |
|
139 | - $localobject=new Loan($db); |
|
140 | - $result=$localobject->fetch($id); |
|
141 | - $result=$localobject->delete($user); |
|
133 | + global $conf, $user, $langs, $db; |
|
134 | + $conf = $this->savconf; |
|
135 | + $user = $this->savuser; |
|
136 | + $langs = $this->savlangs; |
|
137 | + $db = $this->savdb; |
|
138 | + |
|
139 | + $localobject = new Loan($db); |
|
140 | + $result = $localobject->fetch($id); |
|
141 | + $result = $localobject->delete($user); |
|
142 | 142 | |
143 | 143 | print __METHOD__." id=".$id." result=".$result."\n"; |
144 | 144 | $this->assertLessThan($result, 0); |
@@ -24,33 +24,33 @@ 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__).'/CommonClassTest.class.php'; |
31 | 31 | |
32 | -if (! defined('NOREQUIRESOC')) { |
|
32 | +if (!defined('NOREQUIRESOC')) { |
|
33 | 33 | define('NOREQUIRESOC', '1'); |
34 | 34 | } |
35 | -if (! defined('NOCSRFCHECK')) { |
|
35 | +if (!defined('NOCSRFCHECK')) { |
|
36 | 36 | define('NOCSRFCHECK', '1'); |
37 | 37 | } |
38 | -if (! defined('NOTOKENRENEWAL')) { |
|
38 | +if (!defined('NOTOKENRENEWAL')) { |
|
39 | 39 | define('NOTOKENRENEWAL', '1'); |
40 | 40 | } |
41 | -if (! defined('NOREQUIREMENU')) { |
|
41 | +if (!defined('NOREQUIREMENU')) { |
|
42 | 42 | define('NOREQUIREMENU', '1'); // If there is no menu to show |
43 | 43 | } |
44 | -if (! defined('NOREQUIREHTML')) { |
|
44 | +if (!defined('NOREQUIREHTML')) { |
|
45 | 45 | define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php |
46 | 46 | } |
47 | -if (! defined('NOREQUIREAJAX')) { |
|
47 | +if (!defined('NOREQUIREAJAX')) { |
|
48 | 48 | define('NOREQUIREAJAX', '1'); |
49 | 49 | } |
50 | -if (! defined("NOLOGIN")) { |
|
51 | - define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
50 | +if (!defined("NOLOGIN")) { |
|
51 | + define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
52 | 52 | } |
53 | -if (! defined("NOSESSION")) { |
|
53 | +if (!defined("NOSESSION")) { |
|
54 | 54 | define("NOSESSION", '1'); |
55 | 55 | } |
56 | 56 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $user->rights->website = new stdClass(); |
70 | 70 | } |
71 | 71 | } |
72 | -$conf->global->MAIN_DISABLE_ALL_MAILS=1; |
|
72 | +$conf->global->MAIN_DISABLE_ALL_MAILS = 1; |
|
73 | 73 | |
74 | 74 | |
75 | 75 | /** |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function testGetPagesFromSearchCriterias() |
90 | 90 | { |
91 | - global $db, $website; // We need the $website as global, it is used by the getPagesFromSearchCriterias() |
|
91 | + global $db, $website; // We need the $website as global, it is used by the getPagesFromSearchCriterias() |
|
92 | 92 | |
93 | - $website = new Website($db); // $website must be defined globally for getPagesFromSearchCriterias() |
|
93 | + $website = new Website($db); // $website must be defined globally for getPagesFromSearchCriterias() |
|
94 | 94 | |
95 | 95 | $s = "123') OR 1=1-- \' xxx"; |
96 | 96 | /* |
@@ -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 | |
43 | 43 | /** |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function testFetchUser() |
58 | 58 | { |
59 | - global $conf,$user,$langs,$db; |
|
60 | - $conf=$this->savconf; |
|
61 | - $user=$this->savuser; |
|
62 | - $langs=$this->savlangs; |
|
63 | - $db=$this->savdb; |
|
59 | + global $conf, $user, $langs, $db; |
|
60 | + $conf = $this->savconf; |
|
61 | + $user = $this->savuser; |
|
62 | + $langs = $this->savlangs; |
|
63 | + $db = $this->savdb; |
|
64 | 64 | |
65 | - $localobject=new Commande($db); |
|
65 | + $localobject = new Commande($db); |
|
66 | 66 | $localobject->fetch(1); |
67 | 67 | |
68 | - $result=$localobject->fetch_user(1); |
|
68 | + $result = $localobject->fetch_user(1); |
|
69 | 69 | |
70 | 70 | print __METHOD__." result=".$result."\n"; |
71 | 71 | $this->assertLessThan($localobject->user->id, 0); |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function testFetchProject() |
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 | - $localobject=new Commande($db); |
|
88 | + $localobject = new Commande($db); |
|
89 | 89 | $localobject->fetch(1); |
90 | - $result=$localobject->fetch_projet(); |
|
90 | + $result = $localobject->fetch_projet(); |
|
91 | 91 | |
92 | 92 | print __METHOD__." result=".$result."\n"; |
93 | 93 | $this->assertLessThanOrEqual($result, 0); |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function testFetchThirdParty() |
103 | 103 | { |
104 | - global $conf,$user,$langs,$db; |
|
105 | - $conf=$this->savconf; |
|
106 | - $user=$this->savuser; |
|
107 | - $langs=$this->savlangs; |
|
108 | - $db=$this->savdb; |
|
104 | + global $conf, $user, $langs, $db; |
|
105 | + $conf = $this->savconf; |
|
106 | + $user = $this->savuser; |
|
107 | + $langs = $this->savlangs; |
|
108 | + $db = $this->savdb; |
|
109 | 109 | |
110 | - $localobject=new Commande($db); |
|
110 | + $localobject = new Commande($db); |
|
111 | 111 | $localobject->fetch(1); |
112 | 112 | |
113 | - $result=$localobject->fetch_thirdparty(); |
|
113 | + $result = $localobject->fetch_thirdparty(); |
|
114 | 114 | |
115 | 115 | print __METHOD__." result=".$result."\n"; |
116 | 116 | $this->assertLessThanOrEqual($result, 0); |