Test Failed
Push — master ( ed0f4f...3aebc2 )
by Alxarafe
43:14
created
dolibarr/test/phpunit/PricesTest.php 1 patch
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
      */
68 68
     function __construct()
69 69
     {
70
-    	parent::__construct();
70
+        parent::__construct();
71 71
 
72
-    	//$this->sharedFixture
72
+        //$this->sharedFixture
73 73
         global $conf,$user,$langs,$db;
74 74
         $this->savconf=$conf;
75 75
         $this->savuser=$user;
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
     }
101 101
 
102 102
     /**
103
-	 * Init phpunit tests
104
-	 *
105
-	 * @return	void
103
+     * Init phpunit tests
104
+     *
105
+     * @return	void
106 106
      */
107 107
     protected function setUp()
108 108
     {
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
     }
117 117
 
118 118
     /**
119
-	 * End phpunit tests
120
-	 *
121
-	 * @return	void
119
+     * End phpunit tests
120
+     *
121
+     * @return	void
122 122
      */
123 123
     protected function tearDown()
124 124
     {
@@ -134,44 +134,44 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function testCalculPriceTotal()
136 136
     {
137
-		global $conf,$user,$langs,$db;
138
-		$this->savconf=$conf;
139
-		$this->savuser=$user;
140
-		$this->savlangs=$langs;
141
-		$this->savdb=$db;
137
+        global $conf,$user,$langs,$db;
138
+        $this->savconf=$conf;
139
+        $this->savuser=$user;
140
+        $this->savlangs=$langs;
141
+        $this->savdb=$db;
142 142
 
143
-		global $mysoc;
144
-		$mysoc=new Societe($db);
143
+        global $mysoc;
144
+        $mysoc=new Societe($db);
145 145
 
146
-		// To force status that say module multicompany is on
147
-		//$conf->multicurrency=new stdClass();
148
-		//$conf->multicurrency->enabled = 0;
146
+        // To force status that say module multicompany is on
147
+        //$conf->multicurrency=new stdClass();
148
+        //$conf->multicurrency->enabled = 0;
149 149
 
150 150
 
151
-		/*
151
+        /*
152 152
 		 *  Country France
153 153
 		 */
154 154
 
155
-		// qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT' (method we provide value)
156
-		$mysoc->country_code='FR';
157
-		$mysoc->country_id=1;
158
-		$result1=calcul_price_total(1, 1.24, 0, 10, 0, 0, 0, 'HT', 0, 0);
155
+        // qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT' (method we provide value)
156
+        $mysoc->country_code='FR';
157
+        $mysoc->country_id=1;
158
+        $result1=calcul_price_total(1, 1.24, 0, 10, 0, 0, 0, 'HT', 0, 0);
159 159
         print __METHOD__." result1=".join(', ',$result1)."\n";
160 160
         // result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
161 161
         $this->assertEquals(array(1.24, 0.12, 1.36, 1.24, 0.124, 1.364, 1.24, 0.12, 1.36, 0, 0, 0, 0, 0, 0, 0, 1.24, 0.12, 1.36, 1.24, 0.124, 1.364, 1.24, 0.12, 1.36, 0, 0),$result1,'Test1 FR');
162 162
 
163
-		// qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value)
164
-		$mysoc->country_code='FR';
165
-		$mysoc->country_id=1;
166
-		$result1=calcul_price_total(2, 8.56, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205);
163
+        // qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value)
164
+        $mysoc->country_code='FR';
165
+        $mysoc->country_id=1;
166
+        $result1=calcul_price_total(2, 8.56, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205);
167 167
         print __METHOD__." result1=".join(', ',$result1)."\n";
168 168
         // result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
169 169
         $this->assertEquals(array(17.12, 1.71, 18.83, 8.56, 0.856, 9.416, 17.12, 1.71, 18.83, 0, 0, 0, 0, 0, 0, 0, 18.7, 1.87, 20.57, 9.34795, 0.93479, 10.28274, 18.7, 1.87, 20.57, 0, 0),$result1,'Test1b FR');
170 170
 
171
-		// qty=2, unit_price=0, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value), pu_ht_devise=100
172
-		$mysoc->country_code='FR';
173
-		$mysoc->country_id=1;
174
-		$result1=calcul_price_total(2, 0, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205, 20);
171
+        // qty=2, unit_price=0, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value), pu_ht_devise=100
172
+        $mysoc->country_code='FR';
173
+        $mysoc->country_id=1;
174
+        $result1=calcul_price_total(2, 0, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205, 20);
175 175
         print __METHOD__." result1=".join(', ',$result1)."\n";
176 176
         // result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
177 177
         $this->assertEquals(array(36.63, 3.66, 40.29, 18.31418, 1.83142, 20.1456, 36.63, 3.66, 40.29, 0, 0, 0, 0, 0, 0, 0, 40, 4, 44, 20, 2, 22, 40, 4, 44, 0, 0),$result1,'Test1c FR');
@@ -181,21 +181,21 @@  discard block
 block discarded – undo
181 181
 		 */
182 182
 
183 183
         // 10 * 10 HT - 0% discount with 10% vat, seller not using localtax1, not localtax2 (method we provide value)
184
-		$mysoc->country_code='ES';
185
-		$mysoc->country_id=4;
186
-		$mysoc->localtax1_assuj=0;
187
-		$mysoc->localtax2_assuj=0;
188
-		$result2=calcul_price_total(10, 10, 0, 10, 0, 0, 0, 'HT', 0, 0);	// 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2
184
+        $mysoc->country_code='ES';
185
+        $mysoc->country_id=4;
186
+        $mysoc->localtax1_assuj=0;
187
+        $mysoc->localtax2_assuj=0;
188
+        $result2=calcul_price_total(10, 10, 0, 10, 0, 0, 0, 'HT', 0, 0);	// 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2
189 189
         print __METHOD__." result2=".join(', ',$result2)."\n";
190 190
         // result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
191 191
         $this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0),$result2,'Test1 ES');
192 192
 
193 193
         // 10 * 10 HT - 0% discount with 10% vat, seller not using localtax1, not localtax2 (other method autodetect)
194
-		$mysoc->country_code='ES';
195
-		$mysoc->country_id=4;
196
-		$mysoc->localtax1_assuj=0;
197
-		$mysoc->localtax2_assuj=0;
198
-		$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0);	// 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2
194
+        $mysoc->country_code='ES';
195
+        $mysoc->country_id=4;
196
+        $mysoc->localtax1_assuj=0;
197
+        $mysoc->localtax2_assuj=0;
198
+        $result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0);	// 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2
199 199
         print __METHOD__." result2=".join(', ',$result2)."\n";
200 200
         // result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
201 201
         $this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0),$result2,'Test2 ES');
@@ -203,76 +203,76 @@  discard block
 block discarded – undo
203 203
         // --------------------------------------------------------
204 204
 
205 205
         // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (method we provide value)
206
-		$mysoc->country_code='ES';
207
-		$mysoc->country_id=4;
208
-		$mysoc->localtax1_assuj=1;
209
-		$mysoc->localtax2_assuj=0;
206
+        $mysoc->country_code='ES';
207
+        $mysoc->country_id=4;
208
+        $mysoc->localtax1_assuj=1;
209
+        $mysoc->localtax2_assuj=0;
210 210
         $result2=calcul_price_total(10, 10, 0, 10, 1.4, 0, 0, 'HT', 0, 0);
211
-		print __METHOD__." result2=".join(', ',$result2)."\n";
212
-		// result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
211
+        print __METHOD__." result2=".join(', ',$result2)."\n";
212
+        // result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
213 213
         $this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0, 100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0),$result2,'Test3 ES');
214 214
 
215 215
         // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (other method autodetect)
216
-		$mysoc->country_code='ES';
217
-		$mysoc->country_id=4;
218
-		$mysoc->localtax1_assuj=1;
219
-		$mysoc->localtax2_assuj=0;
216
+        $mysoc->country_code='ES';
217
+        $mysoc->country_id=4;
218
+        $mysoc->localtax1_assuj=1;
219
+        $mysoc->localtax2_assuj=0;
220 220
         $result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0);
221
-		print __METHOD__." result2=".join(', ',$result2)."\n";
222
-		// result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
221
+        print __METHOD__." result2=".join(', ',$result2)."\n";
222
+        // result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
223 223
         $this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0, 100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0),$result2,'Test4 ES');
224 224
 
225 225
         // --------------------------------------------------------
226 226
 
227 227
         // 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 19% localtax2 type 5 (method we provide value), we provide a service and not a product
228
-		$mysoc->country_code='ES';
229
-		$mysoc->country_id=4;
230
-		$mysoc->localtax1_assuj=0;
231
-		$mysoc->localtax2_assuj=1;
228
+        $mysoc->country_code='ES';
229
+        $mysoc->country_id=4;
230
+        $mysoc->localtax1_assuj=0;
231
+        $mysoc->localtax2_assuj=1;
232 232
         $result2=calcul_price_total(10, 10, 0, 10, 0, -19, 0, 'HT', 0, 1);
233
-		// result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
233
+        // result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
234 234
         $this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19),$result2,'Test5 ES for service');
235 235
 
236 236
         // 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 21% localtax2 type 5 (other method autodetect), we provide a service and not a product
237
-		$mysoc->country_code='ES';
238
-		$mysoc->country_id=4;
239
-		$mysoc->localtax1_assuj=0;
240
-		$mysoc->localtax2_assuj=1;
237
+        $mysoc->country_code='ES';
238
+        $mysoc->country_id=4;
239
+        $mysoc->localtax1_assuj=0;
240
+        $mysoc->localtax2_assuj=1;
241 241
         $result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0);
242
-		print __METHOD__." result2=".join(', ',$result2)."\n";
243
-		// result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
244
-		$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0),$result2,'Test6 ES for product');
242
+        print __METHOD__." result2=".join(', ',$result2)."\n";
243
+        // result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
244
+        $this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0),$result2,'Test6 ES for product');
245 245
 
246 246
         // 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 21% localtax2 type 5 (other method autodetect), we provide a product and not a service
247
-		$mysoc->country_code='ES';
248
-		$mysoc->country_id=4;
249
-		$mysoc->localtax1_assuj=0;
250
-		$mysoc->localtax2_assuj=1;
247
+        $mysoc->country_code='ES';
248
+        $mysoc->country_id=4;
249
+        $mysoc->localtax1_assuj=0;
250
+        $mysoc->localtax2_assuj=1;
251 251
         $result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 1);
252
-		print __METHOD__." result2=".join(', ',$result2)."\n";
253
-		// result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
254
-		$this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19),$result2,'Test6 ES for service');
252
+        print __METHOD__." result2=".join(', ',$result2)."\n";
253
+        // result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
254
+        $this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19),$result2,'Test6 ES for service');
255 255
 
256
-		// --------------------------------------------------------
256
+        // --------------------------------------------------------
257 257
 
