Test Failed
Push — master ( 2c8b6d...9d1fea )
by Alxarafe
45:51
created
dolibarr/dev/initdata/generate-proposal.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 // Recupere root dolibarr
35 35
 //$path=preg_replace('/generate-propale.php/i','',$_SERVER["PHP_SELF"]);
36
-require __DIR__. '/../../htdocs/master.inc.php';
36
+require __DIR__.'/../../htdocs/master.inc.php';
37 37
 require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php";
38 38
 require_once DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php";
39 39
 require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php";
@@ -45,60 +45,60 @@  discard block
 block discarded – undo
45 45
 
46 46
 define(GEN_NUMBER_PROPAL, 10);
47 47
 $year = 2016;
48
-$dates = array (mktime(12,0,0,1,3,$year),
49
-    mktime(12,0,0,1,9,$year),
50
-    mktime(12,0,0,2,13,$year),
51
-    mktime(12,0,0,2,23,$year),
52
-    mktime(12,0,0,3,30,$year),
53
-    mktime(12,0,0,4,3,$year),
54
-    mktime(12,0,0,4,3,$year),
55
-    mktime(12,0,0,5,9,$year),
56
-    mktime(12,0,0,5,1,$year),
57
-    mktime(12,0,0,5,13,$year),
58
-    mktime(12,0,0,5,19,$year),
59
-    mktime(12,0,0,5,23,$year),
60
-    mktime(12,0,0,6,3,$year),
61
-    mktime(12,0,0,6,19,$year),
62
-    mktime(12,0,0,6,24,$year),
63
-    mktime(12,0,0,7,3,$year),
64
-    mktime(12,0,0,7,9,$year),
65
-    mktime(12,0,0,7,23,$year),
66
-    mktime(12,0,0,7,30,$year),
67
-    mktime(12,0,0,8,9,$year),
68
-    mktime(12,0,0,9,23,$year),
69
-    mktime(12,0,0,10,3,$year),
70
-    mktime(12,0,0,11,12,$year),
71
-    mktime(12,0,0,11,13,$year),
72
-    mktime(12,0,0,1,3,($year - 1)),
73
-    mktime(12,0,0,1,9,($year - 1)),
74
-    mktime(12,0,0,2,13,($year - 1)),
75
-    mktime(12,0,0,2,23,($year - 1)),
76
-    mktime(12,0,0,3,30,($year - 1)),
77
-    mktime(12,0,0,4,3,($year - 1)),
78
-    mktime(12,0,0,4,3,($year - 1)),
79
-    mktime(12,0,0,5,9,($year - 1)),
80
-    mktime(12,0,0,5,1,($year - 1)),
81
-    mktime(12,0,0,5,13,($year - 1)),
82
-    mktime(12,0,0,5,19,($year - 1)),
83
-    mktime(12,0,0,5,23,($year - 1)),
84
-    mktime(12,0,0,6,3,($year - 1)),
85
-    mktime(12,0,0,6,19,($year - 1)),
86
-    mktime(12,0,0,6,24,($year - 1)),
87
-    mktime(12,0,0,7,3,($year - 1)),
88
-    mktime(12,0,0,7,9,($year - 1)),
89
-    mktime(12,0,0,7,23,($year - 1)),
90
-    mktime(12,0,0,7,30,($year - 1)),
91
-    mktime(12,0,0,8,9,($year - 1)),
92
-    mktime(12,0,0,9,23,($year - 1)),
93
-    mktime(12,0,0,10,3,($year - 1)),
94
-    mktime(12,0,0,11,12,$year),
95
-    mktime(12,0,0,11,13,$year),
96
-    mktime(12,0,0,12,12,$year),
97
-    mktime(12,0,0,12,13,$year),
48
+$dates = array(mktime(12, 0, 0, 1, 3, $year),
49
+    mktime(12, 0, 0, 1, 9, $year),
50
+    mktime(12, 0, 0, 2, 13, $year),
51
+    mktime(12, 0, 0, 2, 23, $year),
52
+    mktime(12, 0, 0, 3, 30, $year),
53
+    mktime(12, 0, 0, 4, 3, $year),
54
+    mktime(12, 0, 0, 4, 3, $year),
55
+    mktime(12, 0, 0, 5, 9, $year),
56
+    mktime(12, 0, 0, 5, 1, $year),
57
+    mktime(12, 0, 0, 5, 13, $year),
58
+    mktime(12, 0, 0, 5, 19, $year),
59
+    mktime(12, 0, 0, 5, 23, $year),
60
+    mktime(12, 0, 0, 6, 3, $year),
61
+    mktime(12, 0, 0, 6, 19, $year),
62
+    mktime(12, 0, 0, 6, 24, $year),
63
+    mktime(12, 0, 0, 7, 3, $year),
64
+    mktime(12, 0, 0, 7, 9, $year),
65
+    mktime(12, 0, 0, 7, 23, $year),
66
+    mktime(12, 0, 0, 7, 30, $year),
67
+    mktime(12, 0, 0, 8, 9, $year),
68
+    mktime(12, 0, 0, 9, 23, $year),
69
+    mktime(12, 0, 0, 10, 3, $year),
70
+    mktime(12, 0, 0, 11, 12, $year),
71
+    mktime(12, 0, 0, 11, 13, $year),
72
+    mktime(12, 0, 0, 1, 3, ($year - 1)),
73
+    mktime(12, 0, 0, 1, 9, ($year - 1)),
74
+    mktime(12, 0, 0, 2, 13, ($year - 1)),
75
+    mktime(12, 0, 0, 2, 23, ($year - 1)),
76
+    mktime(12, 0, 0, 3, 30, ($year - 1)),
77
+    mktime(12, 0, 0, 4, 3, ($year - 1)),
78
+    mktime(12, 0, 0, 4, 3, ($year - 1)),
79
+    mktime(12, 0, 0, 5, 9, ($year - 1)),
80
+    mktime(12, 0, 0, 5, 1, ($year - 1)),
81
+    mktime(12, 0, 0, 5, 13, ($year - 1)),
82
+    mktime(12, 0, 0, 5, 19, ($year - 1)),
83
+    mktime(12, 0, 0, 5, 23, ($year - 1)),
84
+    mktime(12, 0, 0, 6, 3, ($year - 1)),
85
+    mktime(12, 0, 0, 6, 19, ($year - 1)),
86
+    mktime(12, 0, 0, 6, 24, ($year - 1)),
87
+    mktime(12, 0, 0, 7, 3, ($year - 1)),
88
+    mktime(12, 0, 0, 7, 9, ($year - 1)),
89
+    mktime(12, 0, 0, 7, 23, ($year - 1)),
90
+    mktime(12, 0, 0, 7, 30, ($year - 1)),
91
+    mktime(12, 0, 0, 8, 9, ($year - 1)),
92
+    mktime(12, 0, 0, 9, 23, ($year - 1)),
93
+    mktime(12, 0, 0, 10, 3, ($year - 1)),
94
+    mktime(12, 0, 0, 11, 12, $year),
95
+    mktime(12, 0, 0, 11, 13, $year),
96
+    mktime(12, 0, 0, 12, 12, $year),
97
+    mktime(12, 0, 0, 12, 13, $year),
98 98
 );
99 99
 
100
-$ret=$user->fetch('','admin');
101
-if (! $ret > 0)
100
+$ret = $user->fetch('', 'admin');
101
+if (!$ret > 0)
102 102
 {
103 103
 	print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
104 104
 	exit;
@@ -151,17 +151,17 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 }
153 153
 
154
-$user->rights->propal->creer=1;
155
-$user->rights->propal->propal_advance->validate=1;
154
+$user->rights->propal->creer = 1;
155
+$user->rights->propal->propal_advance->validate = 1;
156 156
 
157 157
 
158
-if (! empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"))
158
+if (!empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"))
159 159
 {
160
-	require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php";
160
+	require_once DOL_DOCUMENT_ROOT."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php";
161 161
 }
162 162
 
163
-$i=0;
164
-$result=0;
163
+$i = 0;
164
+$result = 0;
165 165
 while ($i < GEN_NUMBER_PROPAL && $result >= 0)
166 166
 {
167 167
 	$i++;
@@ -174,16 +174,16 @@  discard block
 block discarded – undo
174 174
 	$object = new Propal($db);
175 175
 
176 176
     $fuser = new User($db);
177
-    $fuser->fetch(mt_rand(1,2));
177
+    $fuser->fetch(mt_rand(1, 2));
178 178
     $fuser->getRights();
179 179
     
180 180
 	$object->contactid = $contids[$socids[$socid]][0];
181 181
 	$object->socid = $socids[$socid];
182
-	$object->datep = $dates[mt_rand(1, count($dates)-1)];
182
+	$object->datep = $dates[mt_rand(1, count($dates) - 1)];
183 183
 	$object->cond_reglement_id = 3;
184 184
 	$object->mode_reglement_id = 3;
185 185
 
186
-	$result=$object->create($fuser);
186
+	$result = $object->create($fuser);
187 187
 	if ($result >= 0)
188 188
 	{
189 189
 		$nbp = mt_rand(2, 5);
@@ -191,17 +191,17 @@  discard block
 block discarded – undo
191 191
 		while ($xnbp < $nbp)
192 192
 		{
193 193
 			$prodid = mt_rand(1, $num_prods);
194
-			$product=new Product($db);
195
-			$result=$product->fetch($prodids[$prodid]);
196
-			$result=$object->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0);
194
+			$product = new Product($db);
195
+			$result = $product->fetch($prodids[$prodid]);
196
+			$result = $object->addline($product->description, $product->price, mt_rand(1, 5), 0, 0, 0, $prodids[$prodid], 0);
197 197
 			if ($result < 0)
198 198
 			{
199
-				dol_print_error($db,$object->error);
199
+				dol_print_error($db, $object->error);
200 200
 			}
201 201
 			$xnbp++;
202 202
 		}
203 203
 		
204
-		$result=$object->valid($fuser);
204
+		$result = $object->valid($fuser);
205 205
 		if ($result > 0)
206 206
 		{
207 207
 		    $db->commit();
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 		{
212 212
 		    print " KO\n";
213 213
 		    $db->rollback();
214
-		    dol_print_error($db,$object->error);
214
+		    dol_print_error($db, $object->error);
215 215
 		}
216 216
 	}
217 217
 	else
218 218
 	{
219
-		dol_print_error($db,$object->error);
219
+		dol_print_error($db, $object->error);
220 220
 	}
221 221
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/MouvementStockTest.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *		\remarks	To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	$user->fetch(1);
38 38
 	$user->getrights();
39 39
 }
40
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
40
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
41 41
 
42 42
 
43 43
 /**
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 		parent::__construct();
66 66
 
67 67
 		//$this->sharedFixture
68
-		global $conf,$user,$langs,$db;
69
-		$this->savconf=$conf;
70
-		$this->savuser=$user;
71
-		$this->savlangs=$langs;
72
-		$this->savdb=$db;
68
+		global $conf, $user, $langs, $db;
69
+		$this->savconf = $conf;
70
+		$this->savuser = $user;
71
+		$this->savlangs = $langs;
72
+		$this->savdb = $db;
73 73
 
74 74
 		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
75 75
 		//print " - db ".$db->db;
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	// Static methods
80 80
   	public static function setUpBeforeClass()
81 81
     {
82
-    	global $conf,$user,$langs,$db;
83
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
82
+    	global $conf, $user, $langs, $db;
83
+		$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
84 84
 
85 85
     	print __METHOD__."\n";
86 86
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     // tear down after class
89 89
     public static function tearDownAfterClass()
90 90
     {
91
-    	global $conf,$user,$langs,$db;
91
+    	global $conf, $user, $langs, $db;
92 92
 		$db->rollback();
93 93
 
94 94
 		print __METHOD__."\n";
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
     protected function setUp()
103 103
     {
104
-    	global $conf,$user,$langs,$db;
105
-		$conf=$this->savconf;
106
-		$user=$this->savuser;
107
-		$langs=$this->savlangs;
108
-		$db=$this->savdb;
104
+    	global $conf, $user, $langs, $db;
105
+		$conf = $this->savconf;
106
+		$user = $this->savuser;
107
+		$langs = $this->savlangs;
108
+		$db = $this->savdb;
109 109
 
110 110
 		print __METHOD__."\n";
111 111
     }
@@ -126,64 +126,64 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function testMouvementCreate()
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 135
 		// We create a product for tests
136
-		$product1=new Product($db);
136
+		$product1 = new Product($db);
137 137
 		$product1->initAsSpecimen();
138
-		$product1->ref.=' 1';
139
-		$product1->label.=' 1';
140
-		$product1id=$product1->create($user);
138
+		$product1->ref .= ' 1';
139
+		$product1->label .= ' 1';
140
+		$product1id = $product1->create($user);
141 141
 
142
-		$product2=new Product($db);
142
+		$product2 = new Product($db);
143 143
 		$product2->initAsSpecimen();
144
-		$product2->ref.=' 2';
145
-		$product2->label.=' 2';
146
-		$product2id=$product2->create($user);
144
+		$product2->ref .= ' 2';
145
+		$product2->label .= ' 2';
146
+		$product2id = $product2->create($user);
147 147
 
148 148
 		// We create a product for tests
149
-		$warehouse1=new Entrepot($db);
149
+		$warehouse1 = new Entrepot($db);
150 150
 		$warehouse1->initAsSpecimen();
151
-		$warehouse1->libelle.=' 1';
152
-		$warehouse1->description.=' 1';
153
-		$warehouse1id=$warehouse1->create($user);
151
+		$warehouse1->libelle .= ' 1';
152
+		$warehouse1->description .= ' 1';
153
+		$warehouse1id = $warehouse1->create($user);
154 154
 
155
-		$warehouse2=new Entrepot($db);
155
+		$warehouse2 = new Entrepot($db);
156 156
 		$warehouse2->initAsSpecimen();
157
-		$warehouse2->libelle.=' 2';
158
-		$warehouse2->description.=' 2';
159
-		$warehouse2id=$warehouse2->create($user);
157
+		$warehouse2->libelle .= ' 2';
158
+		$warehouse2->description .= ' 2';
159
+		$warehouse2id = $warehouse2->create($user);
160 160
 
161
-		$localobject=new MouvementStock($this->savdb);
161
+		$localobject = new MouvementStock($this->savdb);
162 162
 
163 163
     	// Do a list of movement into warehouse 1
164 164
 
165 165
     	// Create an input movement (type = 3) of price 9.9 -> shoul dupdate PMP to 9.9
166
-    	$result=$localobject->_create($user, $product1id, $warehouse1id, 10, 3, 9.9, 'Movement for unit test 1', 'Inventory Code Test');
166
+    	$result = $localobject->_create($user, $product1id, $warehouse1id, 10, 3, 9.9, 'Movement for unit test 1', 'Inventory Code Test');
167 167
     	print __METHOD__." result=".$result."\n";
168 168
     	$this->assertLessThan($result, 0);
169 169
 
170 170
     	// Create an input movement (type = 3) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
171
-    	$result=$localobject->_create($user, $product1id, $warehouse1id, 10, 3, 9.7, 'Movement for unit test 2', 'Inventory Code Test');
171
+    	$result = $localobject->_create($user, $product1id, $warehouse1id, 10, 3, 9.7, 'Movement for unit test 2', 'Inventory Code Test');
172 172
     	print __METHOD__." result=".$result."\n";
173 173
     	$this->assertLessThan($result, 0);
174 174
 
175 175
     	// Create an output movement (type = 2) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
176
-    	$result=$localobject->_create($user, $product1id, $warehouse1id, -5, 2, 999, 'Movement for unit test 3', 'Inventory Code Test');
176
+    	$result = $localobject->_create($user, $product1id, $warehouse1id, -5, 2, 999, 'Movement for unit test 3', 'Inventory Code Test');
177 177
     	print __METHOD__." result=".$result."\n";
178 178
     	$this->assertLessThan($result, 0);
179 179
 
180 180
     	// Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
181
-    	$result=$localobject->_create($user, $product1id, $warehouse1id, 1, 0, 0, 'Input from transfer', 'Transfert X');
181
+    	$result = $localobject->_create($user, $product1id, $warehouse1id, 1, 0, 0, 'Input from transfer', 'Transfert X');
182 182
     	print __METHOD__." result=".$result."\n";
183 183
     	$this->assertLessThan($result, 0);
184 184
 
185 185
     	// Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
186
-    	$result=$localobject->_create($user, $product1id, $warehouse1id, -2, 1, 0, 'Output from transfer', 'Transfert Y');
186
+    	$result = $localobject->_create($user, $product1id, $warehouse1id, -2, 1, 0, 'Output from transfer', 'Transfert Y');
187 187
     	print __METHOD__." result=".$result."\n";
188 188
     	$this->assertLessThan($result, 0);
189 189
 
@@ -191,27 +191,27 @@  discard block
 block discarded – undo
191 191
     	// Do same but into warehouse 2
192 192
 
193 193
     	// Create an input movement (type = 3) of price 9.9 -> shoul dupdate PMP to 9.9
194
-    	$result=$localobject->_create($user, $product1id, $warehouse2id, 10, 3, 9.9, 'Movement for unit test 1 wh 2', 'Inventory Code Test 2');
194
+    	$result = $localobject->_create($user, $product1id, $warehouse2id, 10, 3, 9.9, 'Movement for unit test 1 wh 2', 'Inventory Code Test 2');
195 195
     	print __METHOD__." result=".$result."\n";
196 196
     	$this->assertLessThan($result, 0);
197 197
 
198 198
     	// Create an input movement (type = 3) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
199
-    	$result=$localobject->_create($user, $product1id, $warehouse2id, 10, 3, 9.7, 'Movement for unit test 2 wh 2', 'Inventory Code Test 2');
199
+    	$result = $localobject->_create($user, $product1id, $warehouse2id, 10, 3, 9.7, 'Movement for unit test 2 wh 2', 'Inventory Code Test 2');
200 200
     	print __METHOD__." result=".$result."\n";
201 201
     	$this->assertLessThan($result, 0);
202 202
 
203 203
     	// Create an output movement (type = 2) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
204
-    	$result=$localobject->_create($user, $product1id, $warehouse2id, -5, 2, 999, 'Movement for unit test 3 wh 2', 'Inventory Code Test 2');
204
+    	$result = $localobject->_create($user, $product1id, $warehouse2id, -5, 2, 999, 'Movement for unit test 3 wh 2', 'Inventory Code Test 2');
205 205
     	print __METHOD__." result=".$result."\n";
206 206
     	$this->assertLessThan($result, 0);
207 207
 
208 208
     	// Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
209
-    	$result=$localobject->_create($user, $product1id, $warehouse2id, 1, 0, 0, 'Input from transfer wh 2', 'Transfert X 2');
209
+    	$result = $localobject->_create($user, $product1id, $warehouse2id, 1, 0, 0, 'Input from transfer wh 2', 'Transfert X 2');
210 210
     	print __METHOD__." result=".$result."\n";
211 211
     	$this->assertLessThan($result, 0);
212 212
 
213 213
     	// Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8
214
-    	$result=$localobject->_create($user, $product1id, $warehouse2id, -2, 1, 0, 'Output from transfer wh 2', 'Transfert Y 2');
214
+    	$result = $localobject->_create($user, $product1id, $warehouse2id, -2, 1, 0, 'Output from transfer wh 2', 'Transfert Y 2');
215 215
     	print __METHOD__." result=".$result."\n";
216 216
     	$this->assertLessThan($result, 0);
217 217
 
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
      */
231 231
     public function testMouvementCheck($localobject)
232 232
     {
233
-    	global $conf,$user,$langs,$db;
234
-		$conf=$this->savconf;
235
-		$user=$this->savuser;
236
-		$langs=$this->savlangs;
237
-		$db=$this->savdb;
233
+    	global $conf, $user, $langs, $db;
234
+		$conf = $this->savconf;
235
+		$user = $this->savuser;
236
+		$langs = $this->savlangs;
237
+		$db = $this->savdb;
238 238
 
239 239
 		$productid = $localobject->product_id;
240 240
 		$warehouseid = $localobject->entrepot_id;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		$producttotest->fetch($productid);
246 246
 
247 247
     	print __METHOD__." producttotest->stock_reel=".$producttotest->stock_reel."\n";
248
-    	$this->assertEquals($producttotest->stock_reel, 28);	// 28 is result of stock movement defined into testMouvementCreate
248
+    	$this->assertEquals($producttotest->stock_reel, 28); // 28 is result of stock movement defined into testMouvementCreate
249 249
 
250 250
     	print __METHOD__." producttotest->pmp=".$producttotest->pmp."\n";
251 251
     	$this->assertEquals($producttotest->pmp, 9.8);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/ActionCommTest.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *      \remarks    To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     $user->fetch(1);
35 35
     $user->getrights();
36 36
 }
37
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
37
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
38 38
 
39 39
 
40 40
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
     	parent::__construct();
63 63
 
64 64
     	//$this->sharedFixture
65
-        global $conf,$user,$langs,$db;
66
-        $this->savconf=$conf;
67
-        $this->savuser=$user;
68
-        $this->savlangs=$langs;
69
-        $this->savdb=$db;
65
+        global $conf, $user, $langs, $db;
66
+        $this->savconf = $conf;
67
+        $this->savuser = $user;
68
+        $this->savlangs = $langs;
69
+        $this->savdb = $db;
70 70
 
71 71
         print __METHOD__." db->type=".$db->type." user->id=".$user->id;
72 72
         //print " - db ".$db->db;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     // Static methods
77 77
     public static function setUpBeforeClass()
78 78
     {
79
-        global $conf,$user,$langs,$db;
79
+        global $conf, $user, $langs, $db;
80 80
         $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
81 81
 
82 82
         if (empty($conf->agenda->enabled)) { print __METHOD__." module agenda must be enabled.\n"; die(); }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     // tear down after class
88 88
     public static function tearDownAfterClass()
89 89
     {
90
-        global $conf,$user,$langs,$db;
90
+        global $conf, $user, $langs, $db;
91 91
         $db->rollback();
92 92
 
93 93
         print __METHOD__."\n";
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
      */
101 101
     protected function setUp()
102 102
     {
103
-        global $conf,$user,$langs,$db;
104
-        $conf=$this->savconf;
105
-        $user=$this->savuser;
106
-        $langs=$this->savlangs;
107
-        $db=$this->savdb;
103
+        global $conf, $user, $langs, $db;
104
+        $conf = $this->savconf;
105
+        $user = $this->savuser;
106
+        $langs = $this->savlangs;
107
+        $db = $this->savdb;
108 108
 
109 109
         print __METHOD__."\n";
110 110
         //print $db->getVersion()."\n";
@@ -127,28 +127,28 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function testActionCommCreate()
129 129
     {
130
-        global $conf,$user,$langs,$db;
131
-        $conf=$this->savconf;
132
-        $user=$this->savuser;
133
-        $langs=$this->savlangs;
134
-        $db=$this->savdb;
130
+        global $conf, $user, $langs, $db;
131
+        $conf = $this->savconf;
132
+        $user = $this->savuser;
133
+        $langs = $this->savlangs;
134
+        $db = $this->savdb;
135 135
 
136 136
         $now = dol_now();
137 137
 
138
-        $localobject=new ActionComm($this->savdb);
138
+        $localobject = new ActionComm($this->savdb);
139 139
 
140
-        $localobject->type_code   = 'AC_OTH_AUTO';		// Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
140
+        $localobject->type_code   = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
141 141
         $localobject->code        = 'AC_PHPUNITTEST';
142 142
         $localobject->label       = 'This is a description';
143 143
         $localobject->note        = 'This is note';
144 144
         $localobject->fk_project  = 0;
145 145
         $localobject->datep       = $now;
146 146
         $localobject->datef       = $now;
147
-        $localobject->percentage  = -1;   // Not applicable
147
+        $localobject->percentage  = -1; // Not applicable
148 148
         $localobject->socid       = 0;
149 149
         $localobject->contactid   = 0;
150
-        $localobject->authorid    = $user->id;   // User saving action
151
-        $localobject->userownerid = $user->id;	// Owner of action
150
+        $localobject->authorid    = $user->id; // User saving action
151
+        $localobject->userownerid = $user->id; // Owner of action
152 152
         // Fields when action is en email (content should be added into note)
153 153
         /*$localobject->email_msgid = $object->email_msgid;
154 154
          $localobject->email_from  = $object->email_from;
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
      */
181 181
     public function testActionCommFetch($id)
182 182
     {
183
-        global $conf,$user,$langs,$db;
184
-        $conf=$this->savconf;
185
-        $user=$this->savuser;
186
-        $langs=$this->savlangs;
187
-        $db=$this->savdb;
183
+        global $conf, $user, $langs, $db;
184
+        $conf = $this->savconf;
185
+        $user = $this->savuser;
186
+        $langs = $this->savlangs;
187
+        $db = $this->savdb;
188 188
 
189
-        $localobject=new ActionComm($this->savdb);
190
-        $result=$localobject->fetch($id);
189
+        $localobject = new ActionComm($this->savdb);
190
+        $result = $localobject->fetch($id);
191 191
 
192 192
         $this->assertLessThan($result, 0);
193 193
         print __METHOD__." id=".$id." result=".$result."\n";
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function testActionCommUpdate($localobject)
207 207
     {
208
-    	global $conf,$user,$langs,$db;
209
-    	$conf=$this->savconf;
210
-    	$user=$this->savuser;
211
-    	$langs=$this->savlangs;
212
-    	$db=$this->savdb;
208
+    	global $conf, $user, $langs, $db;
209
+    	$conf = $this->savconf;
210
+    	$user = $this->savuser;
211
+    	$langs = $this->savlangs;
212
+    	$db = $this->savdb;
213 213
 
214
-    	$localobject->label='New label';
215
-    	$result=$localobject->update($user);
214
+    	$localobject->label = 'New label';
215
+    	$result = $localobject->update($user);
216 216
 
217 217
     	$this->assertLessThan($result, 0);
218 218
     	print __METHOD__." id=".$id." result=".$result."\n";
@@ -230,15 +230,15 @@  discard block
 block discarded – undo
230 230
      */
231 231
     public function testActionCommDelete($id)
232 232
     {
233
-        global $conf,$user,$langs,$db;
234
-        $conf=$this->savconf;
235
-        $user=$this->savuser;
236
-        $langs=$this->savlangs;
237
-        $db=$this->savdb;
238
-
239
-        $localobject=new ActionComm($this->savdb);
240
-        $result=$localobject->fetch($id);
241
-        $result=$localobject->delete($user);
233
+        global $conf, $user, $langs, $db;
234
+        $conf = $this->savconf;
235
+        $user = $this->savuser;
236
+        $langs = $this->savlangs;
237
+        $db = $this->savdb;
238
+
239
+        $localobject = new ActionComm($this->savdb);
240
+        $result = $localobject->fetch($id);
241
+        $result = $localobject->delete($user);
242 242
 
243 243
         print __METHOD__." id=".$id." result=".$result."\n";
244 244
         $this->assertLessThan($result, 0);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/WebservicesInvoicesTest.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
  *		\remarks	To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
30 30
 require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php';
31
-require_once NUSOAP_PATH.'/nusoap.php';        // Include SOAP
31
+require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
32 32
 
33 33
 
34 34
 if (empty($user->id))
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 	$user->fetch(1);
38 38
 	$user->getrights();
39 39
 }
40
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
40
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
41 41
 
42
-$conf->global->MAIN_UMASK='0666';
42
+$conf->global->MAIN_UMASK = '0666';
43 43
 
44 44
 
45 45
 /**
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
 		parent::__construct();
73 73
 
74 74
 		//$this->sharedFixture
75
-		global $conf,$user,$langs,$db;
76
-		$this->savconf=$conf;
77
-		$this->savuser=$user;
78
-		$this->savlangs=$langs;
79
-		$this->savdb=$db;
75
+		global $conf, $user, $langs, $db;
76
+		$this->savconf = $conf;
77
+		$this->savuser = $user;
78
+		$this->savlangs = $langs;
79
+		$this->savdb = $db;
80 80
 
81 81
 		// Set the WebService URL
82 82
 		$WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php';
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		$this->soapclient = new nusoap_client($WS_DOL_URL);
85 85
 		if ($this->soapclient)
86 86
 		{
87
-			$this->soapclient->soap_defencoding='UTF-8';
87
+			$this->soapclient->soap_defencoding = 'UTF-8';
88 88
 			$this->soapclient->decodeUTF8(false);
89 89
 		}
90 90
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public static function setUpBeforeClass()
102 102
     {
103
-        global $conf,$user,$langs,$db;
103
+        global $conf, $user, $langs, $db;
104 104
 
105 105
 		// create a third_party, needed to create an invoice
106 106
 		//
@@ -115,25 +115,25 @@  discard block
 block discarded – undo
115 115
 		// transaction commit. So if the invoice is created in the same
116 116
 		// transaction than the third party, the FK constraint fails.
117 117
 		// See this post for more detail: http://stackoverflow.com/a/5014744/5187108
118
-		$societe=new Societe($db);
119
-		$societe->ref='';
120
-		$societe->name='name';
121
-		$societe->ref_ext='ref-phpunit';
122
-		$societe->status=1;
123
-		$societe->client=1;
124
-		$societe->code_client='CU0901-1234';
125
-		$societe->code_fournisseur='SU0901-1234';
126
-		$societe->fournisseur=0;
127
-		$societe->date_creation=$now;
128
-		$societe->tva_assuj=0;
129
-		$societe->particulier=0;
118
+		$societe = new Societe($db);
119
+		$societe->ref = '';
120
+		$societe->name = 'name';
121
+		$societe->ref_ext = 'ref-phpunit';
122
+		$societe->status = 1;
123
+		$societe->client = 1;
124
+		$societe->code_client = 'CU0901-1234';
125
+		$societe->code_fournisseur = 'SU0901-1234';
126
+		$societe->fournisseur = 0;
127
+		$societe->date_creation = $now;
128
+		$societe->tva_assuj = 0;
129
+		$societe->particulier = 0;
130 130
 
131 131
 		$societe->create($user);
132 132
 
133 133
 		self::$socid = $societe->id;
134 134
 		print __METHOD__." societe created id=".$societe->id."\n";
135 135
 
136
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
136
+		$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
137 137
 
138 138
         print __METHOD__."\n";
139 139
     }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public static function tearDownAfterClass()
147 147
     {
148
-    	global $conf,$user,$langs,$db;
148
+    	global $conf, $user, $langs, $db;
149 149
 		$db->rollback();
150 150
 
151 151
 		print __METHOD__."\n";
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
     protected function setUp()
160 160
     {
161
-    	global $conf,$user,$langs,$db;
162
-		$conf=$this->savconf;
163
-		$user=$this->savuser;
164
-		$langs=$this->savlangs;
165
-		$db=$this->savdb;
161
+    	global $conf, $user, $langs, $db;
162
+		$conf = $this->savconf;
163
+		$user = $this->savuser;
164
+		$langs = $this->savlangs;
165
+		$db = $this->savdb;
166 166
 
167 167
 		print __METHOD__."\n";
168 168
     }
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function testWSInvoicesCreateInvoice()
187 187
     {
188
-    	global $conf,$user,$langs,$db;
189
-    	$conf=$this->savconf;
190
-    	$user=$this->savuser;
191
-    	$langs=$this->savlangs;
192
-    	$db=$this->savdb;
188
+    	global $conf, $user, $langs, $db;
189
+    	$conf = $this->savconf;
190
+    	$user = $this->savuser;
191
+    	$langs = $this->savlangs;
192
+    	$db = $this->savdb;
193 193
 
194
-    	$WS_METHOD  = 'createInvoice';
194
+    	$WS_METHOD = 'createInvoice';
195 195
 
196
-    	$body = array (
196
+    	$body = array(
197 197
     			"id" => null,
198 198
 				"ref" => null,
199 199
 				"ref_ext" => "ref-phpunit-2",
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 				"note_private" => "Synchronised from Prestashop",
214 214
 				"note_public" => "",
215 215
 				"status" => "1",
216
-				"close_code" => null ,
216
+				"close_code" => null,
217 217
 				"close_note" => null,
218 218
 				"project_id" => null,
219 219
 				"lines" => array(
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
 					"product_id" => "",
233 233
 					"product_ref" => "",
234 234
 					"product_label" => "",
235
-					"product_desc" => "" ))
235
+					"product_desc" => ""))
236 236
 					);
237 237
 
238 238
     	// Call the WebService method and store its result in $result.
239
-    	$authentication=array(
239
+    	$authentication = array(
240 240
     	'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
241 241
     	'sourceapplication'=>'DEMO',
242 242
     	'login'=>'admin',
@@ -244,18 +244,18 @@  discard block
 block discarded – undo
244 244
     	'entity'=>'');
245 245
 
246 246
     	// Test URL
247
-    	$result='';
248
-    	$parameters = array('authentication'=>$authentication,'invoice'=>$body);
247
+    	$result = '';
248
+    	$parameters = array('authentication'=>$authentication, 'invoice'=>$body);
249 249
     	print __METHOD__." call method ".$WS_METHOD."\n";
250 250
     	try {
251
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,'');
251
+    		$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
252 252
     	}
253
-    	catch(SoapFault $exception)
253
+    	catch (SoapFault $exception)
254 254
     	{
255 255
     		echo $exception;
256
-    		$result=0;
256
+    		$result = 0;
257 257
     	}
258
-    	if (! $result || ! empty($result['faultstring']))
258
+    	if (!$result || !empty($result['faultstring']))
259 259
     	{
260 260
     		//var_dump($soapclient);
261 261
     		print $this->soapclient->error_str;
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     	}
268 268
 
269 269
     	print __METHOD__." result=".$result['result']['result_code']."\n";
270
-    	$this->assertEquals('OK',$result['result']['result_code']);
270
+    	$this->assertEquals('OK', $result['result']['result_code']);
271 271
     	$this->assertEquals('ref-phpunit-2', $result['ref_ext']);
272 272
 
273 273
 
@@ -285,16 +285,16 @@  discard block
 block discarded – undo
285 285
      */
286 286
     public function testWSInvoicesGetInvoiceByRefExt($result)
287 287
     {
288
-    	global $conf,$user,$langs,$db;
289
-    	$conf=$this->savconf;
290
-    	$user=$this->savuser;
291
-    	$langs=$this->savlangs;
292
-    	$db=$this->savdb;
288
+    	global $conf, $user, $langs, $db;
289
+    	$conf = $this->savconf;
290
+    	$user = $this->savuser;
291
+    	$langs = $this->savlangs;
292
+    	$db = $this->savdb;
293 293
 
294
-    	$WS_METHOD  = 'getInvoice';
294
+    	$WS_METHOD = 'getInvoice';
295 295
 
296 296
     	// Call the WebService method and store its result in $result.
297
-    	$authentication=array(
297
+    	$authentication = array(
298 298
     	'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
299 299
     	'sourceapplication'=>'DEMO',
300 300
     	'login'=>'admin',
@@ -302,18 +302,18 @@  discard block
 block discarded – undo
302 302
     	'entity'=>'');
303 303
 
304 304
     	// Test URL
305
-    	$result='';
305
+    	$result = '';
306 306
     	$parameters = array('authentication'=>$authentication, 'id'=>null, 'ref'=>null, 'ref_ext'=>'ref-phpunit-2');
307 307
     	print __METHOD__." call method ".$WS_METHOD."\n";
308 308
     	try {
309
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,'');
309
+    		$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
310 310
     	}
311
-    	catch(SoapFault $exception)
311
+    	catch (SoapFault $exception)
312 312
     	{
313 313
     		echo $exception;
314
-    		$result=0;
314
+    		$result = 0;
315 315
     	}
316
-    	if (! $result || ! empty($result['faultstring']))
316
+    	if (!$result || !empty($result['faultstring']))
317 317
     	{
318 318
     		print $this->soapclient->error_str;
319 319
     		print "\n<br>\n";
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     		print "\n";
324 324
     	}
325 325
     	print __METHOD__." result=".$result['result']['result_code']."\n";
326
-    	$this->assertEquals('OK',$result['result']['result_code']);
326
+    	$this->assertEquals('OK', $result['result']['result_code']);
327 327
     	$this->assertEquals('ref-phpunit-2', $result['invoice']['ref_ext']);
328 328
 
329 329
 
@@ -341,16 +341,16 @@  discard block
 block discarded – undo
341 341
      */
342 342
     public function testWSInvoicesUpdateInvoiceByRefExt($result)
343 343
     {
344
-    	global $conf,$user,$langs,$db;
345
-    	$conf=$this->savconf;
346
-    	$user=$this->savuser;
347
-    	$langs=$this->savlangs;
348
-    	$db=$this->savdb;
344
+    	global $conf, $user, $langs, $db;
345
+    	$conf = $this->savconf;
346
+    	$user = $this->savuser;
347
+    	$langs = $this->savlangs;
348
+    	$db = $this->savdb;
349 349
 
350
-    	$WS_METHOD  = 'updateInvoice';
350
+    	$WS_METHOD = 'updateInvoice';
351 351
 
352 352
     	// update status to 2
353
-    	$body = array (
353
+    	$body = array(
354 354
     		"id" => null,
355 355
 			"ref" => null,
356 356
 			"ref_ext" => "ref-phpunit-2",
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			"note_private" => "Synchronised from Prestashop",
371 371
 			"note_public" => "",
372 372
 			"status" => "2",
373
-			"close_code" => null ,
373
+			"close_code" => null,
374 374
 			"close_note" => null,
375 375
 			"project_id" => null,
376 376
 			"lines"  => array(
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 			);
395 395
 
396 396
     	// Call the WebService method and store its result in $result.
397
-    	$authentication=array(
397
+    	$authentication = array(
398 398
     	'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
399 399
     	'sourceapplication'=>'DEMO',
400 400
     	'login'=>'admin',
@@ -402,18 +402,18 @@  discard block
 block discarded – undo
402 402
     	'entity'=>'');
403 403
 
404 404
     	// Test URL
405
-    	$result='';
406
-    	$parameters = array('authentication'=>$authentication,'invoice'=>$body);
405
+    	$result = '';
406
+    	$parameters = array('authentication'=>$authentication, 'invoice'=>$body);
407 407
     	print __METHOD__." call method ".$WS_METHOD."\n";
408 408
     	try {
409
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,'');
409
+    		$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
410 410
     	}
411
-    	catch(SoapFault $exception)
411
+    	catch (SoapFault $exception)
412 412
     	{
413 413
     		echo $exception;
414
-    		$result=0;
414
+    		$result = 0;
415 415
     	}
416
-    	if (! $result || ! empty($result['faultstring']))
416
+    	if (!$result || !empty($result['faultstring']))
417 417
     	{
418 418
     		print $this->soapclient->error_str;
419 419
     		print "\n<br>\n";
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     	}
425 425
 
426 426
     	print __METHOD__." result=".$result['result']['result_code'].$result['result']['result_label']."\n";
427
-    	$this->assertEquals('OK',$result['result']['result_code']);
427
+    	$this->assertEquals('OK', $result['result']['result_code']);
428 428
     	$this->assertEquals('ref-phpunit-2', $result['ref_ext']);
429 429
 
430 430
 
Please login to merge, or discard this patch.
dolibarr/test/phpunit/CommonInvoiceTest.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *      \remarks    To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     $user->fetch(1);
35 35
     $user->getrights();
36 36
 }
37
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
37
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
38 38
 
39 39
 
40 40
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
     	parent::__construct();
63 63
 
64 64
     	//$this->sharedFixture
65
-        global $conf,$user,$langs,$db;
66
-        $this->savconf=$conf;
67
-        $this->savuser=$user;
68
-        $this->savlangs=$langs;
69
-        $this->savdb=$db;
65
+        global $conf, $user, $langs, $db;
66
+        $this->savconf = $conf;
67
+        $this->savuser = $user;
68
+        $this->savlangs = $langs;
69
+        $this->savdb = $db;
70 70
 
71 71
         print __METHOD__." db->type=".$db->type." user->id=".$user->id;
72 72
         //print " - db ".$db->db;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     // Static methods
77 77
     public static function setUpBeforeClass()
78 78
     {
79
-        global $conf,$user,$langs,$db;
79
+        global $conf, $user, $langs, $db;
80 80
         $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
81 81
 
82 82
         print __METHOD__."\n";
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     // tear down after class
86 86
     public static function tearDownAfterClass()
87 87
     {
88
-        global $conf,$user,$langs,$db;
88
+        global $conf, $user, $langs, $db;
89 89
         $db->rollback();
90 90
 
91 91
         print __METHOD__."\n";
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
      */
99 99
     protected function setUp()
100 100
     {
101
-        global $conf,$user,$langs,$db;
102
-        $conf=$this->savconf;
103
-        $user=$this->savuser;
104
-        $langs=$this->savlangs;
105
-        $db=$this->savdb;
101
+        global $conf, $user, $langs, $db;
102
+        $conf = $this->savconf;
103
+        $user = $this->savuser;
104
+        $langs = $this->savlangs;
105
+        $db = $this->savdb;
106 106
 
107 107
         print __METHOD__."\n";
108 108
     }
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function testCalculateDateLimReglement()
126 126
     {
127
-        global $conf,$user,$langs,$db;
128
-        $conf=$this->savconf;
129
-        $user=$this->savuser;
130
-        $langs=$this->savlangs;
131
-        $db=$this->savdb;
127
+        global $conf, $user, $langs, $db;
128
+        $conf = $this->savconf;
129
+        $user = $this->savuser;
130
+        $langs = $this->savlangs;
131
+        $db = $this->savdb;
132 132
 
133
-        $localobject=new Facture($this->savdb);
133
+        $localobject = new Facture($this->savdb);
134 134
         $localobject->fetch(1);
135 135
         $localobject->date = dol_mktime(12, 0, 0, 1, 1, 2010);
136 136
 
Please login to merge, or discard this patch.
dolibarr/test/phpunit/AdminLibTest.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *      \remarks    To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     $user->fetch(1);
35 35
     $user->getrights();
36 36
 }
37
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
37
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
38 38
 
39 39
 
40 40
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
     	parent::__construct();
63 63
 
64 64
     	//$this->sharedFixture
65
-        global $conf,$user,$langs,$db;
66
-        $this->savconf=$conf;
67
-        $this->savuser=$user;
68
-        $this->savlangs=$langs;
69
-        $this->savdb=$db;
65
+        global $conf, $user, $langs, $db;
66
+        $this->savconf = $conf;
67
+        $this->savuser = $user;
68
+        $this->savlangs = $langs;
69
+        $this->savdb = $db;
70 70
 
71 71
         print __METHOD__." db->type=".$db->type." user->id=".$user->id;
72 72
         //print " - db ".$db->db;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     // Static methods
77 77
     public static function setUpBeforeClass()
78 78
     {
79
-        global $conf,$user,$langs,$db;
79
+        global $conf, $user, $langs, $db;
80 80
         $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
81 81
 
82 82
         print __METHOD__."\n";
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     // tear down after class
86 86
     public static function tearDownAfterClass()
87 87
     {
88
-        global $conf,$user,$langs,$db;
88
+        global $conf, $user, $langs, $db;
89 89
         $db->rollback();
90 90
 
91 91
         print __METHOD__."\n";
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
      */
99 99
     protected function setUp()
100 100
     {
101
-        global $conf,$user,$langs,$db;
102
-        $conf=$this->savconf;
103
-        $user=$this->savuser;
104
-        $langs=$this->savlangs;
105
-        $db=$this->savdb;
101
+        global $conf, $user, $langs, $db;
102
+        $conf = $this->savconf;
103
+        $user = $this->savuser;
104
+        $langs = $this->savlangs;
105
+        $db = $this->savdb;
106 106
 
107 107
         print __METHOD__."\n";
108 108
     }
@@ -123,24 +123,24 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function testVersionCompare()
125 125
     {
126
-        global $conf,$user,$langs,$db;
127
-        $conf=$this->savconf;
128
-        $user=$this->savuser;
129
-        $langs=$this->savlangs;
130
-        $db=$this->savdb;
126
+        global $conf, $user, $langs, $db;
127
+        $conf = $this->savconf;
128
+        $user = $this->savuser;
129
+        $langs = $this->savlangs;
130
+        $db = $this->savdb;
131 131
 
132
-        $result=versioncompare(array(3,1,-4),array(3,1,1));
132
+        $result = versioncompare(array(3, 1, -4), array(3, 1, 1));
133 133
         print __METHOD__." result=".$result."\n";
134
-        $this->assertEquals(-3,$result);
135
-        $result=versioncompare(array(3,1,0),array(3,1,1));
134
+        $this->assertEquals(-3, $result);
135
+        $result = versioncompare(array(3, 1, 0), array(3, 1, 1));
136 136
         print __METHOD__." result=".$result."\n";
137
-        $this->assertEquals(-3,$result);
138
-        $result=versioncompare(array(3,1,0),array(3,2,0));
137
+        $this->assertEquals(-3, $result);
138
+        $result = versioncompare(array(3, 1, 0), array(3, 2, 0));
139 139
         print __METHOD__." result=".$result."\n";
140
-        $this->assertEquals(-2,$result);
141
-        $result=versioncompare(array(3,1,0),array(3,1,0));
140
+        $this->assertEquals(-2, $result);
141
+        $result = versioncompare(array(3, 1, 0), array(3, 1, 0));
142 142
         print __METHOD__." result=".$result."\n";
143
-        $this->assertEquals(0,$result);
143
+        $this->assertEquals(0, $result);
144 144
 
145 145
         return $result;
146 146
     }
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
 
157 157
 		require_once dirname(__FILE__).'/../../htdocs/core/modules/modExpenseReport.class.php';
158 158
 		print "Enable module modExpenseReport";
159
-		$moduledescriptor=new modExpenseReport($db);
159
+		$moduledescriptor = new modExpenseReport($db);
160 160
 		$moduledescriptor->init();
161 161
 		$conf->setValues($db);
162 162
 
163 163
 		require_once dirname(__FILE__).'/../../htdocs/core/modules/modApi.class.php';
164 164
 		print "Enable module modAPI";
165
-		$moduledescriptor=new modApi($db);
165
+		$moduledescriptor = new modApi($db);
166 166
 		$moduledescriptor->init();
167 167
 		$conf->setValues($db);
168 168
     }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/AccountingAccountTest.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *      \remarks    To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     $user->fetch(1);
35 35
     $user->getrights();
36 36
 }
37
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
37
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
38 38
 
39 39
 
40 40
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
     	parent::__construct();
63 63
 
64 64
         //$this->sharedFixture
65
-        global $conf,$user,$langs,$db;
66
-        $this->savconf=$conf;
67
-        $this->savuser=$user;
68
-        $this->savlangs=$langs;
69
-        $this->savdb=$db;
65
+        global $conf, $user, $langs, $db;
66
+        $this->savconf = $conf;
67
+        $this->savuser = $user;
68
+        $this->savlangs = $langs;
69
+        $this->savdb = $db;
70 70
 
71 71
         print __METHOD__." db->type=".$db->type." user->id=".$user->id;
72 72
         //print " - db ".$db->db;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     // Static methods
77 77
     public static function setUpBeforeClass()
78 78
     {
79
-        global $conf,$user,$langs,$db;
79
+        global $conf, $user, $langs, $db;
80 80
         $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
81 81
 
82 82
         if (empty($conf->accounting->enabled)) { print __METHOD__." module accouting must be enabled.\n"; die(); }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     // tear down after class
88 88
     public static function tearDownAfterClass()
89 89
     {
90
-        global $conf,$user,$langs,$db;
90
+        global $conf, $user, $langs, $db;
91 91
         $db->rollback();
92 92
 
93 93
         print __METHOD__."\n";
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
      */
101 101
     protected function setUp()
102 102
     {
103
-        global $conf,$user,$langs,$db;
104
-        $conf=$this->savconf;
105
-        $user=$this->savuser;
106
-        $langs=$this->savlangs;
107
-        $db=$this->savdb;
103
+        global $conf, $user, $langs, $db;
104
+        $conf = $this->savconf;
105
+        $user = $this->savuser;
106
+        $langs = $this->savlangs;
107
+        $db = $this->savdb;
108 108
 
109 109
         print __METHOD__."\n";
110 110
         //print $db->getVersion()."\n";
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function testAccountingAccountCreate()
129 129
     {
130
-        global $conf,$user,$langs,$db;
131
-        $conf=$this->savconf;
132
-        $user=$this->savuser;
133
-        $langs=$this->savlangs;
134
-        $db=$this->savdb;
130
+        global $conf, $user, $langs, $db;
131
+        $conf = $this->savconf;
132
+        $user = $this->savuser;
133
+        $langs = $this->savlangs;
134
+        $db = $this->savdb;
135 135
 
136
-        $localobject=new AccountingAccount($this->savdb);
136
+        $localobject = new AccountingAccount($this->savdb);
137 137
         $localobject->fk_pcg_version = 'PCG99-ABREGE';
138 138
         $localobject->account_category = 0;
139 139
         $localobject->pcg_type = 'XXXXX';
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $localobject->account_parent = 0;
142 142
         $localobject->label = 'Account specimen';
143 143
         $localobject->active = 0;
144
-        $result=$localobject->create($user);
144
+        $result = $localobject->create($user);
145 145
 
146 146
         $this->assertLessThan($result, 0);
147 147
         print __METHOD__." result=".$result."\n";
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public function testAccountingAccountFetch($id)
161 161
     {
162
-        global $conf,$user,$langs,$db;
163
-        $conf=$this->savconf;
164
-        $user=$this->savuser;
165
-        $langs=$this->savlangs;
166
-        $db=$this->savdb;
162
+        global $conf, $user, $langs, $db;
163
+        $conf = $this->savconf;
164
+        $user = $this->savuser;
165
+        $langs = $this->savlangs;
166
+        $db = $this->savdb;
167 167
 
168
-        $localobject=new AccountingAccount($this->savdb);
169
-        $result=$localobject->fetch($id);
168
+        $localobject = new AccountingAccount($this->savdb);
169
+        $result = $localobject->fetch($id);
170 170
 
171 171
         $this->assertLessThan($result, 0);
172 172
         print __METHOD__." id=".$id." result=".$result."\n";
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function testAccountingAccountUpdate($localobject)
186 186
     {
187
-    	global $conf,$user,$langs,$db;
188
-    	$conf=$this->savconf;
189
-    	$user=$this->savuser;
190
-    	$langs=$this->savlangs;
191
-    	$db=$this->savdb;
187
+    	global $conf, $user, $langs, $db;
188
+    	$conf = $this->savconf;
189
+    	$user = $this->savuser;
190
+    	$langs = $this->savlangs;
191
+    	$db = $this->savdb;
192 192
 
193
-    	$localobject->label='New label';
194
-    	$result=$localobject->update($user);
193
+    	$localobject->label = 'New label';
194
+    	$result = $localobject->update($user);
195 195
 
196 196
     	$this->assertLessThan($result, 0);
197 197
     	print __METHOD__." id=".$id." result=".$result."\n";
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
      */
210 210
     public function testAccountingAccountDelete($id)
211 211
     {
212
-        global $conf,$user,$langs,$db;
213
-        $conf=$this->savconf;
214
-        $user=$this->savuser;
215
-        $langs=$this->savlangs;
216
-        $db=$this->savdb;
217
-
218
-        $localobject=new AccountingAccount($this->savdb);
219
-        $result=$localobject->fetch($id);
220
-        $result=$localobject->delete($user);
212
+        global $conf, $user, $langs, $db;
213
+        $conf = $this->savconf;
214
+        $user = $this->savuser;
215
+        $langs = $this->savlangs;
216
+        $db = $this->savdb;
217
+
218
+        $localobject = new AccountingAccount($this->savdb);
219
+        $result = $localobject->fetch($id);
220
+        $result = $localobject->delete($user);
221 221
 
222 222
         print __METHOD__." id=".$id." result=".$result."\n";
223 223
         $this->assertLessThan($result, 0);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/FactureTestRounding.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *		\remarks	To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	$user->fetch(1);
36 36
 	$user->getrights();
37 37
 }
38
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
38
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
39 39
 
40 40
 
41 41
 /**
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 		parent::__construct();
64 64
 
65 65
 		//$this->sharedFixture
66
-		global $conf,$user,$langs,$db;
67
-		$this->savconf=$conf;
68
-		$this->savuser=$user;
69
-		$this->savlangs=$langs;
70
-		$this->savdb=$db;
66
+		global $conf, $user, $langs, $db;
67
+		$this->savconf = $conf;
68
+		$this->savuser = $user;
69
+		$this->savlangs = $langs;
70
+		$this->savdb = $db;
71 71
 
72 72
 		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73 73
 		//print " - db ".$db->db;
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	// Static methods
78 78
   	public static function setUpBeforeClass()
79 79
     {
80
-    	global $conf,$user,$langs,$db;
81
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
80
+    	global $conf, $user, $langs, $db;
81
+		$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
82 82
 
83 83
     	print __METHOD__."\n";
84 84
     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     // tear down after class
87 87
     public static function tearDownAfterClass()
88 88
     {
89
-    	global $conf,$user,$langs,$db;
89
+    	global $conf, $user, $langs, $db;
90 90
 		$db->rollback();
91 91
 
92 92
 		print __METHOD__."\n";
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	protected function setUp()
101 101
     {
102
-    	global $conf,$user,$langs,$db;
103
-		$conf=$this->savconf;
104
-		$user=$this->savuser;
105
-		$langs=$this->savlangs;
106
-		$db=$this->savdb;
102
+    	global $conf, $user, $langs, $db;
103
+		$conf = $this->savconf;
104
+		$user = $this->savuser;
105
+		$langs = $this->savlangs;
106
+		$db = $this->savdb;
107 107
 
108 108
 		print __METHOD__."\n";
109 109
     }
@@ -128,29 +128,29 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function testFactureRoundingCreate1()
130 130
     {
131
-        global $conf,$user,$langs,$db;
132
-        $conf=$this->savconf;
133
-        $user=$this->savuser;
134
-        $langs=$this->savlangs;
135
-        $db=$this->savdb;
131
+        global $conf, $user, $langs, $db;
132
+        $conf = $this->savconf;
133
+        $user = $this->savuser;
134
+        $langs = $this->savlangs;
135
+        $db = $this->savdb;
136 136
 
137
-		$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
137
+		$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0;
138 138
 
139
-        $localobject=new Facture($this->savdb);
139
+        $localobject = new Facture($this->savdb);
140 140
         $localobject->initAsSpecimen();
141
-        $localobject->lines=array();
141
+        $localobject->lines = array();
142 142
         unset($localobject->total_ht);
143 143
         unset($localobject->total_ttc);
144 144
         unset($localobject->total_tva);
145
-        $result=$localobject->create($user);
145
+        $result = $localobject->create($user);
146 146
 
147 147
         // Add two lines
148
-        for ($i=0; $i<2; $i++)
148
+        for ($i = 0; $i < 2; $i++)
149 149
         {
150 150
             $localobject->addline('Description '.$i, 1.24, 1, 10);
151 151
         }
152 152
 
153
-        $newlocalobject=new Facture($this->savdb);
153
+        $newlocalobject = new Facture($this->savdb);
154 154
         $newlocalobject->fetch($result);
155 155
         //var_dump($newlocalobject);
156 156
 
@@ -171,29 +171,29 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function testFactureRoundingCreate2()
173 173
     {
174
-        global $conf,$user,$langs,$db;
175
-        $conf=$this->savconf;
176
-        $user=$this->savuser;
177
-        $langs=$this->savlangs;
178
-        $db=$this->savdb;
174
+        global $conf, $user, $langs, $db;
175
+        $conf = $this->savconf;
176
+        $user = $this->savuser;
177
+        $langs = $this->savlangs;
178
+        $db = $this->savdb;
179 179
 
180
-        $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
180
+        $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0;
181 181
 
182
-        $localobject=new Facture($this->savdb);
182
+        $localobject = new Facture($this->savdb);
183 183
         $localobject->initAsSpecimen();
184
-        $localobject->lines=array();
184
+        $localobject->lines = array();
185 185
         unset($localobject->total_ht);
186 186
         unset($localobject->total_ttc);
187 187
         unset($localobject->total_vat);
188
-        $result=$localobject->create($user);
188
+        $result = $localobject->create($user);
189 189
 
190 190
         // Add two lines
191
-        for ($i=0; $i<2; $i++)
191
+        for ($i = 0; $i < 2; $i++)
192 192
         {
193 193
             $localobject->addline('Description '.$i, 1.24, 1, 10);
194 194
         }
195 195
 
196
-        $newlocalobject=new Facture($this->savdb);
196
+        $newlocalobject = new Facture($this->savdb);
197 197
         $newlocalobject->fetch($result);
198 198
         //var_dump($newlocalobject);
199 199
 
@@ -211,31 +211,31 @@  discard block
 block discarded – undo
211 211
      */
212 212
     public function testFactureAddLine1()
213 213
     {
214
-    	global $conf,$user,$langs,$db;
215
-    	$conf=$this->savconf;
216
-    	$user=$this->savuser;
217
-    	$langs=$this->savlangs;
218
-    	$db=$this->savdb;
214
+    	global $conf, $user, $langs, $db;
215
+    	$conf = $this->savconf;
216
+    	$user = $this->savuser;
217
+    	$langs = $this->savlangs;
218
+    	$db = $this->savdb;
219 219
 
220 220
     	// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0
221
-    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
221
+    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0;
222 222
 
223
-    	$localobject1a=new Facture($this->savdb);
223
+    	$localobject1a = new Facture($this->savdb);
224 224
     	$localobject1a->initAsSpecimen('nolines');
225
-    	$facid=$localobject1a->create($user);
226
-    	$localobject1a->addline('Line 1', 6.36, 15, 21);	// This include update_price
225
+    	$facid = $localobject1a->create($user);
226
+    	$localobject1a->addline('Line 1', 6.36, 15, 21); // This include update_price
227 227
     	print __METHOD__." id=".$facid." total_ttc=".$localobject1a->total_ttc."\n";
228 228
     	$this->assertEquals(95.40, $localobject1a->total_ht);
229 229
     	$this->assertEquals(20.03, $localobject1a->total_tva);
230 230
     	$this->assertEquals(115.43, $localobject1a->total_ttc);
231 231
 
232 232
     	// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1
233
-    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1;
233
+    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1;
234 234
 
235
-    	$localobject1b=new Facture($this->savdb);
235
+    	$localobject1b = new Facture($this->savdb);
236 236
     	$localobject1b->initAsSpecimen('nolines');
237
-    	$facid=$localobject1b->create($user);
238
-    	$localobject1b->addline('Line 1', 6.36, 15, 21);	// This include update_price
237
+    	$facid = $localobject1b->create($user);
238
+    	$localobject1b->addline('Line 1', 6.36, 15, 21); // This include update_price
239 239
     	print __METHOD__." id=".$facid." total_ttc=".$localobject1b->total_ttc."\n";
240 240
     	$this->assertEquals(95.40, $localobject1b->total_ht, 'testFactureAddLine1 total_ht');
241 241
     	$this->assertEquals(20.03, $localobject1b->total_tva, 'testFactureAddLine1 total_tva');
@@ -252,18 +252,18 @@  discard block
 block discarded – undo
252 252
      */
253 253
     public function testFactureAddLine2()
254 254
     {
255
-    	global $conf,$user,$langs,$db;
256
-    	$conf=$this->savconf;
257
-    	$user=$this->savuser;
258
-    	$langs=$this->savlangs;
259
-    	$db=$this->savdb;
255
+    	global $conf, $user, $langs, $db;
256
+    	$conf = $this->savconf;
257
+    	$user = $this->savuser;
258
+    	$langs = $this->savlangs;
259
+    	$db = $this->savdb;
260 260
 
261 261
     	// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0
262
-    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
262
+    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0;
263 263
 
264
-    	$localobject2=new Facture($this->savdb);
264
+    	$localobject2 = new Facture($this->savdb);
265 265
     	$localobject2->initAsSpecimen('nolines');
266
-    	$facid=$localobject2->create($user);
266
+    	$facid = $localobject2->create($user);
267 267
     	$localobject2->addline('Line 1', 6.36, 5, 21);
268 268
     	$localobject2->addline('Line 2', 6.36, 5, 21);
269 269
     	$localobject2->addline('Line 3', 6.36, 5, 21);
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
     	$this->assertEquals(115.44, $localobject2->total_ttc);
274 274
 
275 275
     	// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1
276
-    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1;
276
+    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1;
277 277
 
278
-    	$localobject2=new Facture($this->savdb);
278
+    	$localobject2 = new Facture($this->savdb);
279 279
     	$localobject2->initAsSpecimen('nolines');
280
-    	$facid=$localobject2->create($user);
280
+    	$facid = $localobject2->create($user);
281 281
     	$localobject2->addline('Line 1', 6.36, 5, 21);
282 282
     	$localobject2->addline('Line 2', 6.36, 5, 21);
283 283
     	$localobject2->addline('Line 3', 6.36, 5, 21);
@@ -297,18 +297,18 @@  discard block
 block discarded – undo
297 297
      */
298 298
     public function testFactureAddLine3()
299 299
     {
300
-    	global $conf,$user,$langs,$db;
301
-    	$conf=$this->savconf;
302
-    	$user=$this->savuser;
303
-    	$langs=$this->savlangs;
304
-    	$db=$this->savdb;
300
+    	global $conf, $user, $langs, $db;
301
+    	$conf = $this->savconf;
302
+    	$user = $this->savuser;
303
+    	$langs = $this->savlangs;
304
+    	$db = $this->savdb;
305 305
 
306 306
     	// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0
307
-    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
307
+    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0;
308 308
 
309
-    	$localobject3=new Facture($this->savdb);
309
+    	$localobject3 = new Facture($this->savdb);
310 310
     	$localobject3->initAsSpecimen('nolines');
311
-    	$facid=$localobject3->create($user);
311
+    	$facid = $localobject3->create($user);
312 312
     	$localobject3->addline('Line 1', 6.36, 3, 21);
313 313
     	$localobject3->addline('Line 2', 6.36, 3, 21);
314 314
     	$localobject3->addline('Line 3', 6.36, 3, 21);
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
     	$this->assertEquals(115.45, $localobject3->total_ttc);
321 321
 
322 322
     	// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1
323
-    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1;
323
+    	$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1;
324 324
 
325
-    	$localobject3=new Facture($this->savdb);
325
+    	$localobject3 = new Facture($this->savdb);
326 326
     	$localobject3->initAsSpecimen('nolines');
327
-    	$facid=$localobject3->create($user);
327
+    	$facid = $localobject3->create($user);
328 328
     	$localobject3->addline('Line 1', 6.36, 3, 21);
329 329
     	$localobject3->addline('Line 2', 6.36, 3, 21);
330 330
     	$localobject3->addline('Line 3', 6.36, 3, 21);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/ImportTest.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -23,21 +23,21 @@  discard block
 block discarded – undo
23 23
  *		\remarks	To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
30 30
 
31
-if (! defined('NOREQUIREUSER'))  define('NOREQUIREUSER','1');
32
-if (! defined('NOREQUIREDB'))    define('NOREQUIREDB','1');
33
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
34
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
35
-if (! defined('NOCSRFCHECK'))    define('NOCSRFCHECK','1');
36
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
37
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1'); // If there is no menu to show
38
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
39
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
40
-if (! defined("NOLOGIN"))        define("NOLOGIN",'1');       // If this page is public (can be called outside logged session)
31
+if (!defined('NOREQUIREUSER'))  define('NOREQUIREUSER', '1');
32
+if (!defined('NOREQUIREDB'))    define('NOREQUIREDB', '1');
33
+if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
34
+if (!defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
35
+if (!defined('NOCSRFCHECK'))    define('NOCSRFCHECK', '1');
36
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
37
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1'); // If there is no menu to show
38
+if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
39
+if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
40
+if (!defined("NOLOGIN"))        define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
41 41
 
42 42
 
43 43
 /**
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 		parent::__construct();
66 66
 
67 67
 		//$this->sharedFixture
68
-		global $conf,$user,$langs,$db;
69
-		$this->savconf=$conf;
70
-		$this->savuser=$user;
71
-		$this->savlangs=$langs;
72
-		$this->savdb=$db;
68
+		global $conf, $user, $langs, $db;
69
+		$this->savconf = $conf;
70
+		$this->savuser = $user;
71
+		$this->savlangs = $langs;
72
+		$this->savdb = $db;
73 73
 
74 74
 		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
75 75
 		//print " - db ".$db->db;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	// Static methods
80 80
   	public static function setUpBeforeClass()
81 81
     {
82
-    	global $conf,$user,$langs,$db;
82
+    	global $conf, $user, $langs, $db;
83 83
 		//$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
84 84
 
85 85
     	print __METHOD__."\n";
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     // tear down after class
89 89
     public static function tearDownAfterClass()
90 90
     {
91
-    	global $conf,$user,$langs,$db;
91
+    	global $conf, $user, $langs, $db;
92 92
 		//$db->rollback();
93 93
 
94 94
 		print __METHOD__."\n";
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
     protected function setUp()
103 103
     {
104
-    	global $conf,$user,$langs,$db;
105
-		$conf=$this->savconf;
106
-		$user=$this->savuser;
107
-		$langs=$this->savlangs;
108
-		$db=$this->savdb;
104
+    	global $conf, $user, $langs, $db;
105
+		$conf = $this->savconf;
106
+		$user = $this->savuser;
107
+		$langs = $this->savlangs;
108
+		$db = $this->savdb;
109 109
 
110 110
 		print __METHOD__."\n";
111 111
     }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function testImportSample1()
129 129
     {
130
-        $file=dirname(__FILE__).'/Example_import_company_1.csv';
130
+        $file = dirname(__FILE__).'/Example_import_company_1.csv';
131 131
 
132 132
         // TODO
133 133
         // Run import on file and check the record with field "auto" are filled
Please login to merge, or discard this patch.