Completed
Branch develop (3d98b7)
by
unknown
17:59
created
test/phpunit/EmailCollectorTest.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *      \remarks    To run this script as CLI:  phpunit filename.php
25 25
  */
26 26
 
27
-global $conf,$user,$langs,$db;
27
+global $conf, $user, $langs, $db;
28 28
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
29 29
 //require_once 'PHPUnit/Autoload.php';
30 30
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	$user->fetch(1);
37 37
 	$user->getrights();
38 38
 }
39
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
39
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
40 40
 
41 41
 
42 42
 
@@ -57,23 +57,23 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function testEmailCollectorCreate()
59 59
 	{
60
-		global $conf,$user,$langs,$db;
61
-		$conf=$this->savconf;
62
-		$user=$this->savuser;
63
-		$langs=$this->savlangs;
64
-		$db=$this->savdb;
60
+		global $conf, $user, $langs, $db;
61
+		$conf = $this->savconf;
62
+		$user = $this->savuser;
63
+		$langs = $this->savlangs;
64
+		$db = $this->savdb;
65 65
 
66 66
 		$langs->load("main");
67 67
 
68 68
 		// Create supplier order with a too low quantity
69
-		$localobject=new EmailCollector($db);
70
-		$localobject->initAsSpecimen();         // Init a specimen with lines
69
+		$localobject = new EmailCollector($db);
70
+		$localobject->initAsSpecimen(); // Init a specimen with lines
71 71
 
72 72
 		$this->filters = array();
73 73
 
74 74
 		$this->actions = array();
75 75
 
76
-		$result=$localobject->create($user);
76
+		$result = $localobject->create($user);
77 77
 		print __METHOD__." result=".$result."\n";
78 78
 		$this->assertGreaterThan(0, $result, "Error on test EmailCollector create: ".$localobject->error.' '.join(',', $localobject->errors));
79 79
 
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function testEmailCollectorFetch($id)
94 94
 	{
95
-		global $conf,$user,$langs,$db;
96
-		$conf=$this->savconf;
97
-		$user=$this->savuser;
98
-		$langs=$this->savlangs;
99
-		$db=$this->savdb;
95
+		global $conf, $user, $langs, $db;
96
+		$conf = $this->savconf;
97
+		$user = $this->savuser;
98
+		$langs = $this->savlangs;
99
+		$db = $this->savdb;
100 100
 
101
-		$localobject=new EmailCollector($db);
102
-		$result=$localobject->fetch($id);
101
+		$localobject = new EmailCollector($db);
102
+		$result = $localobject->fetch($id);
103 103
 
104 104
 		print __METHOD__." id=".$id." result=".$result."\n";
105 105
 		$this->assertLessThan($result, 0);
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function testEmailCollectorCollect($localobject)
119 119
 	{
120
-		global $conf,$user,$langs,$db;
121
-		$conf=$this->savconf;
122
-		$user=$this->savuser;
123
-		$langs=$this->savlangs;
124
-		$db=$this->savdb;
120
+		global $conf, $user, $langs, $db;
121
+		$conf = $this->savconf;
122
+		$user = $this->savuser;
123
+		$langs = $this->savlangs;
124
+		$db = $this->savdb;
125 125
 
126
-		$result=$localobject->getConnectStringIMAP();
126
+		$result = $localobject->getConnectStringIMAP();
127 127
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
128 128
 		$this->assertEquals('{localhost:993/service=imap/ssl/novalidate-cert}', $result, 'Error in getConnectStringIMAP '.$localobject->error);
129 129
 
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function testEmailCollectorDelete($id)
143 143
 	{
144
-		global $conf,$user,$langs,$db;
145
-		$conf=$this->savconf;
146
-		$user=$this->savuser;
147
-		$langs=$this->savlangs;
148
-		$db=$this->savdb;
149
-
150
-		$localobject=new EmailCollector($db);
151
-		$result=$localobject->fetch($id);
152
-		$result=$localobject->delete($user);
144
+		global $conf, $user, $langs, $db;
145
+		$conf = $this->savconf;
146
+		$user = $this->savuser;
147
+		$langs = $this->savlangs;
148
+		$db = $this->savdb;
149
+
150
+		$localobject = new EmailCollector($db);
151
+		$result = $localobject->fetch($id);
152
+		$result = $localobject->delete($user);
153 153
 
154 154
 		print __METHOD__." id=".$id." result=".$result."\n";
155 155
 		$this->assertGreaterThan(0, $result);
Please login to merge, or discard this patch.
test/phpunit/TicketTest.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *		\remarks	To run this script as CLI:  phpunit filename.php
25 25
  */
26 26
 
27
-global $conf,$user,$langs,$db;
27
+global $conf, $user, $langs, $db;
28 28
 //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
29 29
 //require_once 'PHPUnit/Autoload.php';
30 30
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -37,7 +37,7 @@  discard block
 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
 /**
@@ -56,25 +56,25 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public function testTicketCreate()
58 58
 	{
59
-		global $conf,$user,$langs,$db;
60
-		$conf=$this->savconf;
61
-		$user=$this->savuser;
62
-		$langs=$this->savlangs;
63
-		$db=$this->savdb;
59
+		global $conf, $user, $langs, $db;
60
+		$conf = $this->savconf;
61
+		$user = $this->savuser;
62
+		$langs = $this->savlangs;
63
+		$db = $this->savdb;
64 64
 
65 65
 		// Try to create one with bad values
66
-		$localobject=new Ticket($db);
66
+		$localobject = new Ticket($db);
67 67
 		$localobject->initAsSpecimen();
68 68
 		$localobject->ref = '';
69
-		$result=$localobject->create($user);
69
+		$result = $localobject->create($user);
70 70
 
71 71
 		print __METHOD__." result=".$result."\n";
72 72
 		$this->assertEquals(-3, $result, $localobject->error.join(',', $localobject->errors));
73 73
 
74 74
 		// Try to create one with correct values
75
-		$localobject=new Ticket($db);
75
+		$localobject = new Ticket($db);
76 76
 		$localobject->initAsSpecimen();
77
-		$result=$localobject->create($user);
77
+		$result = $localobject->create($user);
78 78
 
79 79
 		print __METHOD__." result=".$result."\n";
80 80
 		$this->assertGreaterThan(0, $result, $localobject->error.join(',', $localobject->errors));
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function testTicketFetch($id)
95 95
 	{
96
-		global $conf,$user,$langs,$db;
97
-		$conf=$this->savconf;
98
-		$user=$this->savuser;
99
-		$langs=$this->savlangs;
100
-		$db=$this->savdb;
96
+		global $conf, $user, $langs, $db;
97
+		$conf = $this->savconf;
98
+		$user = $this->savuser;
99
+		$langs = $this->savlangs;
100
+		$db = $this->savdb;
101 101
 
102
-		$localobject=new Ticket($db);
103
-		$result=$localobject->fetch($id);
102
+		$localobject = new Ticket($db);
103
+		$result = $localobject->fetch($id);
104 104
 
105 105
 		print __METHOD__." id=".$id." result=".$result."\n";
106 106
 		$this->assertGreaterThan(0, $result);
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function testTicketmarkAsRead($localobject)
121 121
 	{
122
-		global $conf,$user,$langs,$db;
123
-		$conf=$this->savconf;
124
-		$user=$this->savuser;
125
-		$langs=$this->savlangs;
126
-		$db=$this->savdb;
122
+		global $conf, $user, $langs, $db;
123
+		$conf = $this->savconf;
124
+		$user = $this->savuser;
125
+		$langs = $this->savlangs;
126
+		$db = $this->savdb;
127 127
 
128
-		$result=$localobject->markAsRead($user);
128
+		$result = $localobject->markAsRead($user);
129 129
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
130 130
 
131 131
 		$this->assertGreaterThan(0, $result);
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public function testTicketsetProject($localobject)
145 145
 	{
146
-		global $conf,$user,$langs,$db;
147
-		$conf=$this->savconf;
148
-		$user=$this->savuser;
149
-		$langs=$this->savlangs;
150
-		$db=$this->savdb;
146
+		global $conf, $user, $langs, $db;
147
+		$conf = $this->savconf;
148
+		$user = $this->savuser;
149
+		$langs = $this->savlangs;
150
+		$db = $this->savdb;
151 151
 
152 152
 		$project_id = 1;
153 153
 
154
-		$result=$localobject->setProject($project_id);
154
+		$result = $localobject->setProject($project_id);
155 155
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
156 156
 
157 157
 		$this->assertGreaterThan(0, $result);
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	public function testTicketsetContract($localobject)
171 171
 	{
172
-		global $conf,$user,$langs,$db;
173
-		$conf=$this->savconf;
174
-		$user=$this->savuser;
175
-		$langs=$this->savlangs;
176
-		$db=$this->savdb;
172
+		global $conf, $user, $langs, $db;
173
+		$conf = $this->savconf;
174
+		$user = $this->savuser;
175
+		$langs = $this->savlangs;
176
+		$db = $this->savdb;
177 177
 
178 178
 		$contract_id = 1;
179 179
 
180
-		$result=$localobject->setContract($contract_id);
180
+		$result = $localobject->setContract($contract_id);
181 181
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
182 182
 
183 183
 		$this->assertGreaterThan(0, $result);
@@ -195,15 +195,15 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	public function testTicketsetProgression($localobject)
197 197
 	{
198
-		global $conf,$user,$langs,$db;
199
-		$conf=$this->savconf;
200
-		$user=$this->savuser;
201
-		$langs=$this->savlangs;
202
-		$db=$this->savdb;
198
+		global $conf, $user, $langs, $db;
199
+		$conf = $this->savconf;
200
+		$user = $this->savuser;
201
+		$langs = $this->savlangs;
202
+		$db = $this->savdb;
203 203
 
204 204
 		$percent = 80;
205 205
 
206
-		$result=$localobject->setProgression($percent);
206
+		$result = $localobject->setProgression($percent);
207 207
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
208 208
 
209 209
 		$this->assertGreaterThan(0, $result);
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
 	 */
222 222
 	public function testTicketassignUser($localobject)
223 223
 	{
224
-		global $conf,$user,$langs,$db;
225
-		$conf=$this->savconf;
226
-		$user=$this->savuser;
227
-		$langs=$this->savlangs;
228
-		$db=$this->savdb;
224
+		global $conf, $user, $langs, $db;
225
+		$conf = $this->savconf;
226
+		$user = $this->savuser;
227
+		$langs = $this->savlangs;
228
+		$db = $this->savdb;
229 229
 
230 230
 		$user_id_to_assign = 1;
231 231
 
232
-		$result=$localobject->assignUser($user, $user_id_to_assign);
232
+		$result = $localobject->assignUser($user, $user_id_to_assign);
233 233
 		;
234 234
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
235 235
 
@@ -248,15 +248,15 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	public function testTicketassignUserOther($localobject)
250 250
 	{
251
-		global $conf,$user,$langs,$db;
252
-		$conf=$this->savconf;
253
-		$user=$this->savuser;
254
-		$langs=$this->savlangs;
255
-		$db=$this->savdb;
251
+		global $conf, $user, $langs, $db;
252
+		$conf = $this->savconf;
253
+		$user = $this->savuser;
254
+		$langs = $this->savlangs;
255
+		$db = $this->savdb;
256 256
 
257 257
 		$user_id_to_assign = 2;
258 258
 
259
-		$result=$localobject->assignUser($user, $user_id_to_assign);
259
+		$result = $localobject->assignUser($user, $user_id_to_assign);
260 260
 		;
261 261
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
262 262
 
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	public function testTicketclose($localobject)
277 277
 	{
278
-		global $conf,$user,$langs,$db;
279
-		$conf=$this->savconf;
280
-		$user=$this->savuser;
281
-		$langs=$this->savlangs;
282
-		$db=$this->savdb;
278
+		global $conf, $user, $langs, $db;
279
+		$conf = $this->savconf;
280
+		$user = $this->savuser;
281
+		$langs = $this->savlangs;
282
+		$db = $this->savdb;
283 283
 
284
-		$result=$localobject->close($user);
284
+		$result = $localobject->close($user);
285 285
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
286 286
 
287 287
 		$this->assertGreaterThan(0, $result);
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
 	 */
301 301
 	public function testTicketDelete($id)
302 302
 	{
303
-		global $conf,$user,$langs,$db;
304
-		$conf=$this->savconf;
305
-		$user=$this->savuser;
306
-		$langs=$this->savlangs;
307
-		$db=$this->savdb;
308
-
309
-		$localobject=new Ticket($db);
310
-		$result=$localobject->fetch($id);
311
-		$result=$localobject->delete($user);
303
+		global $conf, $user, $langs, $db;
304
+		$conf = $this->savconf;
305
+		$user = $this->savuser;
306
+		$langs = $this->savlangs;
307
+		$db = $this->savdb;
308
+
309
+		$localobject = new Ticket($db);
310
+		$result = $localobject->fetch($id);
311
+		$result = $localobject->delete($user);
312 312
 
313 313
 		print __METHOD__." id=".$id." result=".$result."\n";
314 314
 		$this->assertGreaterThan(0, $result);
Please login to merge, or discard this patch.
test/phpunit/CompanyLibTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *      \remarks    To run this script as CLI:  phpunit filename.php
25 25
  */
26 26
 
27
-global $conf,$user,$langs,$db;
27
+global $conf, $user, $langs, $db;
28 28
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
29 29
 //require_once 'PHPUnit/Autoload.php';
30 30
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	$user->fetch(1);
37 37
 	$user->getrights();
38 38
 }
39
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
39
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
40 40
 
41 41
 
42 42
 /**
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function testNameCurrency()
57 57
 	{
58
-		global $conf,$user,$langs,$db;
59
-		$conf=$this->savconf;
60
-		$user=$this->savuser;
61
-		$langs=$this->savlangs;
62
-		$db=$this->savdb;
58
+		global $conf, $user, $langs, $db;
59
+		$conf = $this->savconf;
60
+		$user = $this->savuser;
61
+		$langs = $this->savlangs;
62
+		$db = $this->savdb;
63 63
 
64
-		$result=currency_name('USD');
64
+		$result = currency_name('USD');
65 65
 		print __METHOD__." result=".$result."\n";
66 66
 		$this->assertEquals('US Dollars', $result, 'Test to get currency name USD in default language '.$langs->defaultlang);
67 67
 
68
-		$outputlangs=new Translate('', $conf);
68
+		$outputlangs = new Translate('', $conf);
69 69
 		$outputlangs->setDefaultLang('fr_FR');
70 70
 
71
-		$result=currency_name('USD', 1, $outputlangs);
71
+		$result = currency_name('USD', 1, $outputlangs);
72 72
 		print __METHOD__." result=".$result."\n";
73 73
 		$this->assertEquals('USD - Dollars US', $result, 'Test to get currency name USD in default language '.$outputlangs->getDefaultLang());
74 74
 
Please login to merge, or discard this patch.
test/phpunit/XCalLibTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *      \remarks    To run this script as CLI:  phpunit filename.php
25 25
  */
26 26
 
27
-global $conf,$user,$langs,$db;
27
+global $conf, $user, $langs, $db;
28 28
 //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
29 29
 //require_once 'PHPUnit/Autoload.php';
30 30
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	$user->fetch(1);
37 37
 	$user->getrights();
38 38
 }
39
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
39
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
40 40
 
41 41
 
42 42
 /**
@@ -55,18 +55,18 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function testQuotedPrintEncodeDecode()
57 57
 	{
58
-		global $conf,$user,$langs,$db;
59
-		$conf=$this->savconf;
60
-		$user=$this->savuser;
61
-		$langs=$this->savlangs;
62
-		$db=$this->savdb;
58
+		global $conf, $user, $langs, $db;
59
+		$conf = $this->savconf;
60
+		$user = $this->savuser;
61
+		$langs = $this->savlangs;
62
+		$db = $this->savdb;
63 63
 
64
-		$stringtoencode='ABCD=1234;';
65
-		$result=quotedPrintEncode($stringtoencode);
64
+		$stringtoencode = 'ABCD=1234;';
65
+		$result = quotedPrintEncode($stringtoencode);
66 66
 		print __METHOD__." result=".$result."\n";
67 67
 		$this->assertEquals('ABCD=3D1234;', $result);
68 68
 
69
-		$resultback=quotedPrintDecode($result);
69
+		$resultback = quotedPrintDecode($result);
70 70
 		print __METHOD__." result=".$resultback."\n";
71 71
 		$this->assertEquals($stringtoencode, $resultback);
72 72
 	}
Please login to merge, or discard this patch.
test/phpunit/ProjectTest.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *		\remarks	To run this script as CLI:  phpunit filename.php
25 25
  */
26 26
 
27
-global $conf,$user,$langs,$db;
27
+global $conf, $user, $langs, $db;
28 28
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
29 29
 //require_once 'PHPUnit/Autoload.php';
30 30
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -37,7 +37,7 @@  discard block
 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
 /**
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public function testProjectCreate()
58 58
 	{
59
-		global $conf,$user,$langs,$db;
60
-		$conf=$this->savconf;
61
-		$user=$this->savuser;
62
-		$langs=$this->savlangs;
63
-		$db=$this->savdb;
59
+		global $conf, $user, $langs, $db;
60
+		$conf = $this->savconf;
61
+		$user = $this->savuser;
62
+		$langs = $this->savlangs;
63
+		$db = $this->savdb;
64 64
 
65
-		$localobject=new Project($db);
65
+		$localobject = new Project($db);
66 66
 		$localobject->initAsSpecimen();
67
-		$result=$localobject->create($user);
67
+		$result = $localobject->create($user);
68 68
 
69 69
 		$this->assertLessThan($result, 0);
70 70
 		print __METHOD__." result=".$result."\n";
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function testProjectFetch($id)
84 84
 	{
85
-		global $conf,$user,$langs,$db;
86
-		$conf=$this->savconf;
87
-		$user=$this->savuser;
88
-		$langs=$this->savlangs;
89
-		$db=$this->savdb;
85
+		global $conf, $user, $langs, $db;
86
+		$conf = $this->savconf;
87
+		$user = $this->savuser;
88
+		$langs = $this->savlangs;
89
+		$db = $this->savdb;
90 90
 
91
-		$localobject=new Project($db);
92
-		$result=$localobject->fetch($id);
91
+		$localobject = new Project($db);
92
+		$result = $localobject->fetch($id);
93 93
 
94 94
 		$this->assertLessThan($result, 0);
95 95
 		print __METHOD__." id=".$id." result=".$result."\n";
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function testProjectValid($localobject)
109 109
 	{
110
-		global $conf,$user,$langs,$db;
111
-		$conf=$this->savconf;
112
-		$user=$this->savuser;
113
-		$langs=$this->savlangs;
114
-		$db=$this->savdb;
110
+		global $conf, $user, $langs, $db;
111
+		$conf = $this->savconf;
112
+		$user = $this->savuser;
113
+		$langs = $this->savlangs;
114
+		$db = $this->savdb;
115 115
 
116
-		$result=$localobject->setValid($user);
116
+		$result = $localobject->setValid($user);
117 117
 
118 118
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
119 119
 		$this->assertLessThan($result, 0);
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 	 */
132 132
 	public function testProjectOther($localobject)
133 133
 	{
134
-		global $conf,$user,$langs,$db;
135
-		$conf=$this->savconf;
136
-		$user=$this->savuser;
137
-		$langs=$this->savlangs;
138
-		$db=$this->savdb;
134
+		global $conf, $user, $langs, $db;
135
+		$conf = $this->savconf;
136
+		$user = $this->savuser;
137
+		$langs = $this->savlangs;
138
+		$db = $this->savdb;
139 139
 
140
-		$result=$localobject->setClose($user);
140
+		$result = $localobject->setClose($user);
141 141
 
142 142
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
143 143
 		$this->assertLessThan($result, 0);
@@ -155,15 +155,15 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function testProjectDelete($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 Project($db);
165
-		$result=$localobject->fetch($id);
166
-		$result=$localobject->delete($user);
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 Project($db);
165
+		$result = $localobject->fetch($id);
166
+		$result = $localobject->delete($user);
167 167
 
168 168
 		print __METHOD__." id=".$id." result=".$result."\n";
169 169
 		$this->assertLessThan($result, 0);
Please login to merge, or discard this patch.
test/phpunit/CodingSqlTest.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *      \remarks    To run this script as CLI:  phpunit filename.php
25 25
  */
26 26
 
27
-global $conf,$user,$langs,$db;
27
+global $conf, $user, $langs, $db;
28 28
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
29 29
 //require_once 'PHPUnit/Autoload.php';
30 30
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -32,35 +32,35 @@  discard block
 block discarded – undo
32 32
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php';
33 33
 require_once dirname(__FILE__).'/CommonClassTest.class.php';
34 34
 
35
-if (! defined('NOREQUIREUSER')) {
35
+if (!defined('NOREQUIREUSER')) {
36 36
 	define('NOREQUIREUSER', '1');
37 37
 }
38
-if (! defined('NOREQUIREDB')) {
38
+if (!defined('NOREQUIREDB')) {
39 39
 	define('NOREQUIREDB', '1');
40 40
 }
41
-if (! defined('NOREQUIRESOC')) {
41
+if (!defined('NOREQUIRESOC')) {
42 42
 	define('NOREQUIRESOC', '1');
43 43
 }
44
-if (! defined('NOREQUIRETRAN')) {
44
+if (!defined('NOREQUIRETRAN')) {
45 45
 	define('NOREQUIRETRAN', '1');
46 46
 }
47
-if (! defined('NOCSRFCHECK')) {
47
+if (!defined('NOCSRFCHECK')) {
48 48
 	define('NOCSRFCHECK', '1');
49 49
 }
50
-if (! defined('NOTOKENRENEWAL')) {
50
+if (!defined('NOTOKENRENEWAL')) {
51 51
 	define('NOTOKENRENEWAL', '1');
52 52
 }
53
-if (! defined('NOREQUIREMENU')) {
53
+if (!defined('NOREQUIREMENU')) {
54 54
 	define('NOREQUIREMENU', '1'); // If there is no menu to show
55 55
 }
56
-if (! defined('NOREQUIREHTML')) {
56
+if (!defined('NOREQUIREHTML')) {
57 57
 	define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
58 58
 }
59
-if (! defined('NOREQUIREAJAX')) {
59
+if (!defined('NOREQUIREAJAX')) {
60 60
 	define('NOREQUIREAJAX', '1');
61 61
 }
62
-if (! defined("NOLOGIN")) {
63
-	define("NOLOGIN", '1');       // If this page is public (can be called outside logged session)
62
+if (!defined("NOLOGIN")) {
63
+	define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
64 64
 }
65 65
 
66 66
 if (empty($user->id)) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	$user->fetch(1);
69 69
 	$user->getrights();
70 70
 }
71
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
71
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
72 72
 
73 73
 
74 74
 /**
@@ -87,22 +87,22 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function testEscape()
89 89
 	{
90
-		global $conf,$user,$langs,$db;
91
-		$conf=$this->savconf;
92
-		$user=$this->savuser;
93
-		$langs=$this->savlangs;
94
-		$db=$this->savdb;
90
+		global $conf, $user, $langs, $db;
91
+		$conf = $this->savconf;
92
+		$user = $this->savuser;
93
+		$langs = $this->savlangs;
94
+		$db = $this->savdb;
95 95
 
96 96
 		if ($db->type == 'mysqli') {
97
-			$a = 'abc"\'def';	// string is abc"'def
97
+			$a = 'abc"\'def'; // string is abc"'def
98 98
 			print $a;
99
-			$result = $db->escape($a);	// $result must be abc\"\'def
99
+			$result = $db->escape($a); // $result must be abc\"\'def
100 100
 			$this->assertEquals('abc\"\\\'def', $result);
101 101
 		}
102 102
 		if ($db->type == 'pgsql') {
103
-			$a = 'abc"\'def';	// string is abc"'def
103
+			$a = 'abc"\'def'; // string is abc"'def
104 104
 			print $a;
105
-			$result = $db->escape($a);	// $result must be abc"''def
105
+			$result = $db->escape($a); // $result must be abc"''def
106 106
 			$this->assertEquals('abc"\'\'def', $result);
107 107
 		}
108 108
 	}
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function testEscapeForLike()
116 116
 	{
117
-		global $conf,$user,$langs,$db;
118
-		$conf=$this->savconf;
119
-		$user=$this->savuser;
120
-		$langs=$this->savlangs;
121
-		$db=$this->savdb;
117
+		global $conf, $user, $langs, $db;
118
+		$conf = $this->savconf;
119
+		$user = $this->savuser;
120
+		$langs = $this->savlangs;
121
+		$db = $this->savdb;
122 122
 
123 123
 		$a = 'abc"\'def_ghi%klm\\nop';
124 124
 		//print $a;
125
-		$result = $db->escapeforlike($a);	// $result must be abc"'def\_ghi\%klm\\nop with mysql
125
+		$result = $db->escapeforlike($a); // $result must be abc"'def\_ghi\%klm\\nop with mysql
126 126
 		$this->assertEquals('abc"\'def\_ghi\%klm\\\\nop', $result);
127 127
 	}
128 128
 
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function testSql()
135 135
 	{
136
-		global $conf,$user,$langs,$db;
137
-		$conf=$this->savconf;
138
-		$user=$this->savuser;
139
-		$langs=$this->savlangs;
140
-		$db=$this->savdb;
136
+		global $conf, $user, $langs, $db;
137
+		$conf = $this->savconf;
138
+		$user = $this->savuser;
139
+		$langs = $this->savlangs;
140
+		$db = $this->savdb;
141 141
 
142 142
 		$listofsqldir = array(DOL_DOCUMENT_ROOT.'/install/mysql/data', DOL_DOCUMENT_ROOT.'/install/mysql/tables', DOL_DOCUMENT_ROOT.'/install/mysql/migration');
143 143
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			$filesarray = scandir($dir);
147 147
 
148 148
 			foreach ($filesarray as $key => $file) {
149
-				if (! preg_match('/\.sql$/', $file)) {
149
+				if (!preg_match('/\.sql$/', $file)) {
150 150
 					continue;
151 151
 				}
152 152
 
@@ -161,37 +161,37 @@  discard block
 block discarded – undo
161 161
 				//$filecontent = preg_replace('/^--.*$/', '', $filecontent);
162 162
 				$filecontent = preg_replace('/--.*?\n/', '', $filecontent);
163 163
 
164
-				$result=strpos($filecontent, '`');
164
+				$result = strpos($filecontent, '`');
165 165
 				//print __METHOD__." Result for checking we don't have back quote = ".$result."\n";
166
-				$this->assertTrue($result===false, 'Found back quote into '.$file.'. Bad.');
166
+				$this->assertTrue($result === false, 'Found back quote into '.$file.'. Bad.');
167 167
 
168
-				$result=strpos($filecontent, '"');
168
+				$result = strpos($filecontent, '"');
169 169
 				//print __METHOD__." Result for checking we don't have double quote = ".$result."\n";
170
-				$this->assertTrue($result===false, 'Found double quote that is not [" neither {" (used for json content) neither (" (used for content with string like isModEnabled("")) into '.$file.'. Bad.');
170
+				$this->assertTrue($result === false, 'Found double quote that is not [" neither {" (used for json content) neither (" (used for content with string like isModEnabled("")) into '.$file.'. Bad.');
171 171
 
172
-				$result=strpos($filecontent, 'int(');
172
+				$result = strpos($filecontent, 'int(');
173 173
 				//print __METHOD__." Result for checking we don't have 'int(' instead of 'integer' = ".$result."\n";
174
-				$this->assertTrue($result===false, 'Found int(x) or tinyint(x) instead of integer or tinyint into '.$file.'. Bad.');
174
+				$this->assertTrue($result === false, 'Found int(x) or tinyint(x) instead of integer or tinyint into '.$file.'. Bad.');
175 175
 
176
-				$result=strpos($filecontent, 'ON DELETE CASCADE');
176
+				$result = strpos($filecontent, 'ON DELETE CASCADE');
177 177
 				//print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n";
178
-				$this->assertTrue($result===false, 'Found ON DELETE CASCADE into '.$file.'. Bad.');
178
+				$this->assertTrue($result === false, 'Found ON DELETE CASCADE into '.$file.'. Bad.');
179 179
 
180
-				$result=strpos($filecontent, 'NUMERIC(');
180
+				$result = strpos($filecontent, 'NUMERIC(');
181 181
 				//print __METHOD__." Result for checking we don't have 'NUMERIC(' = ".$result."\n";
182
-				$this->assertTrue($result===false, 'Found NUMERIC( into '.$file.'. Bad.');
182
+				$this->assertTrue($result === false, 'Found NUMERIC( into '.$file.'. Bad.');
183 183
 
184
-				$result=strpos($filecontent, 'NUMERIC(');
184
+				$result = strpos($filecontent, 'NUMERIC(');
185 185
 				//print __METHOD__." Result for checking we don't have 'curdate(' = ".$result."\n";
186
-				$this->assertTrue($result===false, 'Found curdate( into '.$file.'. Bad. Current date must be generated with PHP.');
186
+				$this->assertTrue($result === false, 'Found curdate( into '.$file.'. Bad. Current date must be generated with PHP.');
187 187
 
188
-				$result=strpos($filecontent, 'integer(');
188
+				$result = strpos($filecontent, 'integer(');
189 189
 				//print __METHOD__." Result for checking we don't have 'integer(' = ".$result."\n";
190
-				$this->assertTrue($result===false, 'Found value in parenthesis after the integer. It must be integer not integer(x) into '.$file.'. Bad.');
190
+				$this->assertTrue($result === false, 'Found value in parenthesis after the integer. It must be integer not integer(x) into '.$file.'. Bad.');
191 191
 
192
-				$result=strpos($filecontent, 'timestamp,');
192
+				$result = strpos($filecontent, 'timestamp,');
193 193
 				//print __METHOD__." Result for checking we don't have 'NUMERIC(' = ".$result."\n";
194
-				$this->assertTrue($result===false, 'Found type timestamp with option DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP after into '.$file.'. Bad.');
194
+				$this->assertTrue($result === false, 'Found type timestamp with option DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP after into '.$file.'. Bad.');
195 195
 
196 196
 				if ($dir == DOL_DOCUMENT_ROOT.'/install/mysql/migration') {
197 197
 					// Test for migration files only
@@ -202,11 +202,11 @@  discard block
 block discarded – undo
202 202
 						// Test for key files only
203 203
 					} else {
204 204
 						// Test for non key files only
205
-						$result=(strpos($filecontent, 'KEY ') && strpos($filecontent, 'PRIMARY KEY') == 0);
205
+						$result = (strpos($filecontent, 'KEY ') && strpos($filecontent, 'PRIMARY KEY') == 0);
206 206
 						//print __METHOD__." Result for checking we don't have ' KEY ' instead of a sql file to create index = ".$result."\n";
207
-						$this->assertTrue($result===false, 'Found KEY into '.$file.'. Bad.');
207
+						$this->assertTrue($result === false, 'Found KEY into '.$file.'. Bad.');
208 208
 
209
-						$result=stripos($filecontent, 'ENGINE=innodb');
209
+						$result = stripos($filecontent, 'ENGINE=innodb');
210 210
 						//print __METHOD__." Result for checking we have the ENGINE=innodb string = ".$result."\n";
211 211
 						$this->assertGreaterThan(0, $result, 'The ENGINE=innodb was not found into '.$file.'. Add it or just fix syntax to match case.');
212 212
 					}
@@ -224,32 +224,32 @@  discard block
 block discarded – undo
224 224
 	 */
225 225
 	public function testInitData()
226 226
 	{
227
-		global $conf,$user,$langs,$db;
228
-		$conf=$this->savconf;
229
-		$user=$this->savuser;
230
-		$langs=$this->savlangs;
231
-		$db=$this->savdb;
227
+		global $conf, $user, $langs, $db;
228
+		$conf = $this->savconf;
229
+		$user = $this->savuser;
230
+		$langs = $this->savlangs;
231
+		$db = $this->savdb;
232 232
 
233 233
 		$filesarray = scandir(DOL_DOCUMENT_ROOT.'/../dev/initdemo');
234 234
 		foreach ($filesarray as $key => $file) {
235
-			if (! preg_match('/\.sql$/', $file)) {
235
+			if (!preg_match('/\.sql$/', $file)) {
236 236
 				continue;
237 237
 			}
238 238
 
239 239
 			print 'Check sql file '.$file."\n";
240
-			$filecontent=file_get_contents(DOL_DOCUMENT_ROOT.'/../dev/initdemo/'.$file);
240
+			$filecontent = file_get_contents(DOL_DOCUMENT_ROOT.'/../dev/initdemo/'.$file);
241 241
 
242
-			$result=strpos($filecontent, '@gmail.com');
242
+			$result = strpos($filecontent, '@gmail.com');
243 243
 			print __METHOD__." Result for checking we don't have personal data = ".$result."\n";
244
-			$this->assertTrue($result===false, 'Found a bad key @gmail into file '.$file);
244
+			$this->assertTrue($result === false, 'Found a bad key @gmail into file '.$file);
245 245
 
246
-			$result=strpos($filecontent, 'eldy@');
246
+			$result = strpos($filecontent, 'eldy@');
247 247
 			print __METHOD__." Result for checking we don't have personal data = ".$result."\n";
248
-			$this->assertTrue($result===false, 'Found a bad key eldy@ into file '.$file);
248
+			$this->assertTrue($result === false, 'Found a bad key eldy@ into file '.$file);
249 249
 
250
-			$result=strpos($filecontent, 'INSERT INTO `llx_oauth_token`');
250
+			$result = strpos($filecontent, 'INSERT INTO `llx_oauth_token`');
251 251
 			print __METHOD__." Result for checking we don't have data into llx_oauth_token = ".$result."\n";
252
-			$this->assertTrue($result===false, 'Found a non expected insert into file '.$file);
252
+			$this->assertTrue($result === false, 'Found a non expected insert into file '.$file);
253 253
 		}
254 254
 
255 255
 		return;
Please login to merge, or discard this patch.
test/phpunit/ContactTest.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *		\remarks	To run this script as CLI:  phpunit filename.php
25 25
  */
26 26
 
27
-global $conf,$user,$langs,$db;
27
+global $conf, $user, $langs, $db;
28 28
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
29 29
 //require_once 'PHPUnit/Autoload.php';
30 30
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	$user->getrights();
45 45
 }
46 46
 
47
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
47
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
48 48
 
49 49
 
50 50
 /**
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function testContactCreate()
65 65
 	{
66
-		global $conf,$user,$langs,$db;
67
-		$conf=$this->savconf;
68
-		$user=$this->savuser;
69
-		$langs=$this->savlangs;
70
-		$db=$this->savdb;
66
+		global $conf, $user, $langs, $db;
67
+		$conf = $this->savconf;
68
+		$user = $this->savuser;
69
+		$langs = $this->savlangs;
70
+		$db = $this->savdb;
71 71
 
72
-		$localobject=new Contact($db);
72
+		$localobject = new Contact($db);
73 73
 		$localobject->initAsSpecimen();
74
-		$result=$localobject->create($user);
74
+		$result = $localobject->create($user);
75 75
 
76 76
 		print __METHOD__." result=".$result."\n";
77 77
 		$this->assertLessThan($result, 0);
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function testContactFetch($id)
91 91
 	{
92
-		global $conf,$user,$langs,$db;
93
-		$conf=$this->savconf;
94
-		$user=$this->savuser;
95
-		$langs=$this->savlangs;
96
-		$db=$this->savdb;
92
+		global $conf, $user, $langs, $db;
93
+		$conf = $this->savconf;
94
+		$user = $this->savuser;
95
+		$langs = $this->savlangs;
96
+		$db = $this->savdb;
97 97
 
98
-		$localobject=new Contact($db);
99
-		$result=$localobject->fetch($id);
98
+		$localobject = new Contact($db);
99
+		$result = $localobject->fetch($id);
100 100
 
101 101
 		print __METHOD__." id=".$id." result=".$result."\n";
102 102
 		$this->assertLessThan($result, 0);
@@ -115,45 +115,45 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function testContactUpdate($localobject)
117 117
 	{
118
-		global $conf,$user,$langs,$db;
119
-		$conf=$this->savconf;
120
-		$user=$this->savuser;
121
-		$langs=$this->savlangs;
122
-		$db=$this->savdb;
118
+		global $conf, $user, $langs, $db;
119
+		$conf = $this->savconf;
120
+		$user = $this->savuser;
121
+		$langs = $this->savlangs;
122
+		$db = $this->savdb;
123 123
 
124 124
 		$localobject->oldcopy = clone $localobject;
125 125
 
126
-		$localobject->note_private='New private note after update';
127
-		$localobject->note_public='New public note after update';
128
-		$localobject->lastname='New name';
129
-		$localobject->firstname='New firstname';
130
-		$localobject->address='New address';
131
-		$localobject->zip='New zip';
132
-		$localobject->town='New town';
133
-		$localobject->country_id=2;
126
+		$localobject->note_private = 'New private note after update';
127
+		$localobject->note_public = 'New public note after update';
128
+		$localobject->lastname = 'New name';
129
+		$localobject->firstname = 'New firstname';
130
+		$localobject->address = 'New address';
131
+		$localobject->zip = 'New zip';
132
+		$localobject->town = 'New town';
133
+		$localobject->country_id = 2;
134 134
 		//$localobject->status=0;
135
-		$localobject->phone_pro='New tel pro';
136
-		$localobject->phone_perso='New tel perso';
137
-		$localobject->phone_mobile='New tel mobile';
138
-		$localobject->fax='New fax';
139
-		$localobject->email='[email protected]';
140
-		$localobject->socialnetworks['jabber']='New im id';
141
-		$localobject->default_lang='es_ES';
142
-
143
-		$result=$localobject->update($localobject->id, $user);
135
+		$localobject->phone_pro = 'New tel pro';
136
+		$localobject->phone_perso = 'New tel perso';
137
+		$localobject->phone_mobile = 'New tel mobile';
138
+		$localobject->fax = 'New fax';
139
+		$localobject->email = '[email protected]';
140
+		$localobject->socialnetworks['jabber'] = 'New im id';
141
+		$localobject->default_lang = 'es_ES';
142
+
143
+		$result = $localobject->update($localobject->id, $user);
144 144
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
145 145
 		$this->assertLessThan($result, 0, 'Contact::update error');
146 146
 
147
-		$result=$localobject->update_note($localobject->note_private, '_private');
147
+		$result = $localobject->update_note($localobject->note_private, '_private');
148 148
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
149 149
 		$this->assertLessThan($result, 0, 'Contact::update_note (private) error');
150 150
 
151
-		$result=$localobject->update_note($localobject->note_public, '_public');
151
+		$result = $localobject->update_note($localobject->note_public, '_public');
152 152
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
153 153
 		$this->assertLessThan($result, 0, 'Contact::update_note (public) error');
154 154
 
155
-		$newobject=new Contact($db);
156
-		$result=$newobject->fetch($localobject->id);
155
+		$newobject = new Contact($db);
156
+		$result = $newobject->fetch($localobject->id);
157 157
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
158 158
 		$this->assertLessThan($result, 0, 'Contact::fetch error');
159 159
 
@@ -206,19 +206,19 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function testContactOther($localobject)
208 208
 	{
209
-		global $conf,$user,$langs,$db;
210
-		$conf=$this->savconf;
211
-		$user=$this->savuser;
212
-		$langs=$this->savlangs;
213
-		$db=$this->savdb;
209
+		global $conf, $user, $langs, $db;
210
+		$conf = $this->savconf;
211
+		$user = $this->savuser;
212
+		$langs = $this->savlangs;
213
+		$db = $this->savdb;
214 214
 
215 215
 		//$localobject->fetch($localobject->id);
216 216
 
217
-		$result=$localobject->getNomUrl(1);
217
+		$result = $localobject->getNomUrl(1);
218 218
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
219 219
 		$this->assertNotEquals($result, '');
220 220
 
221
-		$result=$localobject->getFullAddress(1);
221
+		$result = $localobject->getFullAddress(1);
222 222
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
223 223
 		$this->assertStringContainsString("New address\nNew zip New town\nBelgium", $result);
224 224
 
@@ -240,16 +240,16 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function testContactDelete($id)
242 242
 	{
243
-		global $conf,$user,$langs,$db;
244
-		$conf=$this->savconf;
245
-		$user=$this->savuser;
246
-		$langs=$this->savlangs;
247
-		$db=$this->savdb;
243
+		global $conf, $user, $langs, $db;
244
+		$conf = $this->savconf;
245
+		$user = $this->savuser;
246
+		$langs = $this->savlangs;
247
+		$db = $this->savdb;
248 248
 
249
-		$localobject=new Contact($db);
250
-		$result=$localobject->fetch($id);
249
+		$localobject = new Contact($db);
250
+		$result = $localobject->fetch($id);
251 251
 
252
-		$result=$localobject->delete($user);
252
+		$result = $localobject->delete($user);
253 253
 		print __METHOD__." id=".$id." result=".$result."\n";
254 254
 		$this->assertLessThan($result, 0);
255 255
 
@@ -263,56 +263,56 @@  discard block
 block discarded – undo
263 263
 	 */
264 264
 	public function testContactGetFullAddress()
265 265
 	{
266
-		global $conf,$user,$langs,$db;
267
-		$conf=$this->savconf;
268
-		$user=$this->savuser;
269
-		$langs=$this->savlangs;
270
-		$db=$this->savdb;
266
+		global $conf, $user, $langs, $db;
267
+		$conf = $this->savconf;
268
+		$user = $this->savuser;
269
+		$langs = $this->savlangs;
270
+		$db = $this->savdb;
271 271
 
272
-		$localobjectadd=new Contact($db);
272
+		$localobjectadd = new Contact($db);
273 273
 		$localobjectadd->initAsSpecimen();
274 274
 
275 275
 		// France
276 276
 		unset($localobjectadd->country_code);
277
-		$localobjectadd->country_id=1;
278
-		$localobjectadd->name='New name';
279
-		$localobjectadd->address='New address';
280
-		$localobjectadd->zip='New zip';
281
-		$localobjectadd->town='New town';
282
-		$result=$localobjectadd->getFullAddress(1);
277
+		$localobjectadd->country_id = 1;
278
+		$localobjectadd->name = 'New name';
279
+		$localobjectadd->address = 'New address';
280
+		$localobjectadd->zip = 'New zip';
281
+		$localobjectadd->town = 'New town';
282
+		$result = $localobjectadd->getFullAddress(1);
283 283
 		print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
284 284
 		$this->assertStringContainsString("New address\nNew zip New town\nFrance", $result);
285 285
 
286 286
 		// Belgium
287 287
 		unset($localobjectadd->country_code);
288
-		$localobjectadd->country_id=2;
289
-		$localobjectadd->name='New name';
290
-		$localobjectadd->address='New address';
291
-		$localobjectadd->zip='New zip';
292
-		$localobjectadd->town='New town';
293
-		$result=$localobjectadd->getFullAddress(1);
288
+		$localobjectadd->country_id = 2;
289
+		$localobjectadd->name = 'New name';
290
+		$localobjectadd->address = 'New address';
291
+		$localobjectadd->zip = 'New zip';
292
+		$localobjectadd->town = 'New town';
293
+		$result = $localobjectadd->getFullAddress(1);
294 294
 		print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
295 295
 		$this->assertStringContainsString("New address\nNew zip New town\nBelgium", $result);
296 296
 
297 297
 		// Switzerland
298 298
 		unset($localobjectadd->country_code);
299
-		$localobjectadd->country_id=6;
300
-		$localobjectadd->name='New name';
301
-		$localobjectadd->address='New address';
302
-		$localobjectadd->zip='New zip';
303
-		$localobjectadd->town='New town';
304
-		$result=$localobjectadd->getFullAddress(1);
299
+		$localobjectadd->country_id = 6;
300
+		$localobjectadd->name = 'New name';
301
+		$localobjectadd->address = 'New address';
302
+		$localobjectadd->zip = 'New zip';
303
+		$localobjectadd->town = 'New town';
304
+		$result = $localobjectadd->getFullAddress(1);
305 305
 		print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
306 306
 		$this->assertStringContainsString("New address\nNew zip New town\nSwitzerland", $result);
307 307
 
308 308
 		// USA
309 309
 		unset($localobjectadd->country_code);
310
-		$localobjectadd->country_id=11;
311
-		$localobjectadd->name='New name';
312
-		$localobjectadd->address='New address';
313
-		$localobjectadd->zip='New zip';
314
-		$localobjectadd->town='New town';
315
-		$result=$localobjectadd->getFullAddress(1);
310
+		$localobjectadd->country_id = 11;
311
+		$localobjectadd->name = 'New name';
312
+		$localobjectadd->address = 'New address';
313
+		$localobjectadd->zip = 'New zip';
314
+		$localobjectadd->town = 'New town';
315
+		$result = $localobjectadd->getFullAddress(1);
316 316
 		print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
317 317
 		$this->assertStringContainsString("New address\nNew town, New zip\nUnited States", $result);
318 318
 
Please login to merge, or discard this patch.
test/phpunit/CompanyBankAccountTest.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *		\remarks	To run this script as CLI:  phpunit filename.php
25 25
  */
26 26
 
27
-global $conf,$user,$langs,$db;
27
+global $conf, $user, $langs, $db;
28 28
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
29 29
 //require_once 'PHPUnit/Autoload.php';
30 30
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	$user->fetch(1);
37 37
 	$user->getrights();
38 38
 }
39
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
39
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
40 40
 
41 41
 
42 42
 /**
@@ -55,21 +55,21 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function testCompanyBankAccountCreate()
57 57
 	{
58
-		global $conf,$user,$langs,$db;
59
-		$conf=$this->savconf;
60
-		$user=$this->savuser;
61
-		$langs=$this->savlangs;
62
-		$db=$this->savdb;
58
+		global $conf, $user, $langs, $db;
59
+		$conf = $this->savconf;
60
+		$user = $this->savuser;
61
+		$langs = $this->savlangs;
62
+		$db = $this->savdb;
63 63
 
64 64
 		$soc = new Societe($db);
65 65
 		$soc->name = "CompanyBankAccountTest Unittest";
66 66
 		$socid = $soc->create($user);
67 67
 		$this->assertLessThan($socid, 0, $soc->errorsToString());
68 68
 
69
-		$localobject=new CompanyBankAccount($db);
69
+		$localobject = new CompanyBankAccount($db);
70 70
 		$localobject->initAsSpecimen();
71 71
 		$localobject->socid = $socid;
72
-		$result=$localobject->create($user);
72
+		$result = $localobject->create($user);
73 73
 
74 74
 		print __METHOD__." result=".$result." id=".$localobject->id."\n";
75 75
 		$this->assertLessThan($result, 0, $localobject->errorsToString());
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function testCompanyBankAccountFetch($id)
89 89
 	{
90
-		global $conf,$user,$langs,$db;
91
-		$conf=$this->savconf;
92
-		$user=$this->savuser;
93
-		$langs=$this->savlangs;
94
-		$db=$this->savdb;
95
-
96
-		$localobject=new CompanyBankAccount($db);
97
-		$result=$localobject->fetch($id);
90
+		global $conf, $user, $langs, $db;
91
+		$conf = $this->savconf;
92
+		$user = $this->savuser;
93
+		$langs = $this->savlangs;
94
+		$db = $this->savdb;
95
+
96
+		$localobject = new CompanyBankAccount($db);
97
+		$result = $localobject->fetch($id);
98 98
 		print __METHOD__." id=".$id." result=".$result."\n";
99 99
 		$this->assertLessThan($result, 0);
100 100
 		return $localobject;
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function testCompanyBankAccountSetAsDefault($localobject)
112 112
 	{
113
-		global $conf,$user,$langs,$db;
114
-		$conf=$this->savconf;
115
-		$user=$this->savuser;
116
-		$langs=$this->savlangs;
117
-		$db=$this->savdb;
113
+		global $conf, $user, $langs, $db;
114
+		$conf = $this->savconf;
115
+		$user = $this->savuser;
116
+		$langs = $this->savlangs;
117
+		$db = $this->savdb;
118 118
 
119
-		$result=$localobject->setAsDefault($localobject->id);
119
+		$result = $localobject->setAsDefault($localobject->id);
120 120
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
121 121
 		$this->assertLessThan($result, 0);
122 122
 		return $localobject;
@@ -133,14 +133,14 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function testCompanyBankAccountUpdate($localobject)
135 135
 	{
136
-		global $conf,$user,$langs,$db;
137
-		$conf=$this->savconf;
138
-		$user=$this->savuser;
139
-		$langs=$this->savlangs;
140
-		$db=$this->savdb;
136
+		global $conf, $user, $langs, $db;
137
+		$conf = $this->savconf;
138
+		$user = $this->savuser;
139
+		$langs = $this->savlangs;
140
+		$db = $this->savdb;
141 141
 
142
-		$localobject->owner='New owner';
143
-		$result=$localobject->update($user);
142
+		$localobject->owner = 'New owner';
143
+		$result = $localobject->update($user);
144 144
 
145 145
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
146 146
 		$this->assertLessThan($result, 0);
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function testCompanyBankAccountOther($localobject)
160 160
 	{
161
-		global $conf,$user,$langs,$db;
162
-		$conf=$this->savconf;
163
-		$user=$this->savuser;
164
-		$langs=$this->savlangs;
165
-		$db=$this->savdb;
166
-
167
-		$localobject->owner='New owner';
168
-		$result=$localobject->update($user);
161
+		global $conf, $user, $langs, $db;
162
+		$conf = $this->savconf;
163
+		$user = $this->savuser;
164
+		$langs = $this->savlangs;
165
+		$db = $this->savdb;
166
+
167
+		$localobject->owner = 'New owner';
168
+		$result = $localobject->update($user);
169 169
 
170 170
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
171 171
 		$this->assertLessThan($result, 0);
Please login to merge, or discard this patch.
test/phpunit/CoreTest.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *      \remarks    To run this script as CLI:  phpunit filename.php
25 25
  */
26 26
 
27
-global $conf,$user,$langs,$db;
27
+global $conf, $user, $langs, $db;
28 28
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
29 29
 //require_once 'PHPUnit/Autoload.php';
30 30
 //require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -32,35 +32,35 @@  discard block
 block discarded – undo
32 32
 require_once dirname(__FILE__).'/CommonClassTest.class.php';
33 33
 
34 34
 
35
-if (! defined('NOREQUIREUSER')) {
35
+if (!defined('NOREQUIREUSER')) {
36 36
 	define('NOREQUIREUSER', '1');
37 37
 }
38
-if (! defined('NOREQUIREDB')) {
38
+if (!defined('NOREQUIREDB')) {
39 39
 	define('NOREQUIREDB', '1');
40 40
 }
41
-if (! defined('NOREQUIRESOC')) {
41
+if (!defined('NOREQUIRESOC')) {
42 42
 	define('NOREQUIRESOC', '1');
43 43
 }
44
-if (! defined('NOREQUIRETRAN')) {
44
+if (!defined('NOREQUIRETRAN')) {
45 45
 	define('NOREQUIRETRAN', '1');
46 46
 }
47
-if (! defined('NOCSRFCHECK')) {
47
+if (!defined('NOCSRFCHECK')) {
48 48
 	define('NOCSRFCHECK', '1');
49 49
 }
50
-if (! defined('NOTOKENRENEWAL')) {
50
+if (!defined('NOTOKENRENEWAL')) {
51 51
 	define('NOTOKENRENEWAL', '1');
52 52
 }
53
-if (! defined('NOREQUIREMENU')) {
53
+if (!defined('NOREQUIREMENU')) {
54 54
 	define('NOREQUIREMENU', '1'); // If there is no menu to show
55 55
 }
56
-if (! defined('NOREQUIREHTML')) {
56
+if (!defined('NOREQUIREHTML')) {
57 57
 	define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
58 58
 }
59
-if (! defined('NOREQUIREAJAX')) {
59
+if (!defined('NOREQUIREAJAX')) {
60 60
 	define('NOREQUIREAJAX', '1');
61 61
 }
62
-if (! defined("NOLOGIN")) {
63
-	define("NOLOGIN", '1');       // If this page is public (can be called outside logged session)
62
+if (!defined("NOLOGIN")) {
63
+	define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
64 64
 }
65 65
 
66 66
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		global $dolibarr_main_db_type;
93 93
 		global $dolibarr_main_db_prefix;
94 94
 
95
-		$testtodo=0;
95
+		$testtodo = 0;
96 96
 
97 97
 		// Case 1:
98 98
 		// Test for subdir dolibarrnew (that point to htdocs) in root directory /var/www
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 		// - Create link from htdocs to /var/www/dolibarrnew
102 102
 		// - Put into conf.php $dolibarr_main_document_root='/var/www/dolibarrnew';
103 103
 		if ($testtodo == 1) {
104
-			$_SERVER["HTTPS"]='';
105
-			$_SERVER["SERVER_NAME"]='localhost';
106
-			$_SERVER["SERVER_PORT"]='80';
107
-			$_SERVER["DOCUMENT_ROOT"]='/var/www';
108
-			$_SERVER["SCRIPT_NAME"]='/dolibarrnew/admin/system/phpinfo.php';
109
-			$expectedresult='/dolibarrnew';
104
+			$_SERVER["HTTPS"] = '';
105
+			$_SERVER["SERVER_NAME"] = 'localhost';
106
+			$_SERVER["SERVER_PORT"] = '80';
107
+			$_SERVER["DOCUMENT_ROOT"] = '/var/www';
108
+			$_SERVER["SCRIPT_NAME"] = '/dolibarrnew/admin/system/phpinfo.php';
109
+			$expectedresult = '/dolibarrnew';
110 110
 		}
111 111
 
112 112
 		// Case 2:
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
 		// - Create link from dolibarr to /var/www/aaa
117 117
 		// - Put into conf.php $dolibarr_main_document_root='/var/www/aaa/htdocs';
118 118
 		if ($testtodo == 2) {
119
-			$_SERVER["HTTPS"]='';
120
-			$_SERVER["SERVER_NAME"]='localhost';
121
-			$_SERVER["SERVER_PORT"]='80';
122
-			$_SERVER["DOCUMENT_ROOT"]='/var/www';
123
-			$_SERVER["SCRIPT_NAME"]='/aaa/htdocs/admin/system/phpinfo.php';
124
-			$expectedresult='/aaa/htdocs';
119
+			$_SERVER["HTTPS"] = '';
120
+			$_SERVER["SERVER_NAME"] = 'localhost';
121
+			$_SERVER["SERVER_PORT"] = '80';
122
+			$_SERVER["DOCUMENT_ROOT"] = '/var/www';
123
+			$_SERVER["SCRIPT_NAME"] = '/aaa/htdocs/admin/system/phpinfo.php';
124
+			$expectedresult = '/aaa/htdocs';
125 125
 		}
126 126
 
127 127
 		// Case 3:
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 		// - Create virtual host localhostdolibarrnew that point to /home/ldestailleur/git/dolibarr/htdocs
133 133
 		// - Put into conf.php $dolibarr_main_document_root='/home/ldestailleur/git/dolibarr/htdocs';
134 134
 		if ($testtodo == 3) {
135
-			$_SERVER["HTTPS"]='';
136
-			$_SERVER["SERVER_NAME"]='localhostdolibarrnew';
137
-			$_SERVER["SERVER_PORT"]='80';
138
-			$_SERVER["DOCUMENT_ROOT"]='/home/ldestailleur/git/dolibarr/htdocs';
139
-			$_SERVER["SCRIPT_NAME"]='/admin/system/phpinfo.php';
140
-			$expectedresult='';
135
+			$_SERVER["HTTPS"] = '';
136
+			$_SERVER["SERVER_NAME"] = 'localhostdolibarrnew';
137
+			$_SERVER["SERVER_PORT"] = '80';
138
+			$_SERVER["DOCUMENT_ROOT"] = '/home/ldestailleur/git/dolibarr/htdocs';
139
+			$_SERVER["SCRIPT_NAME"] = '/admin/system/phpinfo.php';
140
+			$expectedresult = '';
141 141
 		}
142 142
 
143 143
 		// Case 4:
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
 		// a symbolic link
146 146
 		// URL: http://localhostdolibarrnew/admin/system/phpinfo.php
147 147
 		if ($testtodo == 4) {
148
-			$_SERVER["HTTPS"]='';
149
-			$_SERVER["SERVER_NAME"]='localhostdolibarrnew';
150
-			$_SERVER["SERVER_PORT"]='80';
151
-			$_SERVER["DOCUMENT_ROOT"]='/var/www/dolibarr';	// This is a link that point to /home/ldestail/workspace/dolibarr/htdocs
152
-			$_SERVER["SCRIPT_NAME"]='/admin/system/phpinfo.php';
153
-			$expectedresult='';
148
+			$_SERVER["HTTPS"] = '';
149
+			$_SERVER["SERVER_NAME"] = 'localhostdolibarrnew';
150
+			$_SERVER["SERVER_PORT"] = '80';
151
+			$_SERVER["DOCUMENT_ROOT"] = '/var/www/dolibarr'; // This is a link that point to /home/ldestail/workspace/dolibarr/htdocs
152
+			$_SERVER["SCRIPT_NAME"] = '/admin/system/phpinfo.php';
153
+			$expectedresult = '';
154 154
 		}
155 155
 
156 156
 		// Case 5:
@@ -161,12 +161,12 @@  discard block
 block discarded – undo
161 161
 		// - Put into conf.php $dolibarr_main_document_root='/var/www/dolibarr/htdocs';
162 162
 		// - Put into conf.php $dolibarr_main_url_root='http://localhost/dolibarralias';  (because autodetect will fails in this case)
163 163
 		if ($testtodo == 5) {
164
-			$_SERVER["HTTPS"]='';
165
-			$_SERVER["SERVER_NAME"]='localhost';
166
-			$_SERVER["SERVER_PORT"]='80';
167
-			$_SERVER["DOCUMENT_ROOT"]='/var/www';
168
-			$_SERVER["SCRIPT_NAME"]='/dolibarralias/admin/system/phpinfo.php';
169
-			$expectedresult='/dolibarralias';
164
+			$_SERVER["HTTPS"] = '';
165
+			$_SERVER["SERVER_NAME"] = 'localhost';
166
+			$_SERVER["SERVER_PORT"] = '80';
167
+			$_SERVER["DOCUMENT_ROOT"] = '/var/www';
168
+			$_SERVER["SCRIPT_NAME"] = '/dolibarralias/admin/system/phpinfo.php';
169
+			$expectedresult = '/dolibarralias';
170 170
 		}
171 171
 
172 172
 		// Force to rerun filefunc.inc.php
Please login to merge, or discard this patch.