258 258
         // Credit Note: 10 * -10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 19% localtax2 type 5 (method we provide value), we provide a product and not a service
259
-		$mysoc->country_code='ES';
260
-		$mysoc->country_id=4;
261
-		$mysoc->localtax1_assuj=0;
262
-		$mysoc->localtax2_assuj=1;
259
+        $mysoc->country_code='ES';
260
+        $mysoc->country_id=4;
261
+        $mysoc->localtax1_assuj=0;
262
+        $mysoc->localtax2_assuj=1;
263 263
         $result2=calcul_price_total(10, -10, 0, 10, 0, 19, 0, 'HT', 0, 0);
264
-		print __METHOD__." result2=".join(', ',$result2)."\n";
265
-		// result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
266
-		$this->assertEquals(array(-100, -10, -110, -10, -1, -11, -100, -10, -110, 0, 0, 0, 0, 0, 0, 0, -100, -10, -110, -10, -1, -11, -100, -10, -110, 0, 0),$result2,'Test7 ES for product');
264
+        print __METHOD__." result2=".join(', ',$result2)."\n";
265
+        // result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
266
+        $this->assertEquals(array(-100, -10, -110, -10, -1, -11, -100, -10, -110, 0, 0, 0, 0, 0, 0, 0, -100, -10, -110, -10, -1, -11, -100, -10, -110, 0, 0),$result2,'Test7 ES for product');
267 267
 
268 268
         // Credit Note: 10 * -10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (other method autodetect), we provide a service and not a product
269
-		$mysoc->country_code='ES';
270
-		$mysoc->country_id=4;
271
-		$mysoc->localtax1_assuj=0;
272
-		$mysoc->localtax2_assuj=1;
269
+        $mysoc->country_code='ES';
270
+        $mysoc->country_id=4;
271
+        $mysoc->localtax1_assuj=0;
272
+        $mysoc->localtax2_assuj=1;
273 273
         $result2=calcul_price_total(10, -10, 0, 10, -1, -1, 0, 'HT', 0, 1);
274
-		print __METHOD__." result2=".join(', ',$result2)."\n";
275
-		$this->assertEquals(array(-100, -10, -91, -10, -1, -9.1, -100, -10, -91, 0, 19, 0, 1.90, 0, 0, 19, -100, -10, -91, -10, -1, -9.1, -100, -10, -91, 0, 19),$result2,'Test8 ES for service');
274
+        print __METHOD__." result2=".join(', ',$result2)."\n";
275
+        $this->assertEquals(array(-100, -10, -91, -10, -1, -9.1, -100, -10, -91, 0, 19, 0, 1.90, 0, 0, 19, -100, -10, -91, -10, -1, -9.1, -100, -10, -91, 0, 19),$result2,'Test8 ES for service');
276 276
 
277 277
 
278 278
         /*
@@ -280,23 +280,23 @@  discard block
 block discarded – undo
280 280
          */
281 281
 
282 282
         // 10 * 10 HT - 0% discount with 18% vat, seller using localtax1 type 2, not localtax2 (method we provide value)
283
-		$mysoc->country_code='CI';
284
-		$mysoc->country_id=21;
285
-		$mysoc->localtax1_assuj=1;
286
-		$mysoc->localtax2_assuj=0;
283
+        $mysoc->country_code='CI';
284
+        $mysoc->country_id=21;
285
+        $mysoc->localtax1_assuj=1;
286
+        $mysoc->localtax2_assuj=0;
287 287
         //$localtaxes=getLocalTaxesFromRate(18, 0, null, $mysoc);
288 288
         //var_dump($locataxes);
289
-		$result3=calcul_price_total(10, 10, 0, 18, 7.5, 0, 0, 'HT', 0, 0);	// 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
289
+        $result3=calcul_price_total(10, 10, 0, 18, 7.5, 0, 0, 'HT', 0, 0);	// 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
290 290
         print __METHOD__." result3=".join(', ',$result3)."\n";
291 291
         // result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
292 292
         $this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0, 100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0),$result3,'Test9 CI');
293 293
 
294 294
         // 10 * 10 HT - 0% discount with 18% vat, seller using localtax1 type 2, not localtax2 (other method autodetect)
295
-		$mysoc->country_code='CI';
296
-		$mysoc->country_id=21;
297
-		$mysoc->localtax1_assuj=1;
298
-		$mysoc->localtax2_assuj=0;
299
-		$result3=calcul_price_total(10, 10, 0, 18, -1, -1, 0, 'HT', 0, 0);	// 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
295
+        $mysoc->country_code='CI';
296
+        $mysoc->country_id=21;
297
+        $mysoc->localtax1_assuj=1;
298
+        $mysoc->localtax2_assuj=0;
299
+        $result3=calcul_price_total(10, 10, 0, 18, -1, -1, 0, 'HT', 0, 0);	// 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
300 300
         print __METHOD__." result3=".join(', ',$result3)."\n";
301 301
         // result[0,1,2,3,4,5,6,7,8]	(total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
302 302
         $this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0, 100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0),$result3,'Test10 CI');
@@ -313,17 +313,17 @@  discard block
 block discarded – undo
313 313
      */
314 314
     public function testUpdatePrice()
315 315
     {
316
-		//$this->sharedFixture
317
-		global $conf,$user,$langs,$db;
318
-		$this->savconf=$conf;
319
-		$this->savuser=$user;
320
-		$this->savlangs=$langs;
321
-		$this->savdb=$db;
316
+        //$this->sharedFixture
317
+        global $conf,$user,$langs,$db;
318
+        $this->savconf=$conf;
319
+        $this->savuser=$user;
320
+        $this->savlangs=$langs;
321
+        $this->savdb=$db;
322 322
 
323
-		$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
323
+        $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
324 324
 
325
-		// Two lines of 1.24 give 2.48 HT and 2.72 TTC with standard vat rounding mode
326
-		$localobject=new Facture($this->savdb);
325
+        // Two lines of 1.24 give 2.48 HT and 2.72 TTC with standard vat rounding mode
326
+        $localobject=new Facture($this->savdb);
327 327
         $localobject->initAsSpecimen('nolines');
328 328
         $invoiceid=$localobject->create($user);
329 329
 
Please login to merge, or discard this patch.
dolibarr/test/phpunit/XCalLibTest.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
      */
60 60
     function __construct()
61 61
     {
62
-    	parent::__construct();
62
+        parent::__construct();
63 63
 
64
-    	//$this->sharedFixture
64
+        //$this->sharedFixture
65 65
         global $conf,$user,$langs,$db;
66 66
         $this->savconf=$conf;
67 67
         $this->savuser=$user;
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      * End phpunit tests
111 111
      *
112 112
      * @return	void
113
-    */
113
+     */
114 114
     protected function tearDown()
115 115
     {
116 116
         print __METHOD__."\n";
Please login to merge, or discard this patch.
dolibarr/test/phpunit/DateLibTzFranceTest.php 1 patch
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
 if (empty($user->id))
33 33
 {
34
-	print "Load permissions for admin user nb 1\n";
35
-	$user->fetch(1);
36
-	$user->getrights();
34
+    print "Load permissions for admin user nb 1\n";
35
+    $user->fetch(1);
36
+    $user->getrights();
37 37
 }
38 38
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
39 39
 
@@ -47,79 +47,79 @@  discard block
 block discarded – undo
47 47
  */
48 48
 class DateLibTzFranceTest extends PHPUnit_Framework_TestCase
49 49
 {
50
-	protected $savconf;
51
-	protected $savuser;
52
-	protected $savlangs;
53
-	protected $savdb;
54
-
55
-	/**
56
-	 * Constructor
57
-	 * We save global variables into local variables
58
-	 *
59
-	 * @return DateLibTest
60
-	 */
61
-	function __construct()
62
-	{
63
-		parent::__construct();
64
-
65
-		//$this->sharedFixture
66
-		global $conf,$user,$langs,$db;
67
-		$this->savconf=$conf;
68
-		$this->savuser=$user;
69
-		$this->savlangs=$langs;
70
-		$this->savdb=$db;
71
-
72
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
-		//print " - db ".$db->db;
74
-		print "\n";
75
-	}
76
-
77
-	// Static methods
78
-  	public static function setUpBeforeClass()
50
+    protected $savconf;
51
+    protected $savuser;
52
+    protected $savlangs;
53
+    protected $savdb;
54
+
55
+    /**
56
+     * Constructor
57
+     * We save global variables into local variables
58
+     *
59
+     * @return DateLibTest
60
+     */
61
+    function __construct()
79 62
     {
80
-    	global $conf,$user,$langs,$db;
63
+        parent::__construct();
81 64
 
82
-    	if (getServerTimeZoneString() != 'Europe/Paris') {
83
-    		print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ+1 Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die();
84
-    	}
65
+        //$this->sharedFixture
66
+        global $conf,$user,$langs,$db;
67
+        $this->savconf=$conf;
68
+        $this->savuser=$user;
69
+        $this->savlangs=$langs;
70
+        $this->savdb=$db;
71
+
72
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
+        //print " - db ".$db->db;
74
+        print "\n";
75
+    }
85 76
 
86
-    	$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
77
+    // Static methods
78
+        public static function setUpBeforeClass()
79
+    {
80
+        global $conf,$user,$langs,$db;
81
+
82
+        if (getServerTimeZoneString() != 'Europe/Paris') {
83
+            print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ+1 Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die();
84
+        }
87 85
 
88
-    	print __METHOD__."\n";
86
+        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
87
+
88
+        print __METHOD__."\n";
89 89
     }
90 90
 
91 91
     // tear down after class
92 92
     public static function tearDownAfterClass()
93 93
     {
94
-    	global $conf,$user,$langs,$db;
95
-		$db->rollback();
94
+        global $conf,$user,$langs,$db;
95
+        $db->rollback();
96 96
 
97
-		print __METHOD__."\n";
97
+        print __METHOD__."\n";
98 98
     }
99 99
 
100
-	/**
101
-	 * Init phpunit tests
102
-	 *
103
-	 * @return	void
104
-	 */
100
+    /**
101
+     * Init phpunit tests
102
+     *
103
+     * @return	void
104
+     */
105 105
     protected function setUp()
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
-		print __METHOD__."\n";
113
+        print __METHOD__."\n";
114 114
     }
115
-	/**
116
-	 * End phpunit tests
117
-	 *
118
-	 * @return	void
119
-	 */
115
+    /**
116
+     * End phpunit tests
117
+     *
118
+     * @return	void
119
+     */
120 120
     protected function tearDown()
121 121
     {
122
-    	print __METHOD__."\n";
122
+        print __METHOD__."\n";
123 123
     }
124 124
 
125 125
     /**
@@ -139,66 +139,66 @@  discard block
 block discarded – undo
139 139
         $langs=$this->savlangs;
140 140
         $db=$this->savdb;
141 141
 
142
-    	// Check %Y-%m-%d %H:%M:%S format
142
+        // Check %Y-%m-%d %H:%M:%S format
143 143
         $result=dol_print_date(0,'%Y-%m-%d %H:%M:%S',false);
144
-       	print __METHOD__." result=".$result."\n";
145
-    	$this->assertEquals('1970-01-01 01:00:00',$result);
144
+            print __METHOD__." result=".$result."\n";
145
+        $this->assertEquals('1970-01-01 01:00:00',$result);
146 146
 
147
-    	// Check %Y-%m-%d %H:%M:%S format
147
+        // Check %Y-%m-%d %H:%M:%S format
148 148
         $result=dol_print_date(16725225600,'%Y-%m-%d %H:%M:%S',false);
149
-       	print __METHOD__." result=".$result."\n";
150
-    	$this->assertEquals('2500-01-01 01:00:00',$result);
151
-
152
-    	// Check %Y-%m-%d %H:%M:%S format
153
-    	$result=dol_print_date(-1830384000,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
154
-    	print __METHOD__." result=".$result."\n";
155
-    	$this->assertEquals('1912-01-01 01:00:00',$result);		// dol_print_date use a timezone, not epoch converter as it did not exists this year
156
-
157
-    	// Specific cas during war
158
-
159
-    	// 1940, no timezone
160
-    	$result=dol_print_date(-946771200,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
161
-    	print __METHOD__." result=".$result."\n";
162
-    	$this->assertEquals('1940-01-01 01:00:00',$result);		//  dol_print_date use a modern timezone, not epoch converter as it did not exists this year
163
-
164
-    	// 1941, timezone is added by germany to +2 (same for 1942)
165
-    	$result=dol_print_date(-915148800,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
166
-    	print __METHOD__." result=".$result."\n";
167
-    	$this->assertEquals('1941-01-01 01:00:00',$result);		// dol_print_date use a modern timezone, epoch converter use historic timezone
168
-
169
-    	// 1943, timezone is +1
170
-    	$result=dol_print_date(-852076800,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
171
-    	print __METHOD__." result=".$result."\n";
172
-    	$this->assertEquals('1943-01-01 01:00:00',$result);
173
-
174
-    	// test with negative timezone
175
-    	$result=dol_print_date(-1,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
176
-    	print __METHOD__." result=".$result."\n";
177
-    	$this->assertEquals('1970-01-01 00:59:59',$result);
178
-
179
-    	// Check dayhour format for fr_FR
180
-    	$outputlangs=new Translate('',$conf);
181
-    	$outputlangs->setDefaultLang('fr_FR');
182
-    	$outputlangs->load("main");
183
-
184
-    	$result=dol_print_date(0+24*3600,'dayhour',false,$outputlangs);
185
-    	print __METHOD__." result=".$result."\n";
186
-    	$this->assertEquals('02/01/1970 01:00',$result);
187
-
188
-    	// Check day format for en_US
189
-    	$outputlangs=new Translate('',$conf);
190
-    	$outputlangs->setDefaultLang('en_US');
191
-    	$outputlangs->load("main");
192
-
193
-    	$result=dol_print_date(0+24*3600,'day',false,$outputlangs);
194
-    	print __METHOD__." result=".$result."\n";
195
-    	$this->assertEquals('01/02/1970',$result);
196
-
197
-    	// Check %a and %b format for en_US
198
-    	$result=dol_print_date(0,'%a %b',false,$outputlangs);
199
-    	print __METHOD__." result=".$result."\n";
200
-    	$this->assertEquals('Thu Jan',$result);
201
-
202
-    	return $result;
149
+            print __METHOD__." result=".$result."\n";
150
+        $this->assertEquals('2500-01-01 01:00:00',$result);
151
+
152
+        // Check %Y-%m-%d %H:%M:%S format
153
+        $result=dol_print_date(-1830384000,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
154
+        print __METHOD__." result=".$result."\n";
155
+        $this->assertEquals('1912-01-01 01:00:00',$result);		// dol_print_date use a timezone, not epoch converter as it did not exists this year
156
+
157
+        // Specific cas during war
158
+
159
+        // 1940, no timezone
160
+        $result=dol_print_date(-946771200,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
161
+        print __METHOD__." result=".$result."\n";
162
+        $this->assertEquals('1940-01-01 01:00:00',$result);		//  dol_print_date use a modern timezone, not epoch converter as it did not exists this year
163
+
164
+        // 1941, timezone is added by germany to +2 (same for 1942)
165
+        $result=dol_print_date(-915148800,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
166
+        print __METHOD__." result=".$result."\n";
167
+        $this->assertEquals('1941-01-01 01:00:00',$result);		// dol_print_date use a modern timezone, epoch converter use historic timezone
168
+
169
+        // 1943, timezone is +1
170
+        $result=dol_print_date(-852076800,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
171
+        print __METHOD__." result=".$result."\n";
172
+        $this->assertEquals('1943-01-01 01:00:00',$result);
173
+
174
+        // test with negative timezone
175
+        $result=dol_print_date(-1,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
176
+        print __METHOD__." result=".$result."\n";
177
+        $this->assertEquals('1970-01-01 00:59:59',$result);
178
+
179
+        // Check dayhour format for fr_FR
180
+        $outputlangs=new Translate('',$conf);
181
+        $outputlangs->setDefaultLang('fr_FR');
182
+        $outputlangs->load("main");
183
+
184
+        $result=dol_print_date(0+24*3600,'dayhour',false,$outputlangs);
185
+        print __METHOD__." result=".$result."\n";
186
+        $this->assertEquals('02/01/1970 01:00',$result);
187
+
188
+        // Check day format for en_US
189
+        $outputlangs=new Translate('',$conf);
190
+        $outputlangs->setDefaultLang('en_US');
191
+        $outputlangs->load("main");
192
+
193
+        $result=dol_print_date(0+24*3600,'day',false,$outputlangs);
194
+        print __METHOD__." result=".$result."\n";
195
+        $this->assertEquals('01/02/1970',$result);
196
+
197
+        // Check %a and %b format for en_US
198
+        $result=dol_print_date(0,'%a %b',false,$outputlangs);
199
+        print __METHOD__." result=".$result."\n";
200
+        $this->assertEquals('Thu Jan',$result);
201
+
202
+        return $result;
203 203
     }
204 204
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/DateLibTest.php 1 patch
Indentation   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
 if (empty($user->id))
33 33
 {
34
-	print "Load permissions for admin user nb 1\n";
35
-	$user->fetch(1);
36
-	$user->getrights();
34
+    print "Load permissions for admin user nb 1\n";
35
+    $user->fetch(1);
36
+    $user->getrights();
37 37
 }
38 38
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
39 39
 
@@ -47,74 +47,74 @@  discard block
 block discarded – undo
47 47
  */
48 48
 class DateLibTest extends PHPUnit_Framework_TestCase
49 49
 {
50
-	protected $savconf;
51
-	protected $savuser;
52
-	protected $savlangs;
53
-	protected $savdb;
54
-
55
-	/**
56
-	 * Constructor
57
-	 * We save global variables into local variables
58
-	 *
59
-	 * @return DateLibTest
60
-	 */
61
-	function __construct()
62
-	{
63
-		parent::__construct();
64
-
65
-		//$this->sharedFixture
66
-		global $conf,$user,$langs,$db;
67
-		$this->savconf=$conf;
68
-		$this->savuser=$user;
69
-		$this->savlangs=$langs;
70
-		$this->savdb=$db;
71
-
72
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
-		//print " - db ".$db->db;
74
-		print "\n";
75
-	}
76
-
77
-	// Static methods
78
-  	public static function setUpBeforeClass()
50
+    protected $savconf;
51
+    protected $savuser;
52
+    protected $savlangs;
53
+    protected $savdb;
54
+
55
+    /**
56
+     * Constructor
57
+     * We save global variables into local variables
58
+     *
59
+     * @return DateLibTest
60
+     */
61
+    function __construct()
79 62
     {
80
-    	global $conf,$user,$langs,$db;
81
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
63
+        parent::__construct();
82 64
 
83
-    	print __METHOD__."\n";
65
+        //$this->sharedFixture
66
+        global $conf,$user,$langs,$db;
67
+        $this->savconf=$conf;
68
+        $this->savuser=$user;
69
+        $this->savlangs=$langs;
70
+        $this->savdb=$db;
71
+
72
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
+        //print " - db ".$db->db;
74
+        print "\n";
75
+    }
76
+
77
+    // Static methods
78
+        public static function setUpBeforeClass()
79
+    {
80
+        global $conf,$user,$langs,$db;
81
+        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
82
+
83
+        print __METHOD__."\n";
84 84
     }
85 85
 
86 86
     // tear down after class
87 87
     public static function tearDownAfterClass()
88 88
     {
89
-    	global $conf,$user,$langs,$db;
90
-		$db->rollback();
89
+        global $conf,$user,$langs,$db;
90
+        $db->rollback();
91 91
 
92
-		print __METHOD__."\n";
92
+        print __METHOD__."\n";
93 93
     }
94 94
 
95
-	/**
96
-	 * Init phpunit tests
97
-	 *
98
-	 * @return	void
99
-	 */
95
+    /**
96
+     * Init phpunit tests
97
+     *
98
+     * @return	void
99
+     */
100 100
     protected function setUp()
101 101
     {
102
-    	global $conf,$user,$langs,$db;
103
-		$conf=$this->savconf;
104
-		$user=$this->savuser;
105
-		$langs=$this->savlangs;
106
-		$db=$this->savdb;
102
+        global $conf,$user,$langs,$db;
103
+        $conf=$this->savconf;
104
+        $user=$this->savuser;
105
+        $langs=$this->savlangs;
106
+        $db=$this->savdb;
107 107
 
108
-		print __METHOD__."\n";
108
+        print __METHOD__."\n";
109 109
     }
110
-	/**
111
-	 * End phpunit tests
112
-	 *
113
-	 * @return	void
114
-	 */
110
+    /**
111
+     * End phpunit tests
112
+     *
113
+     * @return	void
114
+     */
115 115
     protected function tearDown()
116 116
     {
117
-    	print __METHOD__."\n";
117
+        print __METHOD__."\n";
118 118
     }
119 119
 
120 120
     /**
@@ -124,49 +124,49 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function testNumBetweenDay()
126 126
     {
127
-    	global $conf,$user,$langs,$db;
128
-		$conf=$this->savconf;
129
-		$user=$this->savuser;
130
-		$langs=$this->savlangs;
131
-		$db=$this->savdb;
127
+        global $conf,$user,$langs,$db;
128
+        $conf=$this->savconf;
129
+        $user=$this->savuser;
130
+        $langs=$this->savlangs;
131
+        $db=$this->savdb;
132 132
 
133
-		// With same hours
134
-		$date1=dol_mktime(0, 0, 0, 1, 1, 2012);
135
-		$date2=dol_mktime(0, 0, 0, 1, 2, 2012);
133
+        // With same hours
134
+        $date1=dol_mktime(0, 0, 0, 1, 1, 2012);
135
+        $date2=dol_mktime(0, 0, 0, 1, 2, 2012);
136 136
 
137
-		$result=num_between_day($date1,$date2,1);
138
-    	print __METHOD__." result=".$result."\n";
139
-		$this->assertEquals(2,$result);
137
+        $result=num_between_day($date1,$date2,1);
138
+        print __METHOD__." result=".$result."\n";
139
+        $this->assertEquals(2,$result);
140 140
 
141
-		$result=num_between_day($date1,$date2,0);
142
-    	print __METHOD__." result=".$result."\n";
143
-		$this->assertEquals(1,$result);
141
+        $result=num_between_day($date1,$date2,0);
142
+        print __METHOD__." result=".$result."\n";
143
+        $this->assertEquals(1,$result);
144 144
 
145
-		// With different hours
146
-		$date1=dol_mktime(0, 0, 0, 1, 1, 2012);
147
-		$date2=dol_mktime(12, 0, 0, 1, 2, 2012);
145
+        // With different hours
146
+        $date1=dol_mktime(0, 0, 0, 1, 1, 2012);
147
+        $date2=dol_mktime(12, 0, 0, 1, 2, 2012);
148 148
 
149
-		$result=num_between_day($date1,$date2,1);
150
-    	print __METHOD__." result=".$result."\n";
151
-		$this->assertEquals(2,$result);
149
+        $result=num_between_day($date1,$date2,1);
150
+        print __METHOD__." result=".$result."\n";
151
+        $this->assertEquals(2,$result);
152 152
 
153
-		$result=num_between_day($date1,$date2,0);
154
-    	print __METHOD__." result=".$result."\n";
155
-		$this->assertEquals(1,$result);
153
+        $result=num_between_day($date1,$date2,0);
154
+        print __METHOD__." result=".$result."\n";
155
+        $this->assertEquals(1,$result);
156 156
 
157
-		// With different date before and after sunlight hour (day to change sunlight hour is 2014-03-30)
158
-		$date1=dol_mktime(0, 0, 0, 3, 28, 2014, true);
159
-		$date2=dol_mktime(0, 0, 0, 3, 31, 2014, true);
157
+        // With different date before and after sunlight hour (day to change sunlight hour is 2014-03-30)
158
+        $date1=dol_mktime(0, 0, 0, 3, 28, 2014, true);
159
+        $date2=dol_mktime(0, 0, 0, 3, 31, 2014, true);
160 160
 
161
-		$result=num_between_day($date1,$date2,1);
162
-    	print __METHOD__." result=".$result."\n";
163
-		$this->assertEquals(4,$result);
161
+        $result=num_between_day($date1,$date2,1);
162
+        print __METHOD__." result=".$result."\n";
163
+        $this->assertEquals(4,$result);
164 164
 
165
-		$result=num_between_day($date1,$date2,0);
166
-    	print __METHOD__." result=".$result."\n";
167
-		$this->assertEquals(3,$result);
165
+        $result=num_between_day($date1,$date2,0);
166
+        print __METHOD__." result=".$result."\n";
167
+        $this->assertEquals(3,$result);
168 168
 
169
-		return $result;
169
+        return $result;
170 170
     }
171 171
 
172 172
     /**
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
      */
273 273
     public function testConvertTime2Seconds()
274 274
     {
275
-    	global $conf,$user,$langs,$db;
276
-		$conf=$this->savconf;
277
-		$user=$this->savuser;
278
-		$langs=$this->savlangs;
279
-		$db=$this->savdb;
275
+        global $conf,$user,$langs,$db;
276
+        $conf=$this->savconf;
277
+        $user=$this->savuser;
278
+        $langs=$this->savlangs;
279
+        $db=$this->savdb;
280 280
 
281
-		$result=convertTime2Seconds(1,1,2);
282
-    	print __METHOD__." result=".$result."\n";
283
-		$this->assertEquals(3662,$result);
281
+        $result=convertTime2Seconds(1,1,2);
282
+        print __METHOD__." result=".$result."\n";
283
+        $this->assertEquals(3662,$result);
284 284
 
285
-		return $result;
285
+        return $result;
286 286
     }
287 287
 
288 288
     /**
@@ -292,22 +292,22 @@  discard block
 block discarded – undo
292 292
      */
293 293
     public function testConvertSecondToTime()
294 294
     {
295
-    	global $conf,$user,$langs,$db;
296
-		$conf=$this->savconf;
297
-		$user=$this->savuser;
298
-		$langs=$this->savlangs;
299
-		$db=$this->savdb;
295
+        global $conf,$user,$langs,$db;
296
+        $conf=$this->savconf;
297
+        $user=$this->savuser;
298
+        $langs=$this->savlangs;
299
+        $db=$this->savdb;
300 300
 
301
-		$result=convertSecondToTime(0,'all',86400);
302
-    	print __METHOD__." result=".$result."\n";
303
-		$this->assertEquals('0',$result);
301
+        $result=convertSecondToTime(0,'all',86400);
302
+        print __METHOD__." result=".$result."\n";
303
+        $this->assertEquals('0',$result);
304 304
 
305
-		$result=convertSecondToTime(86400,'all',86400);
306
-    	print __METHOD__." result=".$result."\n";
307
-		$this->assertSame('1 '.$langs->trans("Day"),$result);
305
+        $result=convertSecondToTime(86400,'all',86400);
306
+        print __METHOD__." result=".$result."\n";
307
+        $this->assertSame('1 '.$langs->trans("Day"),$result);
308 308
 
309 309
 
310
-		return $result;
310
+        return $result;
311 311
     }
312 312
 
313 313
     /**
@@ -323,60 +323,60 @@  discard block
 block discarded – undo
323 323
         $langs=$this->savlangs;
324 324
         $db=$this->savdb;
325 325
 
326
-    	// Check %Y-%m-%d %H:%M:%S format
326
+        // Check %Y-%m-%d %H:%M:%S format
327 327
         $result=dol_print_date(0,'%Y-%m-%d %H:%M:%S',true);
328
-       	print __METHOD__." result=".$result."\n";
329
-    	$this->assertEquals('1970-01-01 00:00:00',$result);
330
-
331
-    	// Check %Y-%m-%d %H:%M:%S format
332
-    	$result=dol_print_date(16725225600,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
333
-    	print __METHOD__." result=".$result."\n";
334
-    	$this->assertEquals('2500-01-01 00:00:00',$result);
335
-
336
-    	// Check %Y-%m-%d %H:%M:%S format
337
-    	$result=dol_print_date(-1830384000,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
338
-    	print __METHOD__." result=".$result."\n";
339
-    	$this->assertEquals('1912-01-01 00:00:00',$result);	// dol_print_date use TZ (good) but epoch converter does not use it.
340
-
341
-    	// Check %Y-%m-%d %H:%M:%S format
342
-    	$result=dol_print_date(-11676096000,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
343
-    	print __METHOD__." result=".$result."\n";
344
-    	$this->assertEquals('1600-01-01 00:00:00',$result);
345
-
346
-    	// test with negative timezone
347
-    	$result=dol_print_date(-1,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
348
-    	print __METHOD__." result=".$result."\n";
349
-    	$this->assertEquals('1969-12-31 23:59:59',$result);
350
-
351
-    	// Check dayhour format for fr_FR
352
-    	$outputlangs=new Translate('',$conf);
353
-    	$outputlangs->setDefaultLang('fr_FR');
354
-    	$outputlangs->load("main");
355
-
356
-    	$result=dol_print_date(0+24*3600,'dayhour',true,$outputlangs);
357
-    	print __METHOD__." result=".$result."\n";
358
-    	$this->assertEquals('02/01/1970 00:00',$result);
359
-
360
-    	// Check %a and %b format for fr_FR
361
-    	$result=dol_print_date(0,'%a %b %B',true,$outputlangs);
362
-    	print __METHOD__." result=".$result."\n";
363
-    	$this->assertEquals('Jeu Jan. Janvier',$result);
364
-
365
-    	// Check day format for en_US
366
-    	$outputlangs=new Translate('',$conf);
367
-    	$outputlangs->setDefaultLang('en_US');
368
-    	$outputlangs->load("main");
369
-
370
-    	$result=dol_print_date(0+24*3600,'day',true,$outputlangs);
371
-    	print __METHOD__." result=".$result."\n";
372
-    	$this->assertEquals('01/02/1970',$result);
373
-
374
-    	// Check %a and %b format for en_US
375
-    	$result=dol_print_date(0,'%a %b %B',true,$outputlangs);
376
-    	print __METHOD__." result=".$result."\n";
377
-    	$this->assertEquals('Thu Jan January',$result);
378
-
379
-    	return $result;
328
+            print __METHOD__." result=".$result."\n";
329
+        $this->assertEquals('1970-01-01 00:00:00',$result);
330
+
331
+        // Check %Y-%m-%d %H:%M:%S format
332
+        $result=dol_print_date(16725225600,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
333
+        print __METHOD__." result=".$result."\n";
334
+        $this->assertEquals('2500-01-01 00:00:00',$result);
335
+
336
+        // Check %Y-%m-%d %H:%M:%S format
337
+        $result=dol_print_date(-1830384000,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
338
+        print __METHOD__." result=".$result."\n";
339
+        $this->assertEquals('1912-01-01 00:00:00',$result);	// dol_print_date use TZ (good) but epoch converter does not use it.
340
+
341
+        // Check %Y-%m-%d %H:%M:%S format
342
+        $result=dol_print_date(-11676096000,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
343
+        print __METHOD__." result=".$result."\n";
344
+        $this->assertEquals('1600-01-01 00:00:00',$result);
345
+
346
+        // test with negative timezone
347
+        $result=dol_print_date(-1,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
348
+        print __METHOD__." result=".$result."\n";
349
+        $this->assertEquals('1969-12-31 23:59:59',$result);
350
+
351
+        // Check dayhour format for fr_FR
352
+        $outputlangs=new Translate('',$conf);
353
+        $outputlangs->setDefaultLang('fr_FR');
354
+        $outputlangs->load("main");
355
+
356
+        $result=dol_print_date(0+24*3600,'dayhour',true,$outputlangs);
357
+        print __METHOD__." result=".$result."\n";
358
+        $this->assertEquals('02/01/1970 00:00',$result);
359
+
360
+        // Check %a and %b format for fr_FR
361
+        $result=dol_print_date(0,'%a %b %B',true,$outputlangs);
362
+        print __METHOD__." result=".$result."\n";
363
+        $this->assertEquals('Jeu Jan. Janvier',$result);
364
+
365
+        // Check day format for en_US
366
+        $outputlangs=new Translate('',$conf);
367
+        $outputlangs->setDefaultLang('en_US');
368
+        $outputlangs->load("main");
369
+
370
+        $result=dol_print_date(0+24*3600,'day',true,$outputlangs);
371
+        print __METHOD__." result=".$result."\n";
372
+        $this->assertEquals('01/02/1970',$result);
373
+
374
+        // Check %a and %b format for en_US
375
+        $result=dol_print_date(0,'%a %b %B',true,$outputlangs);
376
+        print __METHOD__." result=".$result."\n";
377
+        $this->assertEquals('Thu Jan January',$result);
378
+
379
+        return $result;
380 380
     }
381 381
 
382 382
     /**
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
         $outputlangs->load("main");
399 399
 
400 400
         $result=dol_print_date(dol_time_plus_duree(dol_time_plus_duree(dol_time_plus_duree(0,1,'m'),1,'y'),1,'d'),'dayhour',true,$outputlangs);
401
-       	print __METHOD__." result=".$result."\n";
402
-    	$this->assertEquals('02/02/1971 00:00',$result);
401
+            print __METHOD__." result=".$result."\n";
402
+        $this->assertEquals('02/02/1971 00:00',$result);
403 403
 
404
-    	return $result;
404
+        return $result;
405 405
     }
406 406
 
407 407
     /**
@@ -417,30 +417,30 @@  discard block
 block discarded – undo
417 417
         $langs=$this->savlangs;
418 418
         $db=$this->savdb;
419 419
 
420
-		$stime='19700102';
421
-		$result=dol_stringtotime($stime);
422
-		print __METHOD__." result=".$result."\n";
423
-		$this->assertEquals(86400,$result);
420
+        $stime='19700102';
421
+        $result=dol_stringtotime($stime);
422
+        print __METHOD__." result=".$result."\n";
423
+        $this->assertEquals(86400,$result);
424 424
 
425
-		$stime='1970-01-01T02:00:00Z';
425
+        $stime='1970-01-01T02:00:00Z';
426 426
         $result=dol_stringtotime($stime);
427
-    	print __METHOD__." result=".$result."\n";
428
-		$this->assertEquals(7200,$result);
427
+        print __METHOD__." result=".$result."\n";
428
+        $this->assertEquals(7200,$result);
429 429
 
430 430
         $stime='1970-01-01 02:00:00';
431 431
         $result=dol_stringtotime($stime);
432
-    	print __METHOD__." result=".$result."\n";
433
-		$this->assertEquals(7200,$result);
432
+        print __METHOD__." result=".$result."\n";
433
+        $this->assertEquals(7200,$result);
434 434
 
435 435
         $stime='19700101T020000Z';
436 436
         $result=dol_stringtotime($stime);
437
-    	print __METHOD__." result=".$result."\n";
438
-		$this->assertEquals(7200,$result);
437
+        print __METHOD__." result=".$result."\n";
438
+        $this->assertEquals(7200,$result);
439 439
 
440
-		$stime='19700101020000';
441
-		$result=dol_stringtotime($stime);
442
-		print __METHOD__." result=".$result."\n";
443
-		$this->assertEquals(7200,$result);
440
+        $stime='19700101020000';
441
+        $result=dol_stringtotime($stime);
442
+        print __METHOD__." result=".$result."\n";
443
+        $this->assertEquals(7200,$result);
444 444
 
445 445
         return $result;
446 446
     }
@@ -452,16 +452,16 @@  discard block
 block discarded – undo
452 452
      */
453 453
     public function testDolGetFirstDayWeek()
454 454
     {
455
-    	global $conf;
455
+        global $conf;
456 456
 
457
-    	$day=3; $month=2; $year=2015;
458
-    	$conf->global->MAIN_START_WEEK = 1;	// start on monday
459
-   		$prev = dol_get_first_day_week($day, $month, $year);
460
-		$this->assertEquals(2, (int) $prev['first_day']);		// monday for month 2, year 2014 is the 2
457
+        $day=3; $month=2; $year=2015;
458
+        $conf->global->MAIN_START_WEEK = 1;	// start on monday
459
+            $prev = dol_get_first_day_week($day, $month, $year);
460
+        $this->assertEquals(2, (int) $prev['first_day']);		// monday for month 2, year 2014 is the 2
461 461
 
462
-    	$day=3; $month=2; $year=2015;
463
-    	$conf->global->MAIN_START_WEEK = 0;	// start on sunday
464
-   		$prev = dol_get_first_day_week($day, $month, $year);
465
-		$this->assertEquals(1, (int) $prev['first_day']);		// sunday for month 2, year 2015 is the 1st
462
+        $day=3; $month=2; $year=2015;
463
+        $conf->global->MAIN_START_WEEK = 0;	// start on sunday
464
+            $prev = dol_get_first_day_week($day, $month, $year);
465
+        $this->assertEquals(1, (int) $prev['first_day']);		// sunday for month 2, year 2015 is the 1st
466 466
     }
467 467
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/EntrepotTest.php 1 patch
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
 if (empty($user->id))
33 33
 {
34
-	print "Load permissions for admin user nb 1\n";
35
-	$user->fetch(1);
36
-	$user->getrights();
34
+    print "Load permissions for admin user nb 1\n";
35
+    $user->fetch(1);
36
+    $user->getrights();
37 37
 }
38 38
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
39 39
 
@@ -47,78 +47,78 @@  discard block
 block discarded – undo
47 47
  */
48 48
 class EntrepotTest extends PHPUnit_Framework_TestCase
49 49
 {
50
-	protected $savconf;
51
-	protected $savuser;
52
-	protected $savlangs;
53
-	protected $savdb;
54
-
55
-	/**
56
-	 * Constructor
57
-	 * We save global variables into local variables
58
-	 *
59
-	 * @return EntrepotTest
60
-	 */
61
-	function __construct()
62
-	{
63
-		parent::__construct();
64
-
65
-		//$this->sharedFixture
66
-		global $conf,$user,$langs,$db;
67
-		$this->savconf=$conf;
68
-		$this->savuser=$user;
69
-		$this->savlangs=$langs;
70
-		$this->savdb=$db;
71
-
72
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
-		//print " - db ".$db->db;
74
-		print "\n";
75
-	}
76
-
77
-	// Static methods
78
-  	public static function setUpBeforeClass()
50
+    protected $savconf;
51
+    protected $savuser;
52
+    protected $savlangs;
53
+    protected $savdb;
54
+
55
+    /**
56
+     * Constructor
57
+     * We save global variables into local variables
58
+     *
59
+     * @return EntrepotTest
60
+     */
61
+    function __construct()
62
+    {
63
+        parent::__construct();
64
+
65
+        //$this->sharedFixture
66
+        global $conf,$user,$langs,$db;
67
+        $this->savconf=$conf;
68
+        $this->savuser=$user;
69
+        $this->savlangs=$langs;
70
+        $this->savdb=$db;
71
+
72
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
+        //print " - db ".$db->db;
74
+        print "\n";
75
+    }
76
+
77
+    // Static methods
78
+        public static function setUpBeforeClass()
79 79
     {
80
-    	global $conf,$user,$langs,$db;
80
+        global $conf,$user,$langs,$db;
81 81
 
82
-    	if (empty($conf->stock->enabled)) { print __METHOD__." Module Stock must be enabled.\n"; die(); }
82
+        if (empty($conf->stock->enabled)) { print __METHOD__." Module Stock must be enabled.\n"; die(); }
83 83
 
84 84
         $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
85 85
 
86
-    	print __METHOD__."\n";
86
+        print __METHOD__."\n";
87 87
     }
88 88
 
89 89
     // tear down after class
90 90
     public static function tearDownAfterClass()
91 91
     {
92
-    	global $conf,$user,$langs,$db;
93
-		$db->rollback();
92
+        global $conf,$user,$langs,$db;
93
+        $db->rollback();
94 94
 
95
-		print __METHOD__."\n";
95
+        print __METHOD__."\n";
96 96
     }
97 97
 
98
-	/**
99
-	 * Init phpunit tests
100
-	 *
101
-	 * @return	void
102
-	 */
98
+    /**
99
+     * Init phpunit tests
100
+     *
101
+     * @return	void
102
+     */
103 103
     protected function setUp()
104 104
     {
105
-    	global $conf,$user,$langs,$db;
106
-		$conf=$this->savconf;
107
-		$user=$this->savuser;
108
-		$langs=$this->savlangs;
109
-		$db=$this->savdb;
105
+        global $conf,$user,$langs,$db;
106
+        $conf=$this->savconf;
107
+        $user=$this->savuser;
108
+        $langs=$this->savlangs;
109
+        $db=$this->savdb;
110 110
 
111
-		print __METHOD__."\n";
111
+        print __METHOD__."\n";
112 112
     }
113 113
 
114
-	/**
115
-	 * End phpunit tests
116
-	 *
117
-	 * @return	void
118
-	 */
114
+    /**
115
+     * End phpunit tests
116
+     *
117
+     * @return	void
118
+     */
119 119
     protected function tearDown()
120 120
     {
121
-    	print __METHOD__."\n";
121
+        print __METHOD__."\n";
122 122
     }
123 123
 
124 124
     /**
@@ -128,20 +128,20 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function testEntrepotCreate()
130 130
     {
131
-    	global $conf,$user,$langs,$db;
132
-		$conf=$this->savconf;
133
-		$user=$this->savuser;
134
-		$langs=$this->savlangs;
135
-		$db=$this->savdb;
131
+        global $conf,$user,$langs,$db;
132
+        $conf=$this->savconf;
133
+        $user=$this->savuser;
134
+        $langs=$this->savlangs;
135
+        $db=$this->savdb;
136 136
 
137
-		$localobject=new Entrepot($this->savdb);
138
-    	$localobject->initAsSpecimen();
139
-    	$result=$localobject->create($user);
137
+        $localobject=new Entrepot($this->savdb);
138
+        $localobject->initAsSpecimen();
139
+        $result=$localobject->create($user);
140 140
 
141 141
         print __METHOD__." result=".$result."\n";
142
-    	$this->assertLessThanOrEqual($result, 0);
142
+        $this->assertLessThanOrEqual($result, 0);
143 143
 
144
-    	return $result;
144
+        return $result;
145 145
     }
146 146
 
147 147
     /**
@@ -155,18 +155,18 @@  discard block
 block discarded – undo
155 155
      */
156 156
     public function testEntrepotFetch($id)
157 157
     {
158
-    	global $conf,$user,$langs,$db;
159
-		$conf=$this->savconf;
160
-		$user=$this->savuser;
161
-		$langs=$this->savlangs;
162
-		$db=$this->savdb;
163
-
164
-		$localobject=new Entrepot($this->savdb);
165
-    	$result=$localobject->fetch($id);
158
+        global $conf,$user,$langs,$db;
159
+        $conf=$this->savconf;
160
+        $user=$this->savuser;
161
+        $langs=$this->savlangs;
162
+        $db=$this->savdb;
163
+
164
+        $localobject=new Entrepot($this->savdb);
165
+        $result=$localobject->fetch($id);
166 166
         print __METHOD__." id=".$id." result=".$result."\n";
167
-    	$this->assertLessThan($result, 0);
167
+        $this->assertLessThan($result, 0);
168 168
 
169
-    	return $localobject;
169
+        return $localobject;
170 170
     }
171 171
 
172 172
     /**
@@ -180,18 +180,18 @@  discard block
 block discarded – undo
180 180
      */
181 181
     public function testEntrepotUpdate($localobject)
182 182
     {
183
-    	global $conf,$user,$langs,$db;
184
-		$conf=$this->savconf;
185
-		$user=$this->savuser;
186
-		$langs=$this->savlangs;
187
-		$db=$this->savdb;
188
-
189
-		$localobject->note='New note after update';
190
-    	$result=$localobject->update($localobject->id,$user);
191
-    	print __METHOD__." id=".$localobject->id." result=".$result."\n";
192
-    	$this->assertLessThan($result, 0);
193
-
194
-    	return $localobject;
183
+        global $conf,$user,$langs,$db;
184
+        $conf=$this->savconf;
185
+        $user=$this->savuser;
186
+        $langs=$this->savlangs;
187
+        $db=$this->savdb;
188
+
189
+        $localobject->note='New note after update';
190
+        $result=$localobject->update($localobject->id,$user);
191
+        print __METHOD__." id=".$localobject->id." result=".$result."\n";
192
+        $this->assertLessThan($result, 0);
193
+
194
+        return $localobject;
195 195
     }
196 196
 
197 197
     /**
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function testEntrepotOther($localobject)
207 207
     {
208
-    	global $conf,$user,$langs,$db;
209
-		$conf=$this->savconf;
210
-		$user=$this->savuser;
211
-		$langs=$this->savlangs;
212
-		$db=$this->savdb;
208
+        global $conf,$user,$langs,$db;
209
+        $conf=$this->savconf;
210
+        $user=$this->savuser;
211
+        $langs=$this->savlangs;
212
+        $db=$this->savdb;
213 213
 
214 214
 
215 215
         return $localobject->id;
@@ -226,20 +226,20 @@  discard block
 block discarded – undo
226 226
      */
227 227
     public function testEntrepotDelete($id)
228 228
     {
229
-    	global $conf,$user,$langs,$db;
230
-		$conf=$this->savconf;
231
-		$user=$this->savuser;
232
-		$langs=$this->savlangs;
233
-		$db=$this->savdb;
229
+        global $conf,$user,$langs,$db;
230
+        $conf=$this->savconf;
231
+        $user=$this->savuser;
232
+        $langs=$this->savlangs;
233
+        $db=$this->savdb;
234 234
 
235
-		$localobject=new Entrepot($this->savdb);
236
-    	$result=$localobject->fetch($id);
235
+        $localobject=new Entrepot($this->savdb);
236
+        $result=$localobject->fetch($id);
237 237
 
238
-    	$result=$localobject->delete($user);
239
-		print __METHOD__." id=".$id." result=".$result."\n";
240
-    	$this->assertLessThan($result, 0);
238
+        $result=$localobject->delete($user);
239
+        print __METHOD__." id=".$id." result=".$result."\n";
240
+        $this->assertLessThan($result, 0);
241 241
 
242
-    	return $result;
242
+        return $result;
243 243
     }
244 244
 
245 245
     /**
Please login to merge, or discard this patch.
dolibarr/test/phpunit/SocieteTest.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
      */
61 61
     function __construct()
62 62
     {
63
-    	parent::__construct();
63
+        parent::__construct();
64 64
 
65
-    	//$this->sharedFixture
65
+        //$this->sharedFixture
66 66
         global $conf,$user,$langs,$db;
67 67
         $this->savconf=$conf;
68 68
         $this->savuser=$user;
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
      *
181 181
      * @param   Societe $localobject    Company
182 182
      * @return  Societe $localobject    Company
183
-    *
183
+     *
184 184
      * @depends testSocieteFetch
185 185
      * The depends says test is run only if previous is ok
186 186
      */
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
214 214
         $this->assertLessThan($result, 0);
215 215
 
216
-		$result=$localobject->update_note($localobject->note_private,'_private');
217
-		print __METHOD__." id=".$localobject->id." result=".$result."\n";
218
-		$this->assertLessThan($result, 0, 'Holiday::update_note (private) error');
216
+        $result=$localobject->update_note($localobject->note_private,'_private');
217
+        print __METHOD__." id=".$localobject->id." result=".$result."\n";
218
+        $this->assertLessThan($result, 0, 'Holiday::update_note (private) error');
219 219
 
220
-		$result=$localobject->update_note($localobject->note_public, '_public');
221
-		print __METHOD__." id=".$localobject->id." result=".$result."\n";
222
-		$this->assertLessThan($result, 0, 'Holiday::update_note (public) error');
220
+        $result=$localobject->update_note($localobject->note_public, '_public');
221
+        print __METHOD__." id=".$localobject->id." result=".$result."\n";
222
+        $this->assertLessThan($result, 0, 'Holiday::update_note (public) error');
223 223
 
224 224
         $newobject=new Societe($this->savdb);
225 225
         $result=$newobject->fetch($localobject->id);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/WebservicesThirdpartyTest.php 1 patch
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
      */
71 71
     function __construct()
72 72
     {
73
-    	parent::__construct();
73
+        parent::__construct();
74 74
 
75
-    	//$this->sharedFixture
75
+        //$this->sharedFixture
76 76
         global $conf,$user,$langs,$db;
77 77
         $this->savconf=$conf;
78 78
         $this->savuser=$user;
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
         print __METHOD__." create nusoap_client for URL=".$this->_WS_DOL_URL."\n";
86 86
         $this->soapclient = new nusoap_client($this->_WS_DOL_URL);
87 87
         if ($this->soapclient) {
88
-        	$this->soapclient->soap_defencoding='UTF-8';
89
-        	$this->soapclient->decodeUTF8(false);
88
+            $this->soapclient->soap_defencoding='UTF-8';
89
+            $this->soapclient->decodeUTF8(false);
90 90
         }
91 91
 
92 92
         print __METHOD__." db->type=".$db->type." user->id=".$user->id;
@@ -145,86 +145,86 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function testWSThirdpartycreateThirdParty()
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
-    	$WS_METHOD  = 'createThirdParty';
155
-
156
-
157
-    	// Call the WebService method and store its result in $result.
158
-    	$authentication=array(
159
-    			'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
160
-    			'sourceapplication'=>'DEMO',
161
-    			'login'=>'admin',
162
-    			'password'=>'admin',
163
-    			'entity'=>'');
164
-
165
-    	$body = array (
166
-    			"id" => null,
167
-    			"ref" => "name",
168
-    			"ref_ext" => "12",
169
-    			"fk_user_author" => null,
170
-    			"status" => null,
171
-    			"client" => 1,
172
-    			"supplier" => 0,
173
-    			"customer_code" => "CU0901-5678",
174
-    			"supplier_code" => "SU0901-5678",
175
-    			"customer_code_accountancy" => "",
176
-    			"supplier_code_accountancy" => "",
177
-    			"date_creation" => "", // dateTime
178
-    			"date_modification" => "", // dateTime
179
-    			"note_private" => "",
180
-    			"note_public" => "",
181
-    			"address" => "",
182
-    			"zip" => "",
183
-    			"town" => "",
184
-    			"province_id" => "",
185
-    			"country_id" => "",
186
-    			"country_code" => "",
187
-    			"country" => "",
188
-    			"phone" => "",
189
-    			"fax" => "",
190
-    			"email" => "",
191
-    			"url" => "",
192
-    			"profid1" => "",
193
-    			"profid2" => "",
194
-    			"profid3" => "",
195
-    			"profid4" => "",
196
-    			"profid5" => "",
197
-    			"profid6" => "",
198
-    			"capital" => "",
199
-    			"vat_used" => "",
200
-    			"vat_number" => ""
201
-    	);
202
-
203
-    	// Test URL
204
-    	$result='';
205
-    	$parameters = array('authentication'=>$authentication, 'thirdparty'=>$body);
206
-    	print __METHOD__." call method ".$WS_METHOD."\n";
207
-    	try {
208
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,'');
209
-    	} catch(SoapFault $exception) {
210
-    		echo $exception;
211
-    		$result=0;
212
-    	}
213
-    	if (! $result || ! empty($result['faultstring'])) {
214
-    		//var_dump($soapclient);
215
-    		print $this->soapclient->error_str;
216
-    		print "\n<br>\n";
217
-    		print $this->soapclient->request;
218
-    		print "\n<br>\n";
219
-    		print $this->soapclient->response;
220
-    		print "\n";
221
-    	}
222
-
223
-    	print __METHOD__." result=".$result['result']['result_code']."\n";
224
-    	$this->assertEquals('OK',$result['result']['result_code']);
225
-    	$this->assertEquals('name',$result['ref']);
226
-
227
-    	return $result;
148
+        global $conf,$user,$langs,$db;
149
+        $conf=$this->savconf;
150
+        $user=$this->savuser;
151
+        $langs=$this->savlangs;
152
+        $db=$this->savdb;
153
+
154
+        $WS_METHOD  = 'createThirdParty';
155
+
156
+
157
+        // Call the WebService method and store its result in $result.
158
+        $authentication=array(
159
+                'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
160
+                'sourceapplication'=>'DEMO',
161
+                'login'=>'admin',
162
+                'password'=>'admin',
163
+                'entity'=>'');
164
+
165
+        $body = array (
166
+                "id" => null,
167
+                "ref" => "name",
168
+                "ref_ext" => "12",
169
+                "fk_user_author" => null,
170
+                "status" => null,
171
+                "client" => 1,
172
+                "supplier" => 0,
173
+                "customer_code" => "CU0901-5678",
174
+                "supplier_code" => "SU0901-5678",
175
+                "customer_code_accountancy" => "",
176
+                "supplier_code_accountancy" => "",
177
+                "date_creation" => "", // dateTime
178
+                "date_modification" => "", // dateTime
179
+                "note_private" => "",
180
+                "note_public" => "",
181
+                "address" => "",
182
+                "zip" => "",
183
+                "town" => "",
184
+                "province_id" => "",
185
+                "country_id" => "",
186
+                "country_code" => "",
187
+                "country" => "",
188
+                "phone" => "",
189
+                "fax" => "",
190
+                "email" => "",
191
+                "url" => "",
192
+                "profid1" => "",
193
+                "profid2" => "",
194
+                "profid3" => "",
195
+                "profid4" => "",
196
+                "profid5" => "",
197
+                "profid6" => "",
198
+                "capital" => "",
199
+                "vat_used" => "",
200
+                "vat_number" => ""
201
+        );
202
+
203
+        // Test URL
204
+        $result='';
205
+        $parameters = array('authentication'=>$authentication, 'thirdparty'=>$body);
206
+        print __METHOD__." call method ".$WS_METHOD."\n";
207
+        try {
208
+            $result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,'');
209
+        } catch(SoapFault $exception) {
210
+            echo $exception;
211
+            $result=0;
212
+        }
213
+        if (! $result || ! empty($result['faultstring'])) {
214
+            //var_dump($soapclient);
215
+            print $this->soapclient->error_str;
216
+            print "\n<br>\n";
217
+            print $this->soapclient->request;
218
+            print "\n<br>\n";
219
+            print $this->soapclient->response;
220
+            print "\n";
221
+        }
222
+
223
+        print __METHOD__." result=".$result['result']['result_code']."\n";
224
+        $this->assertEquals('OK',$result['result']['result_code']);
225
+        $this->assertEquals('name',$result['ref']);
226
+
227
+        return $result;
228 228
     }
229 229
 
230 230
     /**
@@ -292,62 +292,62 @@  discard block
 block discarded – undo
292 292
      *
293 293
      * Use ref_ext to retrieve thirdparty
294 294
      *
295
-	 * @depends testWSThirdpartycreateThirdParty
296
-	 *
295
+     * @depends testWSThirdpartycreateThirdParty
296
+     *
297 297
      * @param	array	$result		thirdparty created by create method
298 298
      * @return	array				thirdparty
299 299
      */
300 300
     public function testWSThirdpartygetThirdPartyByRefExt($result)
301 301
     {
302
-    	global $conf,$user,$langs,$db;
303
-    	$conf=$this->savconf;
304
-    	$user=$this->savuser;
305
-    	$langs=$this->savlangs;
306
-    	$db=$this->savdb;
307
-    	$id = $result['id'];
308
-
309
-    	$WS_METHOD  = 'getThirdParty';
310
-
311
-    	// Call the WebService method and store its result in $result.
312
-    	$authentication=array(
313
-    			'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
314
-    			'sourceapplication'=>'DEMO',
315
-    			'login'=>'admin',
316
-    			'password'=>'admin',
317
-    			'entity'=>'');
318
-
319
-    	// Test URL
320
-    	$result='';
321
-    	$parameters = array('authentication'=>$authentication, 'id'=>'', 'ref'=>'', 'ref_ext'=>'12');
322
-    	print __METHOD__." call method ".$WS_METHOD."\n";
323
-    	try {
324
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->_ns,'');
325
-    	} catch(SoapFault $exception) {
326
-    		echo $exception;
327
-    		$result=0;
328
-    	}
329
-    	print $this->soapclient->response;
330
-    	if (! $result || ! empty($result['faultstring'])) {
331
-    		//var_dump($soapclient);
332
-    		print $this->soapclient->error_str;
333
-    		print "\n<br>\n";
334
-    		print $this->soapclient->request;
335
-    		print "\n<br>\n";
336
-    		print $this->soapclient->response;
337
-    		print "\n";
338
-    	}
339
-
340
-    	print __METHOD__." result=".$result['result']['result_code']."\n";
341
-    	$this->assertEquals('OK',$result['result']['result_code']);
342
-    	$this->assertEquals($id, $result['thirdparty']['id']);
343
-    	$this->assertEquals('name', $result['thirdparty']['ref']);
344
-    	$this->assertEquals('12', $result['thirdparty']['ref_ext']);
345
-    	$this->assertEquals('0', $result['thirdparty']['status']);
346
-    	$this->assertEquals('1', $result['thirdparty']['client']);
347
-    	$this->assertEquals('0', $result['thirdparty']['supplier']);
348
-
349
-
350
-    	return $result;
302
+        global $conf,$user,$langs,$db;
303
+        $conf=$this->savconf;
304
+        $user=$this->savuser;
305
+        $langs=$this->savlangs;
306
+        $db=$this->savdb;
307
+        $id = $result['id'];
308
+
309
+        $WS_METHOD  = 'getThirdParty';
310
+
311
+        // Call the WebService method and store its result in $result.
312
+        $authentication=array(
313
+                'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
314
+                'sourceapplication'=>'DEMO',
315
+                'login'=>'admin',
316
+                'password'=>'admin',
317
+                'entity'=>'');
318
+
319
+        // Test URL
320
+        $result='';
321
+        $parameters = array('authentication'=>$authentication, 'id'=>'', 'ref'=>'', 'ref_ext'=>'12');
322
+        print __METHOD__." call method ".$WS_METHOD."\n";
323
+        try {
324
+            $result = $this->soapclient->call($WS_METHOD,$parameters,$this->_ns,'');
325
+        } catch(SoapFault $exception) {
326
+            echo $exception;
327
+            $result=0;
328
+        }
329
+        print $this->soapclient->response;
330
+        if (! $result || ! empty($result['faultstring'])) {
331
+            //var_dump($soapclient);
332
+            print $this->soapclient->error_str;
333
+            print "\n<br>\n";
334
+            print $this->soapclient->request;
335
+            print "\n<br>\n";
336
+            print $this->soapclient->response;
337
+            print "\n";
338
+        }
339
+
340
+        print __METHOD__." result=".$result['result']['result_code']."\n";
341
+        $this->assertEquals('OK',$result['result']['result_code']);
342
+        $this->assertEquals($id, $result['thirdparty']['id']);
343
+        $this->assertEquals('name', $result['thirdparty']['ref']);
344
+        $this->assertEquals('12', $result['thirdparty']['ref_ext']);
345
+        $this->assertEquals('0', $result['thirdparty']['status']);
346
+        $this->assertEquals('1', $result['thirdparty']['client']);
347
+        $this->assertEquals('0', $result['thirdparty']['supplier']);
348
+
349
+
350
+        return $result;
351 351
     }
352 352
 
353 353
     /**
@@ -360,44 +360,44 @@  discard block
 block discarded – undo
360 360
      */
361 361
     public function testWSThirdpartydeleteThirdPartyById($result)
362 362
     {
363
-    	global $conf,$user,$langs,$db;
364
-    	$conf=$this->savconf;
365
-    	$user=$this->savuser;
366
-    	$langs=$this->savlangs;
367
-    	$db=$this->savdb;
368
-    	$id = $result['id'];
369
-
370
-    	$WS_METHOD  = 'deleteThirdParty';
371
-
372
-    	// Call the WebService method and store its result in $result.
373
-    	$authentication=array(
374
-    			'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
375
-    			'sourceapplication'=>'DEMO',
376
-    			'login'=>'admin',
377
-    			'password'=>'admin',
378
-    			'entity'=>'');
379
-
380
-    	$result='';
381
-    	$parameters = array('authentication'=>$authentication, 'id'=>$id, 'ref'=>'', 'ref_ext'=>'');
382
-    	print __METHOD__." call method ".$WS_METHOD."\n";
383
-    	try {
384
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->_ns,'');
385
-    	} catch(SoapFault $exception) {
386
-    		echo $exception;
387
-    		$result=0;
388
-    	}
389
-    	if (! $result || ! empty($result['faultstring'])) {
390
-    		print $this->soapclient->error_str;
391
-    		print "\n<br>\n";
392
-    		print $this->soapclient->request;
393
-    		print "\n<br>\n";
394
-    		print $this->soapclient->response;
395
-    		print "\n";
396
-    	}
397
-
398
-    	print __METHOD__." result=".$result['result']['result_code']."\n";
399
-    	$this->assertEquals('OK',$result['result']['result_code']);
400
-
401
-    	return $result;
363
+        global $conf,$user,$langs,$db;
364
+        $conf=$this->savconf;
365
+        $user=$this->savuser;
366
+        $langs=$this->savlangs;
367
+        $db=$this->savdb;
368
+        $id = $result['id'];
369
+
370
+        $WS_METHOD  = 'deleteThirdParty';
371
+
372
+        // Call the WebService method and store its result in $result.
373
+        $authentication=array(
374
+                'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
375
+                'sourceapplication'=>'DEMO',
376
+                'login'=>'admin',
377
+                'password'=>'admin',
378
+                'entity'=>'');
379
+
380
+        $result='';
381
+        $parameters = array('authentication'=>$authentication, 'id'=>$id, 'ref'=>'', 'ref_ext'=>'');
382
+        print __METHOD__." call method ".$WS_METHOD."\n";
383
+        try {
384
+            $result = $this->soapclient->call($WS_METHOD,$parameters,$this->_ns,'');
385
+        } catch(SoapFault $exception) {
386
+            echo $exception;
387
+            $result=0;
388
+        }
389
+        if (! $result || ! empty($result['faultstring'])) {
390
+            print $this->soapclient->error_str;
391
+            print "\n<br>\n";
392
+            print $this->soapclient->request;
393
+            print "\n<br>\n";
394
+            print $this->soapclient->response;
395
+            print "\n";
396
+        }
397
+
398
+        print __METHOD__." result=".$result['result']['result_code']."\n";
399
+        $this->assertEquals('OK',$result['result']['result_code']);
400
+
401
+        return $result;
402 402
     }
403 403
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/LangTest.php 1 patch
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -59,75 +59,75 @@  discard block
 block discarded – undo
59 59
  */
60 60
 class LangTest extends PHPUnit_Framework_TestCase
61 61
 {
62
-	protected $savconf;
63
-	protected $savuser;
64
-	protected $savlangs;
65
-	protected $savdb;
66
-
67
-	/**
68
-	 * Constructor
69
-	 * We save global variables into local variables
70
-	 *
71
-	 * @return SecurityTest
72
-	 */
73
-	function __construct()
74
-	{
75
-		parent::__construct();
76
-
77
-		//$this->sharedFixture
78
-		global $conf,$user,$langs,$db;
79
-		$this->savconf=$conf;
80
-		$this->savuser=$user;
81
-		$this->savlangs=$langs;
82
-		$this->savdb=$db;
83
-
84
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
85
-		//print " - db ".$db->db;
86
-		print "\n";
87
-	}
88
-
89
-	// Static methods
90
-  	public static function setUpBeforeClass()
62
+    protected $savconf;
63
+    protected $savuser;
64
+    protected $savlangs;
65
+    protected $savdb;
66
+
67
+    /**
68
+     * Constructor
69
+     * We save global variables into local variables
70
+     *
71
+     * @return SecurityTest
72
+     */
73
+    function __construct()
74
+    {
75
+        parent::__construct();
76
+
77
+        //$this->sharedFixture
78
+        global $conf,$user,$langs,$db;
79
+        $this->savconf=$conf;
80
+        $this->savuser=$user;
81
+        $this->savlangs=$langs;
82
+        $this->savdb=$db;
83
+
84
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
85
+        //print " - db ".$db->db;
86
+        print "\n";
87
+    }
88
+
89
+    // Static methods
90
+        public static function setUpBeforeClass()
91 91
     {
92
-    	global $conf,$user,$langs,$db;
93
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
92
+        global $conf,$user,$langs,$db;
93
+        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
94 94
 
95
-    	print __METHOD__."\n";
95
+        print __METHOD__."\n";
96 96
     }
97 97
 
98 98
     // tear down after class
99 99
     public static function tearDownAfterClass()
100 100
     {
101
-    	global $conf,$user,$langs,$db;
102
-		$db->rollback();
101
+        global $conf,$user,$langs,$db;
102
+        $db->rollback();
103 103
 
104
-		print __METHOD__."\n";
104
+        print __METHOD__."\n";
105 105
     }
106 106
 
107
-	/**
108
-	 * Init phpunit tests
109
-	 *
110
-	 * @return	void
111
-	 */
107
+    /**
108
+     * Init phpunit tests
109
+     *
110
+     * @return	void
111
+     */
112 112
     protected function setUp()
113 113
     {
114
-    	global $conf,$user,$langs,$db;
115
-		$conf=$this->savconf;
116
-		$user=$this->savuser;
117
-		$langs=$this->savlangs;
118
-		$db=$this->savdb;
114
+        global $conf,$user,$langs,$db;
115
+        $conf=$this->savconf;
116
+        $user=$this->savuser;
117
+        $langs=$this->savlangs;
118
+        $db=$this->savdb;
119 119
 
120
-		print __METHOD__."\n";
120
+        print __METHOD__."\n";
121 121
     }
122 122
 
123
-	/**
124
-	 * End phpunit tests
125
-	 *
126
-	 * @return	void
127
-	 */
123
+    /**
124
+     * End phpunit tests
125
+     *
126
+     * @return	void
127
+     */
128 128
     protected function tearDown()
129 129
     {
130
-    	print __METHOD__."\n";
130
+        print __METHOD__."\n";
131 131
     }
132 132
 
133 133
     /**
@@ -137,43 +137,43 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function testLang()
139 139
     {
140
-    	global $conf,$user,$langs,$db;
141
-		$conf=$this->savconf;
142
-		$user=$this->savuser;
143
-		$langs=$this->savlangs;
144
-		$db=$this->savdb;
140
+        global $conf,$user,$langs,$db;
141
+        $conf=$this->savconf;
142
+        $user=$this->savuser;
143
+        $langs=$this->savlangs;
144
+        $db=$this->savdb;
145 145
 
146 146
         include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
147 147
 
148
-		$filesarray = scandir(DOL_DOCUMENT_ROOT.'/langs');
149
-		foreach($filesarray as $key => $code)
150
-		{
151
-			if (! preg_match('/^[a-z]+_[A-Z]+$/',$code)) continue;
152
-
153
-			print 'Check language file for lang code='.$code."\n";
154
-			$tmplangs=new Translate('',$conf);
155
-    		$langcode=$code;
156
-        	$tmplangs->setDefaultLang($langcode);
157
-			$tmplangs->load("main");
158
-
159
-			$result=$tmplangs->transnoentitiesnoconv("SeparatorDecimal");
160
-			print __METHOD__." SeparatorDecimal=".$result."\n";
161
-			$this->assertContains($result,array('.',',','/',' ','','None'), 'Error for decimal separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
162
-
163
-			$result=$tmplangs->transnoentitiesnoconv("SeparatorThousand");
164
-			print __METHOD__." SeparatorThousand=".$result."\n";
165
-			$this->assertContains($result, array('.',',','/',' ','','\'','None','Space'), 'Error for thousand separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
166
-
167
-			// Test java string contains only d,M,y,/,-,. and not m,...
168
-			$result=$tmplangs->transnoentitiesnoconv("FormatDateShortJava");
169
-			print __METHOD__." FormatDateShortJava=".$result."\n";
170
-			$this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJava KO for lang code '.$code);
171
-			$result=$tmplangs->trans("FormatDateShortJavaInput");
172
-			print __METHOD__." FormatDateShortJavaInput=".$result."\n";
173
-			$this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJavaInput KO for lang code '.$code);
174
-
175
-			unset($tmplangs);
176
-		}
148
+        $filesarray = scandir(DOL_DOCUMENT_ROOT.'/langs');
149
+        foreach($filesarray as $key => $code)
150
+        {
151
+            if (! preg_match('/^[a-z]+_[A-Z]+$/',$code)) continue;
152
+
153
+            print 'Check language file for lang code='.$code."\n";
154
+            $tmplangs=new Translate('',$conf);
155
+            $langcode=$code;
156
+            $tmplangs->setDefaultLang($langcode);
157
+            $tmplangs->load("main");
158
+
159
+            $result=$tmplangs->transnoentitiesnoconv("SeparatorDecimal");
160
+            print __METHOD__." SeparatorDecimal=".$result."\n";
161
+            $this->assertContains($result,array('.',',','/',' ','','None'), 'Error for decimal separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
162
+
163
+            $result=$tmplangs->transnoentitiesnoconv("SeparatorThousand");
164
+            print __METHOD__." SeparatorThousand=".$result."\n";
165
+            $this->assertContains($result, array('.',',','/',' ','','\'','None','Space'), 'Error for thousand separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
166
+
167
+            // Test java string contains only d,M,y,/,-,. and not m,...
168
+            $result=$tmplangs->transnoentitiesnoconv("FormatDateShortJava");
169
+            print __METHOD__." FormatDateShortJava=".$result."\n";
170
+            $this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJava KO for lang code '.$code);
171
+            $result=$tmplangs->trans("FormatDateShortJavaInput");
172
+            print __METHOD__." FormatDateShortJavaInput=".$result."\n";
173
+            $this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJavaInput KO for lang code '.$code);
174
+
175
+            unset($tmplangs);
176
+        }
177 177
 
178 178
         return;
179 179
     }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/PaypalTest.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 if (empty($user->id))
34 34
 {
35
-	print "Load permissions for admin user nb 1\n";
36
-	$user->fetch(1);
37
-	$user->getrights();
35
+    print "Load permissions for admin user nb 1\n";
36
+    $user->fetch(1);
37
+    $user->getrights();
38 38
 }
39 39
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
40 40
 
@@ -48,78 +48,78 @@  discard block
 block discarded – undo
48 48
  */
49 49
 class PaypalTest extends PHPUnit_Framework_TestCase
50 50
 {
51
-	protected $savconf;
52
-	protected $savuser;
53
-	protected $savlangs;
54
-	protected $savdb;
55
-
56
-	/**
57
-	 * Constructor
58
-	 * We save global variables into local variables
59
-	 *
60
-	 * @return ProductTest
61
-	 */
62
-	function __construct()
63
-	{
64
-		parent::__construct();
65
-
66
-		//$this->sharedFixture
67
-		global $conf,$user,$langs,$db;
68
-		$this->savconf=$conf;
69
-		$this->savuser=$user;
70
-		$this->savlangs=$langs;
71
-		$this->savdb=$db;
72
-
73
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
74
-		//print " - db ".$db->db;
75
-		print "\n";
76
-	}
77
-
78
-	// Static methods
79
-  	public static function setUpBeforeClass()
51
+    protected $savconf;
52
+    protected $savuser;
53
+    protected $savlangs;
54
+    protected $savdb;
55
+
56
+    /**
57
+     * Constructor
58
+     * We save global variables into local variables
59
+     *
60
+     * @return ProductTest
61
+     */
62
+    function __construct()
80 63
     {
81
-    	global $conf,$user,$langs,$db;
64
+        parent::__construct();
65
+
66
+        //$this->sharedFixture
67
+        global $conf,$user,$langs,$db;
68
+        $this->savconf=$conf;
69
+        $this->savuser=$user;
70
+        $this->savlangs=$langs;
71
+        $this->savdb=$db;
72
+
73
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
74
+        //print " - db ".$db->db;
75
+        print "\n";
76
+    }
77
+
78
+    // Static methods
79
+        public static function setUpBeforeClass()
80
+    {
81
+        global $conf,$user,$langs,$db;
82 82
 
83
-    	if (empty($conf->paypal->enabled)) { print __METHOD__." Module Paypal must be enabled.\n"; die(); }
83
+        if (empty($conf->paypal->enabled)) { print __METHOD__." Module Paypal must be enabled.\n"; die(); }
84 84
 
85 85
         $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
86 86
 
87
-    	print __METHOD__."\n";
87
+        print __METHOD__."\n";
88 88
     }
89 89
 
90 90
     // tear down after class
91 91
     public static function tearDownAfterClass()
92 92
     {
93
-    	global $conf,$user,$langs,$db;
94
-		$db->rollback();
93
+        global $conf,$user,$langs,$db;
94
+        $db->rollback();
95 95
 
96
-		print __METHOD__."\n";
96
+        print __METHOD__."\n";
97 97
     }
98 98
 
99
-	/**
100
-	 * Init phpunit tests
101
-	 *
102
-	 * @return	void
103
-	 */
99
+    /**
100
+     * Init phpunit tests
101
+     *
102
+     * @return	void
103
+     */
104 104
     protected function setUp()
105 105
     {
106
-    	global $conf,$user,$langs,$db;
107
-		$conf=$this->savconf;
108
-		$user=$this->savuser;
109
-		$langs=$this->savlangs;
110
-		$db=$this->savdb;
106
+        global $conf,$user,$langs,$db;
107
+        $conf=$this->savconf;
108
+        $user=$this->savuser;
109
+        $langs=$this->savlangs;
110
+        $db=$this->savdb;
111 111
 
112
-		print __METHOD__."\n";
112
+        print __METHOD__."\n";
113 113
     }
114 114
 
115
-	/**
116
-	 * End phpunit tests
117
-	 *
118
-	 * @return	void
119
-	 */
115
+    /**
116
+     * End phpunit tests
117
+     *
118
+     * @return	void
119
+     */
120 120
     protected function tearDown()
121 121
     {
122
-    	print __METHOD__."\n";
122
+        print __METHOD__."\n";
123 123
     }
124 124
 
125 125
     /**
@@ -129,20 +129,20 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function testPaypalOk()
131 131
     {
132
-    	global $conf,$user,$langs,$db;
133
-		$conf=$this->savconf;
134
-		$user=$this->savuser;
135
-		$langs=$this->savlangs;
136
-		$db=$this->savdb;
132
+        global $conf,$user,$langs,$db;
133
+        $conf=$this->savconf;
134
+        $user=$this->savuser;
135
+        $langs=$this->savlangs;
136
+        $db=$this->savdb;
137 137
 
138
-		$urltotest=getPaypalPaymentUrl(1,'free');
139
-		print "urltotest=".$urltotest."\n";
138
+        $urltotest=getPaypalPaymentUrl(1,'free');
139
+        print "urltotest=".$urltotest."\n";
140 140
 
141
-		$result=getURLContent($urltotest, 'GET');
141
+        $result=getURLContent($urltotest, 'GET');
142 142
 
143 143
         print __METHOD__." result=".$result."\n";
144
-    	$this->assertLessThanOrEqual($result, 0);
144
+        $this->assertLessThanOrEqual($result, 0);
145 145
 
146
-    	return $result;
146
+        return $result;
147 147
     }
148 148
 }
Please login to merge, or discard this patch.