Test Failed
Push — master ( e0c20c...b8c830 )
by Alxarafe
39:29
created
dolibarr/test/phpunit/RestAPIDocumentTest.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,9 +62,9 @@
 block discarded – undo
62 62
      */
63 63
     public function __construct()
64 64
     {
65
-    	parent::__construct();
65
+        parent::__construct();
66 66
 
67
-    	//$this->sharedFixture
67
+        //$this->sharedFixture
68 68
         global $conf,$user,$langs,$db;
69 69
         $this->savconf = $conf;
70 70
         $this->savuser = $user;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  *      \brief      PHPUnit test
23 23
  *      \remarks    To run this script as CLI:  phpunit filename.php.
24 24
  */
25
-global $conf,$user,$langs,$db;
25
+global $conf, $user, $langs, $db;
26 26
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
27 27
 //require_once 'PHPUnit/Autoload.php';
28 28
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     	parent::__construct();
66 66
 
67 67
     	//$this->sharedFixture
68
-        global $conf,$user,$langs,$db;
68
+        global $conf, $user, $langs, $db;
69 69
         $this->savconf = $conf;
70 70
         $this->savuser = $user;
71 71
         $this->savlangs = $langs;
@@ -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
         echo __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
         echo __METHOD__."\n";
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      */
101 101
     protected function setUp()
102 102
     {
103
-        global $conf,$user,$langs,$db;
103
+        global $conf, $user, $langs, $db;
104 104
         $conf = $this->savconf;
105 105
         $user = $this->savuser;
106 106
         $langs = $this->savlangs;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function testPushDocument()
144 144
     {
145
-        global $conf,$user,$langs,$db;
145
+        global $conf, $user, $langs, $db;
146 146
 
147 147
         $url = $this->api_url.'/documents/?api_key='.$this->api_key;
148 148
 
Please login to merge, or discard this patch.
dolibarr/test/phpunit/RestAPIUserTest.php 2 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
      */
65 65
     function __construct()
66 66
     {
67
-    	parent::__construct();
67
+        parent::__construct();
68 68
 
69
-    	//$this->sharedFixture
69
+        //$this->sharedFixture
70 70
         global $conf,$user,$langs,$db;
71 71
         $this->savconf=$conf;
72 72
         $this->savuser=$user;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * Init phpunit tests
103 103
      *
104 104
      * @return  void
105
-    */
105
+     */
106 106
     protected function setUp()
107 107
     {
108 108
         global $conf,$user,$langs,$db;
@@ -149,30 +149,30 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public function testRestGetUser()
151 151
     {
152
-      global $conf,$user,$langs,$db;
153
-
154
-      $url = $this->api_url.'/users/123456789?api_key='.$this->api_key;
155
-      //$addheaders=array('Content-Type: application/json');
156
-
157
-      print __METHOD__." Request GET url=".$url."\n";
158
-      $result=getURLContent($url, 'GET', '', 1, array());
159
-      //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n";
160
-      print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
161
-      $this->assertEquals($result['curl_error_no'],'');
162
-      $object=json_decode($result['content'], true);
163
-      $this->assertNotNull($object, "Parsing of json result must no be null");
164
-      $this->assertEquals(404, $object['error']['code']);
165
-
166
-      $url = $this->api_url.'/users/1?api_key='.$this->api_key;
167
-
168
-      print __METHOD__." Request GET url=".$url."\n";
169
-      $result=getURLContent($url, 'GET', '', 1, array());
170
-      //print __METHOD__." Result for existing user user: ".var_export($result, true)."\n";
171
-      print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
172
-      $this->assertEquals($result['curl_error_no'],'');
173
-      $object=json_decode($result['content'], true);
174
-      $this->assertNotNull($object, "Parsing of json result must no be null");
175
-      $this->assertEquals(1, $object['statut']);
152
+        global $conf,$user,$langs,$db;
153
+
154
+        $url = $this->api_url.'/users/123456789?api_key='.$this->api_key;
155
+        //$addheaders=array('Content-Type: application/json');
156
+
157
+        print __METHOD__." Request GET url=".$url."\n";
158
+        $result=getURLContent($url, 'GET', '', 1, array());
159
+        //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n";
160
+        print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
161
+        $this->assertEquals($result['curl_error_no'],'');
162
+        $object=json_decode($result['content'], true);
163
+        $this->assertNotNull($object, "Parsing of json result must no be null");
164
+        $this->assertEquals(404, $object['error']['code']);
165
+
166
+        $url = $this->api_url.'/users/1?api_key='.$this->api_key;
167
+
168
+        print __METHOD__." Request GET url=".$url."\n";
169
+        $result=getURLContent($url, 'GET', '', 1, array());
170
+        //print __METHOD__." Result for existing user user: ".var_export($result, true)."\n";
171
+        print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
172
+        $this->assertEquals($result['curl_error_no'],'');
173
+        $object=json_decode($result['content'], true);
174
+        $this->assertNotNull($object, "Parsing of json result must no be null");
175
+        $this->assertEquals(1, $object['statut']);
176 176
     }
177 177
 
178 178
     /**
@@ -183,52 +183,52 @@  discard block
 block discarded – undo
183 183
     public function testRestCreateUser()
184 184
     {
185 185
 
186
-      // attemp to create without mandatory fields :
187
-      $url = $this->api_url.'/users?api_key='.$this->api_key;
188
-      $addheaders=array('Content-Type: application/json');
186
+        // attemp to create without mandatory fields :
187
+        $url = $this->api_url.'/users?api_key='.$this->api_key;
188
+        $addheaders=array('Content-Type: application/json');
189 189
 
190
-      $bodyobj = array(
190
+        $bodyobj = array(
191 191
         "lastname"=>"testRestUser",
192 192
         "password"=>"testRestPassword",
193 193
         "email"=>"[email protected]"
194
-      );
195
-      $body = json_encode($bodyobj);
196
-
197
-      print __METHOD__." Request POST url=".$url."\n";
198
-      $result=getURLContent($url, 'POST', $body, 1, $addheaders);
199
-      //print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n";
200
-      print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
201
-      $this->assertEquals($result['curl_error_no'],'');
202
-      $object=json_decode($result['content'], true);
203
-      $this->assertNotNull($object, "Parsing of json result must no be null");
204
-      $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
205
-
206
-      // create regular user
207
-      unset($result);
208
-      $bodyobj = array(
194
+        );
195
+        $body = json_encode($bodyobj);
196
+
197
+        print __METHOD__." Request POST url=".$url."\n";
198
+        $result=getURLContent($url, 'POST', $body, 1, $addheaders);
199
+        //print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n";
200
+        print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
201
+        $this->assertEquals($result['curl_error_no'],'');
202
+        $object=json_decode($result['content'], true);
203
+        $this->assertNotNull($object, "Parsing of json result must no be null");
204
+        $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
205
+
206
+        // create regular user
207
+        unset($result);
208
+        $bodyobj = array(
209 209
         "login"=>"testRestLogin".mt_rand(),
210 210
         "lastname"=>"testRestUser",
211 211
         "password"=>"testRestPassword",
212 212
         "email"=>"[email protected]"
213
-      );
214
-      $body = json_encode($bodyobj);
215
-      print __METHOD__." Request POST url=".$url."\n";
216
-      $result=getURLContent($url, 'POST', $body, 1, $addheaders);
217
-      print __METHOD__." Result code for creating user ".var_export($result, true)."\n";
218
-      print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
219
-      $this->assertEquals($result['curl_error_no'],'');
220
-      $resid=json_decode($result['content'], true);
221
-      $this->assertNotNull($resid, "Parsing of json result must no be null");
222
-      $this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']);
223
-
224
-      // attempt to create duplicated user
225
-      print __METHOD__." Request POST url=".$url."\n";
226
-      $result=getURLContent($url, 'POST', $body, 1, $addheaders);
227
-      //print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n";
228
-      print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
229
-      $this->assertEquals($result['curl_error_no'],'');
230
-      $object=json_decode($result['content'], true);
231
-      $this->assertNotNull($object, "Parsing of json result must no be null");
232
-      $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
213
+        );
214
+        $body = json_encode($bodyobj);
215
+        print __METHOD__." Request POST url=".$url."\n";
216
+        $result=getURLContent($url, 'POST', $body, 1, $addheaders);
217
+        print __METHOD__." Result code for creating user ".var_export($result, true)."\n";
218
+        print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
219
+        $this->assertEquals($result['curl_error_no'],'');
220
+        $resid=json_decode($result['content'], true);
221
+        $this->assertNotNull($resid, "Parsing of json result must no be null");
222
+        $this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']);
223
+
224
+        // attempt to create duplicated user
225
+        print __METHOD__." Request POST url=".$url."\n";
226
+        $result=getURLContent($url, 'POST', $body, 1, $addheaders);
227
+        //print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n";
228
+        print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
229
+        $this->assertEquals($result['curl_error_no'],'');
230
+        $object=json_decode($result['content'], true);
231
+        $this->assertNotNull($object, "Parsing of json result must no be null");
232
+        $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
233 233
     }
234 234
 }
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 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';
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
     $user->fetch(1);
37 37
     $user->getrights();
38 38
 }
39
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
40
-$conf->global->MAIN_UMASK='0666';
39
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
40
+$conf->global->MAIN_UMASK = '0666';
41 41
 
42 42
 
43 43
 /**
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
     	parent::__construct();
68 68
 
69 69
     	//$this->sharedFixture
70
-        global $conf,$user,$langs,$db;
71
-        $this->savconf=$conf;
72
-        $this->savuser=$user;
73
-        $this->savlangs=$langs;
74
-        $this->savdb=$db;
70
+        global $conf, $user, $langs, $db;
71
+        $this->savconf = $conf;
72
+        $this->savuser = $user;
73
+        $this->savlangs = $langs;
74
+        $this->savdb = $db;
75 75
 
76 76
         if (empty($conf->api->enabled)) { print __METHOD__." module api must be enabled.\n"; die(); }
77 77
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     // Static methods
84 84
     public static function setUpBeforeClass()
85 85
     {
86
-        global $conf,$user,$langs,$db;
86
+        global $conf, $user, $langs, $db;
87 87
         $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
88 88
 
89 89
         print __METHOD__."\n";
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     // tear down after class
93 93
     public static function tearDownAfterClass()
94 94
     {
95
-        global $conf,$user,$langs,$db;
95
+        global $conf, $user, $langs, $db;
96 96
         $db->rollback();
97 97
 
98 98
         print __METHOD__."\n";
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
     */
106 106
     protected function setUp()
107 107
     {
108
-        global $conf,$user,$langs,$db;
109
-        $conf=$this->savconf;
110
-        $user=$this->savuser;
111
-        $langs=$this->savlangs;
112
-        $db=$this->savdb;
108
+        global $conf, $user, $langs, $db;
109
+        $conf = $this->savconf;
110
+        $user = $this->savuser;
111
+        $langs = $this->savlangs;
112
+        $db = $this->savdb;
113 113
 
114
-        $this->api_url=DOL_MAIN_URL_ROOT.'/api/index.php';
114
+        $this->api_url = DOL_MAIN_URL_ROOT.'/api/index.php';
115 115
 
116
-        $login='admin';
117
-        $password='admin';
118
-        $url=$this->api_url.'/login?login='.$login.'&password='.$password;
116
+        $login = 'admin';
117
+        $password = 'admin';
118
+        $url = $this->api_url.'/login?login='.$login.'&password='.$password;
119 119
         // Call the API login method to save api_key for this test class
120
-        $result=getURLContent($url, 'GET', '', 1, array());
120
+        $result = getURLContent($url, 'GET', '', 1, array());
121 121
         print __METHOD__." result = ".var_export($result, true)."\n";
122 122
         print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
123
-        $this->assertEquals($result['curl_error_no'],'');
124
-        $object=json_decode($result['content'], true);
123
+        $this->assertEquals($result['curl_error_no'], '');
124
+        $object = json_decode($result['content'], true);
125 125
         $this->assertNotNull($object, "Parsing of json result must no be null");
126 126
         $this->assertEquals('200', $object['success']['code']);
127 127
 
@@ -149,28 +149,28 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public function testRestGetUser()
151 151
     {
152
-      global $conf,$user,$langs,$db;
152
+      global $conf, $user, $langs, $db;
153 153
 
154 154
       $url = $this->api_url.'/users/123456789?api_key='.$this->api_key;
155 155
       //$addheaders=array('Content-Type: application/json');
156 156
 
157 157
       print __METHOD__." Request GET url=".$url."\n";
158
-      $result=getURLContent($url, 'GET', '', 1, array());
158
+      $result = getURLContent($url, 'GET', '', 1, array());
159 159
       //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n";
160 160
       print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
161
-      $this->assertEquals($result['curl_error_no'],'');
162
-      $object=json_decode($result['content'], true);
161
+      $this->assertEquals($result['curl_error_no'], '');
162
+      $object = json_decode($result['content'], true);
163 163
       $this->assertNotNull($object, "Parsing of json result must no be null");
164 164
       $this->assertEquals(404, $object['error']['code']);
165 165
 
166 166
       $url = $this->api_url.'/users/1?api_key='.$this->api_key;
167 167
 
168 168
       print __METHOD__." Request GET url=".$url."\n";
169
-      $result=getURLContent($url, 'GET', '', 1, array());
169
+      $result = getURLContent($url, 'GET', '', 1, array());
170 170
       //print __METHOD__." Result for existing user user: ".var_export($result, true)."\n";
171 171
       print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
172
-      $this->assertEquals($result['curl_error_no'],'');
173
-      $object=json_decode($result['content'], true);
172
+      $this->assertEquals($result['curl_error_no'], '');
173
+      $object = json_decode($result['content'], true);
174 174
       $this->assertNotNull($object, "Parsing of json result must no be null");
175 175
       $this->assertEquals(1, $object['statut']);
176 176
     }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
       // attemp to create without mandatory fields :
187 187
       $url = $this->api_url.'/users?api_key='.$this->api_key;
188
-      $addheaders=array('Content-Type: application/json');
188
+      $addheaders = array('Content-Type: application/json');
189 189
 
190 190
       $bodyobj = array(
191 191
         "lastname"=>"testRestUser",
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
       $body = json_encode($bodyobj);
196 196
 
197 197
       print __METHOD__." Request POST url=".$url."\n";
198
-      $result=getURLContent($url, 'POST', $body, 1, $addheaders);
198
+      $result = getURLContent($url, 'POST', $body, 1, $addheaders);
199 199
       //print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n";
200 200
       print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
201
-      $this->assertEquals($result['curl_error_no'],'');
202
-      $object=json_decode($result['content'], true);
201
+      $this->assertEquals($result['curl_error_no'], '');
202
+      $object = json_decode($result['content'], true);
203 203
       $this->assertNotNull($object, "Parsing of json result must no be null");
204 204
       $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
205 205
 
@@ -213,21 +213,21 @@  discard block
 block discarded – undo
213 213
       );
214 214
       $body = json_encode($bodyobj);
215 215
       print __METHOD__." Request POST url=".$url."\n";
216
-      $result=getURLContent($url, 'POST', $body, 1, $addheaders);
216
+      $result = getURLContent($url, 'POST', $body, 1, $addheaders);
217 217
       print __METHOD__." Result code for creating user ".var_export($result, true)."\n";
218 218
       print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
219
-      $this->assertEquals($result['curl_error_no'],'');
220
-      $resid=json_decode($result['content'], true);
219
+      $this->assertEquals($result['curl_error_no'], '');
220
+      $resid = json_decode($result['content'], true);
221 221
       $this->assertNotNull($resid, "Parsing of json result must no be null");
222 222
       $this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']);
223 223
 
224 224
       // attempt to create duplicated user
225 225
       print __METHOD__." Request POST url=".$url."\n";
226
-      $result=getURLContent($url, 'POST', $body, 1, $addheaders);
226
+      $result = getURLContent($url, 'POST', $body, 1, $addheaders);
227 227
       //print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n";
228 228
       print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
229
-      $this->assertEquals($result['curl_error_no'],'');
230
-      $object=json_decode($result['content'], true);
229
+      $this->assertEquals($result['curl_error_no'], '');
230
+      $object = json_decode($result['content'], true);
231 231
       $this->assertNotNull($object, "Parsing of json result must no be null");
232 232
       $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
233 233
     }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/BuildDocTest.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
      */
90 90
     function __construct()
91 91
     {
92
-    	parent::__construct();
92
+        parent::__construct();
93 93
 
94
-    	//$this->sharedFixture
94
+        //$this->sharedFixture
95 95
         global $conf,$user,$langs,$db;
96 96
         $this->savconf=$conf;
97 97
         $this->savuser=$user;
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
     }
236 236
 
237 237
     /**
238
-    * testFactureFournisseurBuild
239
-    *
240
-    * @return int
241
-    */
238
+     * testFactureFournisseurBuild
239
+     *
240
+     * @return int
241
+     */
242 242
     public function testFactureFournisseurBuild()
243 243
     {
244 244
         global $conf,$user,$langs,$db;
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 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';
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     $user->fetch(1);
65 65
     $user->getrights();
66 66
 }
67
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
67
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
68 68
 
69 69
 
70 70
 /**
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
     	parent::__construct();
93 93
 
94 94
     	//$this->sharedFixture
95
-        global $conf,$user,$langs,$db;
96
-        $this->savconf=$conf;
97
-        $this->savuser=$user;
98
-        $this->savlangs=$langs;
99
-        $this->savdb=$db;
95
+        global $conf, $user, $langs, $db;
96
+        $this->savconf = $conf;
97
+        $this->savuser = $user;
98
+        $this->savlangs = $langs;
99
+        $this->savdb = $db;
100 100
 
101 101
         print __METHOD__." db->type=".$db->type." user->id=".$user->id;
102 102
         //print " - db ".$db->db;
@@ -106,15 +106,15 @@  discard block
 block discarded – undo
106 106
     // Static methods
107 107
     public static function setUpBeforeClass()
108 108
     {
109
-        global $conf,$user,$langs,$db;
109
+        global $conf, $user, $langs, $db;
110 110
 
111
-        if (! $conf->facture->enabled) { print __METHOD__." invoice module not enabled\n"; die(); }
112
-        if (! $conf->commande->enabled) { print __METHOD__." order module not enabled\n"; die(); }
113
-        if (! $conf->propal->enabled) { print __METHOD__." propal module not enabled\n"; die(); }
114
-        if (! $conf->projet->enabled) { print __METHOD__." project module not enabled\n"; die(); }
115
-        if (! $conf->expedition->enabled) { print __METHOD__." shipment module not enabled\n"; die(); }
116
-        if (! $conf->ficheinter->enabled) { print __METHOD__." intervention module not enabled\n"; die(); }
117
-        if (! $conf->expensereport->enabled) { print __METHOD__." expensereport module not enabled\n"; die(); }
111
+        if (!$conf->facture->enabled) { print __METHOD__." invoice module not enabled\n"; die(); }
112
+        if (!$conf->commande->enabled) { print __METHOD__." order module not enabled\n"; die(); }
113
+        if (!$conf->propal->enabled) { print __METHOD__." propal module not enabled\n"; die(); }
114
+        if (!$conf->projet->enabled) { print __METHOD__." project module not enabled\n"; die(); }
115
+        if (!$conf->expedition->enabled) { print __METHOD__." shipment module not enabled\n"; die(); }
116
+        if (!$conf->ficheinter->enabled) { print __METHOD__." intervention module not enabled\n"; die(); }
117
+        if (!$conf->expensereport->enabled) { print __METHOD__." expensereport module not enabled\n"; die(); }
118 118
 
119 119
         $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
120 120
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     // tear down after class
125 125
     public static function tearDownAfterClass()
126 126
     {
127
-        global $conf,$user,$langs,$db;
127
+        global $conf, $user, $langs, $db;
128 128
         $db->rollback();
129 129
 
130 130
         print __METHOD__."\n";
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
      */
138 138
     protected function setUp()
139 139
     {
140
-        global $conf,$user,$langs,$db;
141
-        $conf=$this->savconf;
142
-        $user=$this->savuser;
143
-        $langs=$this->savlangs;
144
-        $db=$this->savdb;
140
+        global $conf, $user, $langs, $db;
141
+        $conf = $this->savconf;
142
+        $user = $this->savuser;
143
+        $langs = $this->savlangs;
144
+        $db = $this->savdb;
145 145
 
146 146
         print __METHOD__."\n";
147 147
     }
@@ -162,71 +162,71 @@  discard block
 block discarded – undo
162 162
      */
163 163
     public function testFactureBuild()
164 164
     {
165
-        global $conf,$user,$langs,$db;
166
-        $conf=$this->savconf;
167
-        $user=$this->savuser;
168
-        $langs=$this->savlangs;
169
-        $db=$this->savdb;
165
+        global $conf, $user, $langs, $db;
166
+        $conf = $this->savconf;
167
+        $user = $this->savuser;
168
+        $langs = $this->savlangs;
169
+        $db = $this->savdb;
170 170
 
171
-        $conf->facture->dir_output.='/temp';
171
+        $conf->facture->dir_output .= '/temp';
172 172
 
173
-        $localobjectcom=new Commande($this->savdb);
173
+        $localobjectcom = new Commande($this->savdb);
174 174
         $localobjectcom->initAsSpecimen();
175 175
 
176
-        $localobject=new Facture($this->savdb);
176
+        $localobject = new Facture($this->savdb);
177 177
         $localobject->createFromOrder($localobjectcom, $user);
178
-        $localobject->date_lim_reglement = dol_now() + 3600 * 24 *30;
178
+        $localobject->date_lim_reglement = dol_now() + 3600 * 24 * 30;
179 179
 
180 180
         // Crabe (english)
181
-        $localobject->modelpdf='crabe';
181
+        $localobject->modelpdf = 'crabe';
182 182
         $result = $localobject->generateDocument($localobject->modelpdf, $langs);
183 183
         $this->assertLessThan($result, 0);
184 184
         print __METHOD__." result=".$result."\n";
185 185
 
186 186
         // Crabe (japanese)
187
-        $newlangs1=new Translate("",$conf);
187
+        $newlangs1 = new Translate("", $conf);
188 188
         $newlangs1->setDefaultLang('ja_JP');
189
-        $localobject->modelpdf='crabe';
189
+        $localobject->modelpdf = 'crabe';
190 190
         $result = $localobject->generateDocument($localobject->modelpdf, $newlangs1);
191 191
         $this->assertLessThan($result, 0);
192 192
         print __METHOD__." result=".$result."\n";
193 193
 
194 194
         // Crabe (saudiarabia)
195
-        $newlangs2a=new Translate("",$conf);
195
+        $newlangs2a = new Translate("", $conf);
196 196
         $newlangs2a->setDefaultLang('sa_SA');
197
-        $localobject->modelpdf='crabe';
197
+        $localobject->modelpdf = 'crabe';
198 198
         $result = $localobject->generateDocument($localobject->modelpdf, $newlangs2a);
199 199
         $this->assertLessThan($result, 0);
200 200
         print __METHOD__." result=".$result."\n";
201 201
 
202 202
         // Crabe (english_saudiarabia)
203
-        $newlangs2b=new Translate("",$conf);
203
+        $newlangs2b = new Translate("", $conf);
204 204
         $newlangs2b->setDefaultLang('en_SA');
205
-        $localobject->modelpdf='crabe';
205
+        $localobject->modelpdf = 'crabe';
206 206
         $result = $localobject->generateDocument($localobject->modelpdf, $newlangs2b);
207 207
         $this->assertLessThan($result, 0);
208 208
         print __METHOD__." result=".$result."\n";
209 209
 
210 210
         // Crabe (greek)
211
-        $newlangs3=new Translate("",$conf);
211
+        $newlangs3 = new Translate("", $conf);
212 212
         $newlangs3->setDefaultLang('el_GR');
213
-        $localobject->modelpdf='crabe';
213
+        $localobject->modelpdf = 'crabe';
214 214
         $result = $localobject->generateDocument($localobject->modelpdf, $newlangs3);
215 215
         $this->assertLessThan($result, 0);
216 216
         print __METHOD__." result=".$result."\n";
217 217
 
218 218
         // Crabe (chinese)
219
-        $newlangs4=new Translate("",$conf);
219
+        $newlangs4 = new Translate("", $conf);
220 220
         $newlangs4->setDefaultLang('zh_CN');
221
-        $localobject->modelpdf='crabe';
221
+        $localobject->modelpdf = 'crabe';
222 222
         $result = $localobject->generateDocument($localobject->modelpdf, $newlangs4);
223 223
         $this->assertLessThan($result, 0);
224 224
         print __METHOD__." result=".$result."\n";
225 225
 
226 226
         // Crabe (russian)
227
-        $newlangs5=new Translate("",$conf);
227
+        $newlangs5 = new Translate("", $conf);
228 228
         $newlangs5->setDefaultLang('ru_RU');
229
-        $localobject->modelpdf='crabe';
229
+        $localobject->modelpdf = 'crabe';
230 230
         $result = $localobject->generateDocument($localobject->modelpdf, $newlangs5);
231 231
         $this->assertLessThan($result, 0);
232 232
         print __METHOD__." result=".$result."\n";
@@ -241,18 +241,18 @@  discard block
 block discarded – undo
241 241
     */
242 242
     public function testFactureFournisseurBuild()
243 243
     {
244
-        global $conf,$user,$langs,$db;
245
-        $conf=$this->savconf;
246
-        $user=$this->savuser;
247
-        $langs=$this->savlangs;
248
-        $db=$this->savdb;
249
-
250
-        $conf->fournisseur->facture->dir_output.='/temp';
251
-        $localobject=new FactureFournisseur($this->savdb);
244
+        global $conf, $user, $langs, $db;
245
+        $conf = $this->savconf;
246
+        $user = $this->savuser;
247
+        $langs = $this->savlangs;
248
+        $db = $this->savdb;
249
+
250
+        $conf->fournisseur->facture->dir_output .= '/temp';
251
+        $localobject = new FactureFournisseur($this->savdb);
252 252
         $localobject->initAsSpecimen();
253 253
 
254 254
         // Canelle
255
-        $localobject->modelpdf='canelle';
255
+        $localobject->modelpdf = 'canelle';
256 256
         $result = $localobject->generateDocument($localobject->modelpdf, $langs);
257 257
 
258 258
         $this->assertLessThan($result, 0);
@@ -268,18 +268,18 @@  discard block
 block discarded – undo
268 268
      */
269 269
     public function testCommandeBuild()
270 270
     {
271
-        global $conf,$user,$langs,$db;
272
-        $conf=$this->savconf;
273
-        $user=$this->savuser;
274
-        $langs=$this->savlangs;
275
-        $db=$this->savdb;
276
-
277
-        $conf->commande->dir_output.='/temp';
278
-        $localobject=new Commande($this->savdb);
271
+        global $conf, $user, $langs, $db;
272
+        $conf = $this->savconf;
273
+        $user = $this->savuser;
274
+        $langs = $this->savlangs;
275
+        $db = $this->savdb;
276
+
277
+        $conf->commande->dir_output .= '/temp';
278
+        $localobject = new Commande($this->savdb);
279 279
         $localobject->initAsSpecimen();
280 280
 
281 281
         // Einstein
282
-        $localobject->modelpdf='einstein';
282
+        $localobject->modelpdf = 'einstein';
283 283
         $result = $localobject->generateDocument($localobject->modelpdf, $langs);
284 284
 
285 285
         $this->assertLessThan($result, 0);
@@ -296,19 +296,19 @@  discard block
 block discarded – undo
296 296
      */
297 297
     public function testCommandeFournisseurBuild()
298 298
     {
299
-        global $conf,$user,$langs,$db;
300
-        $conf=$this->savconf;
301
-        $user=$this->savuser;
302
-        $langs=$this->savlangs;
303
-        $db=$this->savdb;
304
-
305
-        $conf->fournisseur->commande->dir_output.='/temp';
306
-        $localobject=new CommandeFournisseur($this->savdb);
299
+        global $conf, $user, $langs, $db;
300
+        $conf = $this->savconf;
301
+        $user = $this->savuser;
302
+        $langs = $this->savlangs;
303
+        $db = $this->savdb;
304
+
305
+        $conf->fournisseur->commande->dir_output .= '/temp';
306
+        $localobject = new CommandeFournisseur($this->savdb);
307 307
         $localobject->initAsSpecimen();
308 308
 
309 309
         // Muscadet
310
-        $localobject->modelpdf='muscadet';
311
-        $result= $localobject->generateDocument($localobject->modelpdf, $langs);
310
+        $localobject->modelpdf = 'muscadet';
311
+        $result = $localobject->generateDocument($localobject->modelpdf, $langs);
312 312
 
313 313
         $this->assertLessThan($result, 0);
314 314
         print __METHOD__." result=".$result."\n";
@@ -323,18 +323,18 @@  discard block
 block discarded – undo
323 323
      */
324 324
     public function testPropalBuild()
325 325
     {
326
-        global $conf,$user,$langs,$db;
327
-        $conf=$this->savconf;
328
-        $user=$this->savuser;
329
-        $langs=$this->savlangs;
330
-        $db=$this->savdb;
331
-
332
-        $conf->propal->dir_output.='/temp';
333
-        $localobject=new Propal($this->savdb);
326
+        global $conf, $user, $langs, $db;
327
+        $conf = $this->savconf;
328
+        $user = $this->savuser;
329
+        $langs = $this->savlangs;
330
+        $db = $this->savdb;
331
+
332
+        $conf->propal->dir_output .= '/temp';
333
+        $localobject = new Propal($this->savdb);
334 334
         $localobject->initAsSpecimen();
335 335
 
336 336
         // Azur
337
-        $localobject->modelpdf='azur';
337
+        $localobject->modelpdf = 'azur';
338 338
         $result = $localobject->generateDocument($localobject->modelpdf, $langs);
339 339
 
340 340
         $this->assertLessThan($result, 0);
@@ -350,17 +350,17 @@  discard block
 block discarded – undo
350 350
      */
351 351
     public function testProjectBuild()
352 352
     {
353
-        global $conf,$user,$langs,$db;
354
-        $conf=$this->savconf;
355
-        $user=$this->savuser;
356
-        $langs=$this->savlangs;
357
-        $db=$this->savdb;
358
-        $conf->projet->dir_output.='/temp';
359
-        $localobject=new Project($this->savdb);
353
+        global $conf, $user, $langs, $db;
354
+        $conf = $this->savconf;
355
+        $user = $this->savuser;
356
+        $langs = $this->savlangs;
357
+        $db = $this->savdb;
358
+        $conf->projet->dir_output .= '/temp';
359
+        $localobject = new Project($this->savdb);
360 360
         $localobject->initAsSpecimen();
361 361
 
362 362
         // Baleine
363
-        $localobject->modelpdf='baleine';
363
+        $localobject->modelpdf = 'baleine';
364 364
         $result = $localobject->generateDocument($localobject->modelpdf, $langs);
365 365
 
366 366
         $this->assertLessThan($result, 0);
@@ -376,19 +376,19 @@  discard block
 block discarded – undo
376 376
      */
377 377
     public function testFichinterBuild()
378 378
     {
379
-        global $conf,$user,$langs,$db;
380
-        $conf=$this->savconf;
381
-        $user=$this->savuser;
382
-        $langs=$this->savlangs;
383
-        $db=$this->savdb;
384
-
385
-        $conf->ficheinter->dir_output.='/temp';
386
-        $localobject=new Fichinter($this->savdb);
379
+        global $conf, $user, $langs, $db;
380
+        $conf = $this->savconf;
381
+        $user = $this->savuser;
382
+        $langs = $this->savlangs;
383
+        $db = $this->savdb;
384
+
385
+        $conf->ficheinter->dir_output .= '/temp';
386
+        $localobject = new Fichinter($this->savdb);
387 387
         $localobject->initAsSpecimen();
388 388
 
389 389
         // Soleil
390
-        $localobject->modelpdf='soleil';
391
-        $result=fichinter_create($db, $localobject, $localobject->modelpdf, $langs);
390
+        $localobject->modelpdf = 'soleil';
391
+        $result = fichinter_create($db, $localobject, $localobject->modelpdf, $langs);
392 392
 
393 393
         $this->assertLessThan($result, 0);
394 394
         print __METHOD__." result=".$result."\n";
@@ -403,26 +403,26 @@  discard block
 block discarded – undo
403 403
      */
404 404
     public function testExpeditionBuild()
405 405
     {
406
-        global $conf,$user,$langs,$db;
407
-        $conf=$this->savconf;
408
-        $user=$this->savuser;
409
-        $langs=$this->savlangs;
410
-        $db=$this->savdb;
411
-
412
-        $conf->expedition->dir_output.='/temp';
413
-        $localobject=new Expedition($this->savdb);
406
+        global $conf, $user, $langs, $db;
407
+        $conf = $this->savconf;
408
+        $user = $this->savuser;
409
+        $langs = $this->savlangs;
410
+        $db = $this->savdb;
411
+
412
+        $conf->expedition->dir_output .= '/temp';
413
+        $localobject = new Expedition($this->savdb);
414 414
         $localobject->initAsSpecimen();
415 415
 
416 416
         // Merou
417
-        $localobject->modelpdf='merou';
418
-        $result= $localobject->generateDocument($localobject->modelpdf, $langs);
417
+        $localobject->modelpdf = 'merou';
418
+        $result = $localobject->generateDocument($localobject->modelpdf, $langs);
419 419
 
420 420
         $this->assertLessThan($result, 0);
421 421
         print __METHOD__." result=".$result."\n";
422 422
 
423 423
         // Rouget
424
-        $localobject->modelpdf='rouget';
425
-        $result= $localobject->generateDocument($localobject->modelpdf, $langs);
424
+        $localobject->modelpdf = 'rouget';
425
+        $result = $localobject->generateDocument($localobject->modelpdf, $langs);
426 426
 
427 427
         $this->assertLessThan($result, 0);
428 428
         print __METHOD__." result=".$result."\n";
Please login to merge, or discard this patch.
dolibarr/test/phpunit/FichinterTest.php 2 patches
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
 if (empty($user->id))
33 33
 {
34
-	print "Load permissions for admin user nb 1\n";
35
-	$user->fetch(1);
36
-	$user->getrights();
34
+    print "Load permissions for admin user nb 1\n";
35
+    $user->fetch(1);
36
+    $user->getrights();
37 37
 }
38 38
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
39 39
 
@@ -47,74 +47,74 @@  discard block
 block discarded – undo
47 47
  */
48 48
 class FichinterTest extends PHPUnit_Framework_TestCase
49 49
 {
50
-	protected $savconf;
51
-	protected $savuser;
52
-	protected $savlangs;
53
-	protected $savdb;
54
-
55
-	/**
56
-	 * Constructor
57
-	 * We save global variables into local variables
58
-	 *
59
-	 * @return ContratTest
60
-	 */
61
-	function __construct()
62
-	{
63
-		parent::__construct();
64
-
65
-		//$this->sharedFixture
66
-		global $conf,$user,$langs,$db;
67
-		$this->savconf=$conf;
68
-		$this->savuser=$user;
69
-		$this->savlangs=$langs;
70
-		$this->savdb=$db;
71
-
72
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
-		//print " - db ".$db->db;
74
-		print "\n";
75
-	}
76
-
77
-	// Static methods
78
-  	public static function setUpBeforeClass()
50
+    protected $savconf;
51
+    protected $savuser;
52
+    protected $savlangs;
53
+    protected $savdb;
54
+
55
+    /**
56
+     * Constructor
57
+     * We save global variables into local variables
58
+     *
59
+     * @return ContratTest
60
+     */
61
+    function __construct()
79 62
     {
80
-    	global $conf,$user,$langs,$db;
81
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
63
+        parent::__construct();
82 64
 
83
-    	print __METHOD__."\n";
65
+        //$this->sharedFixture
66
+        global $conf,$user,$langs,$db;
67
+        $this->savconf=$conf;
68
+        $this->savuser=$user;
69
+        $this->savlangs=$langs;
70
+        $this->savdb=$db;
71
+
72
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
+        //print " - db ".$db->db;
74
+        print "\n";
75
+    }
76
+
77
+    // Static methods
78
+        public static function setUpBeforeClass()
79
+    {
80
+        global $conf,$user,$langs,$db;
81
+        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
82
+
83
+        print __METHOD__."\n";
84 84
     }
85 85
 
86 86
     // tear down after class
87 87
     public static function tearDownAfterClass()
88 88
     {
89
-    	global $conf,$user,$langs,$db;
90
-		$db->rollback();
89
+        global $conf,$user,$langs,$db;
90
+        $db->rollback();
91 91
 
92
-		print __METHOD__."\n";
92
+        print __METHOD__."\n";
93 93
     }
94 94
 
95
-	/**
96
-	 * Init phpunit tests
97
-	 *
98
-	 * @return	void
99
-	 */
95
+    /**
96
+     * Init phpunit tests
97
+     *
98
+     * @return	void
99
+     */
100 100
     protected function setUp()
101 101
     {
102
-    	global $conf,$user,$langs,$db;
103
-		$conf=$this->savconf;
104
-		$user=$this->savuser;
105
-		$langs=$this->savlangs;
106
-		$db=$this->savdb;
102
+        global $conf,$user,$langs,$db;
103
+        $conf=$this->savconf;
104
+        $user=$this->savuser;
105
+        $langs=$this->savlangs;
106
+        $db=$this->savdb;
107 107
 
108
-		print __METHOD__."\n";
108
+        print __METHOD__."\n";
109 109
     }
110
-	/**
111
-	 * End phpunit tests
112
-	 *
113
-	 * @return	void
114
-	 */
110
+    /**
111
+     * End phpunit tests
112
+     *
113
+     * @return	void
114
+     */
115 115
     protected function tearDown()
116 116
     {
117
-    	print __METHOD__."\n";
117
+        print __METHOD__."\n";
118 118
     }
119 119
 
120 120
     /**
@@ -124,20 +124,20 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function testFichinterCreate()
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 Fichinter($this->savdb);
134
-    	$localobject->initAsSpecimen();
135
-    	$result=$localobject->create($user);
133
+        $localobject=new Fichinter($this->savdb);
134
+        $localobject->initAsSpecimen();
135
+        $result=$localobject->create($user);
136 136
 
137
-    	print __METHOD__." result=".$result."\n";
138
-    	$this->assertLessThan($result, 0);
137
+        print __METHOD__." result=".$result."\n";
138
+        $this->assertLessThan($result, 0);
139 139
 
140
-    	return $result;
140
+        return $result;
141 141
     }
142 142
 
143 143
     /**
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function testFichinterFetch($id)
153 153
     {
154
-    	global $conf,$user,$langs,$db;
155
-		$conf=$this->savconf;
156
-		$user=$this->savuser;
157
-		$langs=$this->savlangs;
158
-		$db=$this->savdb;
154
+        global $conf,$user,$langs,$db;
155
+        $conf=$this->savconf;
156
+        $user=$this->savuser;
157
+        $langs=$this->savlangs;
158
+        $db=$this->savdb;
159 159
 
160
-		$localobject=new Fichinter($this->savdb);
161
-    	$result=$localobject->fetch($id);
160
+        $localobject=new Fichinter($this->savdb);
161
+        $result=$localobject->fetch($id);
162 162
 
163
-    	print __METHOD__." id=".$id." result=".$result."\n";
164
-    	$this->assertLessThan($result, 0);
163
+        print __METHOD__." id=".$id." result=".$result."\n";
164
+        $this->assertLessThan($result, 0);
165 165
 
166
-    	return $localobject;
166
+        return $localobject;
167 167
     }
168 168
 
169 169
     /**
@@ -177,20 +177,20 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function testFichinterValid($localobject)
179 179
     {
180
-    	global $conf,$user,$langs,$db;
181
-		$conf=$this->savconf;
182
-		$user=$this->savuser;
183
-		$langs=$this->savlangs;
184
-		$db=$this->savdb;
180
+        global $conf,$user,$langs,$db;
181
+        $conf=$this->savconf;
182
+        $user=$this->savuser;
183
+        $langs=$this->savlangs;
184
+        $db=$this->savdb;
185 185
 
186
-    	$result=$localobject->setValid($user);
187
-    	print __METHOD__." id=".$localobject->id." result=".$result."\n";
186
+        $result=$localobject->setValid($user);
187
+        print __METHOD__." id=".$localobject->id." result=".$result."\n";
188 188
 
189
-    	$this->assertLessThan($result, 0);
190
-    	return $localobject;
189
+        $this->assertLessThan($result, 0);
190
+        return $localobject;
191 191
     }
192 192
 
193
-   /**
193
+    /**
194 194
      * testFichinterValid
195 195
      *
196 196
      * @param	Object	$localobject	Object intervention
@@ -230,18 +230,18 @@  discard block
 block discarded – undo
230 230
      */
231 231
     public function testFichinterDelete($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 Fichinter($this->savdb);
240
-    	$result=$localobject->fetch($id);
241
-		$result=$localobject->delete($user);
242
-
243
-		print __METHOD__." id=".$id." result=".$result."\n";
244
-    	$this->assertLessThan($result, 0);
245
-    	return $result;
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 Fichinter($this->savdb);
240
+        $result=$localobject->fetch($id);
241
+        $result=$localobject->delete($user);
242
+
243
+        print __METHOD__." id=".$id." result=".$result."\n";
244
+        $this->assertLessThan($result, 0);
245
+        return $result;
246 246
     }
247 247
 }
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 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
     }
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function testFichinterCreate()
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 Fichinter($this->savdb);
133
+		$localobject = new Fichinter($this->savdb);
134 134
     	$localobject->initAsSpecimen();
135
-    	$result=$localobject->create($user);
135
+    	$result = $localobject->create($user);
136 136
 
137 137
     	print __METHOD__." result=".$result."\n";
138 138
     	$this->assertLessThan($result, 0);
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function testFichinterFetch($id)
153 153
     {
154
-    	global $conf,$user,$langs,$db;
155
-		$conf=$this->savconf;
156
-		$user=$this->savuser;
157
-		$langs=$this->savlangs;
158
-		$db=$this->savdb;
154
+    	global $conf, $user, $langs, $db;
155
+		$conf = $this->savconf;
156
+		$user = $this->savuser;
157
+		$langs = $this->savlangs;
158
+		$db = $this->savdb;
159 159
 
160
-		$localobject=new Fichinter($this->savdb);
161
-    	$result=$localobject->fetch($id);
160
+		$localobject = new Fichinter($this->savdb);
161
+    	$result = $localobject->fetch($id);
162 162
 
163 163
     	print __METHOD__." id=".$id." result=".$result."\n";
164 164
     	$this->assertLessThan($result, 0);
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function testFichinterValid($localobject)
179 179
     {
180
-    	global $conf,$user,$langs,$db;
181
-		$conf=$this->savconf;
182
-		$user=$this->savuser;
183
-		$langs=$this->savlangs;
184
-		$db=$this->savdb;
180
+    	global $conf, $user, $langs, $db;
181
+		$conf = $this->savconf;
182
+		$user = $this->savuser;
183
+		$langs = $this->savlangs;
184
+		$db = $this->savdb;
185 185
 
186
-    	$result=$localobject->setValid($user);
186
+    	$result = $localobject->setValid($user);
187 187
     	print __METHOD__." id=".$localobject->id." result=".$result."\n";
188 188
 
189 189
     	$this->assertLessThan($result, 0);
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
      */
202 202
     public function testFichinterOther($localobject)
203 203
     {
204
-        global $conf,$user,$langs,$db;
205
-        $conf=$this->savconf;
206
-        $user=$this->savuser;
207
-        $langs=$this->savlangs;
208
-        $db=$this->savdb;
204
+        global $conf, $user, $langs, $db;
205
+        $conf = $this->savconf;
206
+        $user = $this->savuser;
207
+        $langs = $this->savlangs;
208
+        $db = $this->savdb;
209 209
 
210 210
         /*$result=$localobject->setstatus(0);
211 211
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
@@ -230,15 +230,15 @@  discard block
 block discarded – undo
230 230
      */
231 231
     public function testFichinterDelete($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 Fichinter($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 Fichinter($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/DiscountTest.php 2 patches
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
 if (empty($user->id))
33 33
 {
34
-	print "Load permissions for admin user nb 1\n";
35
-	$user->fetch(1);
36
-	$user->getrights();
34
+    print "Load permissions for admin user nb 1\n";
35
+    $user->fetch(1);
36
+    $user->getrights();
37 37
 }
38 38
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
39 39
 
@@ -47,75 +47,75 @@  discard block
 block discarded – undo
47 47
  */
48 48
 class DiscountTest extends PHPUnit_Framework_TestCase
49 49
 {
50
-	protected $savconf;
51
-	protected $savuser;
52
-	protected $savlangs;
53
-	protected $savdb;
54
-
55
-	/**
56
-	 * Constructor
57
-	 * We save global variables into local variables
58
-	 *
59
-	 * @return DiscountTest
60
-	 */
61
-	function __construct()
62
-	{
63
-		parent::__construct();
64
-
65
-		//$this->sharedFixture
66
-		global $conf,$user,$langs,$db;
67
-		$this->savconf=$conf;
68
-		$this->savuser=$user;
69
-		$this->savlangs=$langs;
70
-		$this->savdb=$db;
71
-
72
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
-		//print " - db ".$db->db;
74
-		print "\n";
75
-	}
76
-
77
-	// Static methods
78
-  	public static function setUpBeforeClass()
50
+    protected $savconf;
51
+    protected $savuser;
52
+    protected $savlangs;
53
+    protected $savdb;
54
+
55
+    /**
56
+     * Constructor
57
+     * We save global variables into local variables
58
+     *
59
+     * @return DiscountTest
60
+     */
61
+    function __construct()
62
+    {
63
+        parent::__construct();
64
+
65
+        //$this->sharedFixture
66
+        global $conf,$user,$langs,$db;
67
+        $this->savconf=$conf;
68
+        $this->savuser=$user;
69
+        $this->savlangs=$langs;
70
+        $this->savdb=$db;
71
+
72
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
+        //print " - db ".$db->db;
74
+        print "\n";
75
+    }
76
+
77
+    // Static methods
78
+        public static function setUpBeforeClass()
79 79
     {
80
-    	global $conf,$user,$langs,$db;
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
-    	print __METHOD__."\n";
83
+        print __METHOD__."\n";
84 84
     }
85 85
 
86 86
     // tear down after class
87 87
     public static function tearDownAfterClass()
88 88
     {
89
-    	global $conf,$user,$langs,$db;
90
-		$db->rollback();
89
+        global $conf,$user,$langs,$db;
90
+        $db->rollback();
91 91
 
92
-		print __METHOD__."\n";
92
+        print __METHOD__."\n";
93 93
     }
94 94
 
95
-	/**
96
-	 * Init phpunit tests
97
-	 *
98
-	 * @return	void
99
-	 */
95
+    /**
96
+     * Init phpunit tests
97
+     *
98
+     * @return	void
99
+     */
100 100
     protected function setUp()
101 101
     {
102
-    	global $conf,$user,$langs,$db;
103
-		$conf=$this->savconf;
104
-		$user=$this->savuser;
105
-		$langs=$this->savlangs;
106
-		$db=$this->savdb;
107
-
108
-		print __METHOD__."\n";
109
-		//print $db->getVersion()."\n";
102
+        global $conf,$user,$langs,$db;
103
+        $conf=$this->savconf;
104
+        $user=$this->savuser;
105
+        $langs=$this->savlangs;
106
+        $db=$this->savdb;
107
+
108
+        print __METHOD__."\n";
109
+        //print $db->getVersion()."\n";
110 110
     }
111
-	/**
112
-	 * End phpunit tests
113
-	 *
114
-	 * @return	void
115
-	 */
111
+    /**
112
+     * End phpunit tests
113
+     *
114
+     * @return	void
115
+     */
116 116
     protected function tearDown()
117 117
     {
118
-    	print __METHOD__."\n";
118
+        print __METHOD__."\n";
119 119
     }
120 120
 
121 121
     /**
@@ -125,19 +125,19 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function testDiscountCreate()
127 127
     {
128
-    	global $conf,$user,$langs,$db;
129
-		$conf=$this->savconf;
130
-		$user=$this->savuser;
131
-		$langs=$this->savlangs;
132
-		$db=$this->savdb;
133
-
134
-		$localobject=new DiscountAbsolute($this->savdb);
135
-    	$localobject->initAsSpecimen();
136
-    	$result=$localobject->create($user);
137
-
138
-    	$this->assertLessThan($result, 0);
139
-    	print __METHOD__." result=".$result."\n";
140
-    	return $result;
128
+        global $conf,$user,$langs,$db;
129
+        $conf=$this->savconf;
130
+        $user=$this->savuser;
131
+        $langs=$this->savlangs;
132
+        $db=$this->savdb;
133
+
134
+        $localobject=new DiscountAbsolute($this->savdb);
135
+        $localobject->initAsSpecimen();
136
+        $result=$localobject->create($user);
137
+
138
+        $this->assertLessThan($result, 0);
139
+        print __METHOD__." result=".$result."\n";
140
+        return $result;
141 141
     }
142 142
 
143 143
     /**
@@ -151,18 +151,18 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function testDiscountFetch($id)
153 153
     {
154
-    	global $conf,$user,$langs,$db;
155
-		$conf=$this->savconf;
156
-		$user=$this->savuser;
157
-		$langs=$this->savlangs;
158
-		$db=$this->savdb;
159
-
160
-		$localobject=new DiscountAbsolute($this->savdb);
161
-    	$result=$localobject->fetch($id);
162
-
163
-    	$this->assertLessThan($result, 0);
164
-    	print __METHOD__." id=".$id." result=".$result."\n";
165
-    	return $id;
154
+        global $conf,$user,$langs,$db;
155
+        $conf=$this->savconf;
156
+        $user=$this->savuser;
157
+        $langs=$this->savlangs;
158
+        $db=$this->savdb;
159
+
160
+        $localobject=new DiscountAbsolute($this->savdb);
161
+        $result=$localobject->fetch($id);
162
+
163
+        $this->assertLessThan($result, 0);
164
+        print __METHOD__." id=".$id." result=".$result."\n";
165
+        return $id;
166 166
     }
167 167
 
168 168
     /**
@@ -176,18 +176,18 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function testDiscountDelete($id)
178 178
     {
179
-    	global $conf,$user,$langs,$db;
180
-		$conf=$this->savconf;
181
-		$user=$this->savuser;
182
-		$langs=$this->savlangs;
183
-		$db=$this->savdb;
184
-
185
-		$localobject=new DiscountAbsolute($this->savdb);
186
-    	$result=$localobject->fetch($id);
187
-		$result=$localobject->delete($user);
188
-
189
-		print __METHOD__." id=".$id." result=".$result."\n";
190
-    	$this->assertLessThan($result, 0);
191
-    	return $result;
179
+        global $conf,$user,$langs,$db;
180
+        $conf=$this->savconf;
181
+        $user=$this->savuser;
182
+        $langs=$this->savlangs;
183
+        $db=$this->savdb;
184
+
185
+        $localobject=new DiscountAbsolute($this->savdb);
186
+        $result=$localobject->fetch($id);
187
+        $result=$localobject->delete($user);
188
+
189
+        print __METHOD__." id=".$id." result=".$result."\n";
190
+        $this->assertLessThan($result, 0);
191
+        return $result;
192 192
     }
193 193
 }
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 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
 		//print $db->getVersion()."\n";
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function testDiscountCreate()
127 127
     {
128
-    	global $conf,$user,$langs,$db;
129
-		$conf=$this->savconf;
130
-		$user=$this->savuser;
131
-		$langs=$this->savlangs;
132
-		$db=$this->savdb;
128
+    	global $conf, $user, $langs, $db;
129
+		$conf = $this->savconf;
130
+		$user = $this->savuser;
131
+		$langs = $this->savlangs;
132
+		$db = $this->savdb;
133 133
 
134
-		$localobject=new DiscountAbsolute($this->savdb);
134
+		$localobject = new DiscountAbsolute($this->savdb);
135 135
     	$localobject->initAsSpecimen();
136
-    	$result=$localobject->create($user);
136
+    	$result = $localobject->create($user);
137 137
 
138 138
     	$this->assertLessThan($result, 0);
139 139
     	print __METHOD__." result=".$result."\n";
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function testDiscountFetch($id)
153 153
     {
154
-    	global $conf,$user,$langs,$db;
155
-		$conf=$this->savconf;
156
-		$user=$this->savuser;
157
-		$langs=$this->savlangs;
158
-		$db=$this->savdb;
154
+    	global $conf, $user, $langs, $db;
155
+		$conf = $this->savconf;
156
+		$user = $this->savuser;
157
+		$langs = $this->savlangs;
158
+		$db = $this->savdb;
159 159
 
160
-		$localobject=new DiscountAbsolute($this->savdb);
161
-    	$result=$localobject->fetch($id);
160
+		$localobject = new DiscountAbsolute($this->savdb);
161
+    	$result = $localobject->fetch($id);
162 162
 
163 163
     	$this->assertLessThan($result, 0);
164 164
     	print __METHOD__." id=".$id." result=".$result."\n";
@@ -176,15 +176,15 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function testDiscountDelete($id)
178 178
     {
179
-    	global $conf,$user,$langs,$db;
180
-		$conf=$this->savconf;
181
-		$user=$this->savuser;
182
-		$langs=$this->savlangs;
183
-		$db=$this->savdb;
184
-
185
-		$localobject=new DiscountAbsolute($this->savdb);
186
-    	$result=$localobject->fetch($id);
187
-		$result=$localobject->delete($user);
179
+    	global $conf, $user, $langs, $db;
180
+		$conf = $this->savconf;
181
+		$user = $this->savuser;
182
+		$langs = $this->savlangs;
183
+		$db = $this->savdb;
184
+
185
+		$localobject = new DiscountAbsolute($this->savdb);
186
+    	$result = $localobject->fetch($id);
187
+		$result = $localobject->delete($user);
188 188
 
189 189
 		print __METHOD__." id=".$id." result=".$result."\n";
190 190
     	$this->assertLessThan($result, 0);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/UserTest.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
      */
60 60
     function __construct()
61 61
     {
62
-    	parent::__construct();
62
+        parent::__construct();
63 63
 
64
-    	//$this->sharedFixture
64
+        //$this->sharedFixture
65 65
         global $conf,$user,$langs,$db;
66 66
         $this->savconf=$conf;
67 67
         $this->savuser=$user;
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
      */
285 285
     public function testUserAddPermission($id)
286 286
     {
287
-    	global $conf,$user,$langs,$db;
288
-    	$conf=$this->savconf;
289
-    	$user=$this->savuser;
290
-    	$langs=$this->savlangs;
291
-    	$db=$this->savdb;
292
-
293
-    	$localobject=new User($this->savdb);
294
-    	$result=$localobject->fetch(1);			// Other tests use the user id 1
295
-    	$result=$localobject->addrights(0, 'supplier_proposal');
296
-
297
-    	print __METHOD__." id=".$id." result=".$result."\n";
298
-    	$this->assertLessThan($result, 0);
299
-    	return $result;
287
+        global $conf,$user,$langs,$db;
288
+        $conf=$this->savconf;
289
+        $user=$this->savuser;
290
+        $langs=$this->savlangs;
291
+        $db=$this->savdb;
292
+
293
+        $localobject=new User($this->savdb);
294
+        $result=$localobject->fetch(1);			// Other tests use the user id 1
295
+        $result=$localobject->addrights(0, 'supplier_proposal');
296
+
297
+        print __METHOD__." id=".$id." result=".$result."\n";
298
+        $this->assertLessThan($result, 0);
299
+        return $result;
300 300
     }
301 301
 
302 302
 
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 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,11 +76,11 @@  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
 
81
-        if (! empty($conf->global->MAIN_MODULE_LDAP)) { print "\n".__METHOD__." module LDAP must be disabled.\n"; die(); }
81
+        if (!empty($conf->global->MAIN_MODULE_LDAP)) { print "\n".__METHOD__." module LDAP must be disabled.\n"; die(); }
82 82
 
83
-        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
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
     }
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function testUserCreate()
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 User($this->savdb);
136
+        $localobject = new User($this->savdb);
137 137
         $localobject->initAsSpecimen();
138
-        $result=$localobject->create($user);
138
+        $result = $localobject->create($user);
139 139
 
140 140
         $this->assertLessThan($result, 0);
141 141
         print __METHOD__." result=".$result."\n";
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function testUserFetch($id)
154 154
     {
155
-        global $conf,$user,$langs,$db;
156
-        $conf=$this->savconf;
157
-        $user=$this->savuser;
158
-        $langs=$this->savlangs;
159
-        $db=$this->savdb;
155
+        global $conf, $user, $langs, $db;
156
+        $conf = $this->savconf;
157
+        $user = $this->savuser;
158
+        $langs = $this->savlangs;
159
+        $db = $this->savdb;
160 160
 
161
-        $localobject=new User($this->savdb);
162
-        $result=$localobject->fetch($id);
161
+        $localobject = new User($this->savdb);
162
+        $result = $localobject->fetch($id);
163 163
 
164 164
         $this->assertLessThan($result, 0);
165 165
         print __METHOD__." id=".$id." result=".$result."\n";
@@ -176,23 +176,23 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function testUserUpdate($localobject)
178 178
     {
179
-        global $conf,$user,$langs,$db;
180
-        $conf=$this->savconf;
181
-        $user=$this->savuser;
182
-        $langs=$this->savlangs;
183
-        $db=$this->savdb;
179
+        global $conf, $user, $langs, $db;
180
+        $conf = $this->savconf;
181
+        $user = $this->savuser;
182
+        $langs = $this->savlangs;
183
+        $db = $this->savdb;
184 184
 
185 185
         $this->changeProperties($localobject);
186
-        $result=$localobject->update($user);
186
+        $result = $localobject->update($user);
187 187
 
188 188
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
189 189
         $this->assertLessThan($result, 0);
190 190
 
191 191
         // Test everything are still same than specimen
192
-        $newlocalobject=new User($this->savdb);
192
+        $newlocalobject = new User($this->savdb);
193 193
         $newlocalobject->initAsSpecimen();
194 194
         $this->changeProperties($newlocalobject);
195
-        $this->assertEquals($this->objCompare($localobject,$newlocalobject,true,array('id','socid','societe_id','ref','pass','pass_indatabase','pass_indatabase_crypted','datec','datem','datelastlogin','datepreviouslogin')), array());    // Actual, Expected
195
+        $this->assertEquals($this->objCompare($localobject, $newlocalobject, true, array('id', 'socid', 'societe_id', 'ref', 'pass', 'pass_indatabase', 'pass_indatabase_crypted', 'datec', 'datem', 'datelastlogin', 'datepreviouslogin')), array()); // Actual, Expected
196 196
 
197 197
         return $localobject;
198 198
     }
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public function testUserDisable($localobject)
209 209
     {
210
-        global $conf,$user,$langs,$db;
211
-        $conf=$this->savconf;
212
-        $user=$this->savuser;
213
-        $langs=$this->savlangs;
214
-        $db=$this->savdb;
210
+        global $conf, $user, $langs, $db;
211
+        $conf = $this->savconf;
212
+        $user = $this->savuser;
213
+        $langs = $this->savlangs;
214
+        $db = $this->savdb;
215 215
 
216
-        $result=$localobject->setstatus(0);
216
+        $result = $localobject->setstatus(0);
217 217
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
218 218
 
219 219
         $this->assertLessThan($result, 0);
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
      */
232 232
     public function testUserOther($localobject)
233 233
     {
234
-        global $conf,$user,$langs,$db;
235
-        $conf=$this->savconf;
236
-        $user=$this->savuser;
237
-        $langs=$this->savlangs;
238
-        $db=$this->savdb;
234
+        global $conf, $user, $langs, $db;
235
+        $conf = $this->savconf;
236
+        $user = $this->savuser;
237
+        $langs = $this->savlangs;
238
+        $db = $this->savdb;
239 239
 
240 240
         /*$result=$localobject->setstatus(0);
241 241
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
@@ -259,15 +259,15 @@  discard block
 block discarded – undo
259 259
      */
260 260
     public function testUserDelete($id)
261 261
     {
262
-        global $conf,$user,$langs,$db;
263
-        $conf=$this->savconf;
264
-        $user=$this->savuser;
265
-        $langs=$this->savlangs;
266
-        $db=$this->savdb;
262
+        global $conf, $user, $langs, $db;
263
+        $conf = $this->savconf;
264
+        $user = $this->savuser;
265
+        $langs = $this->savlangs;
266
+        $db = $this->savdb;
267 267
 
268
-        $localobject=new User($this->savdb);
269
-        $result=$localobject->fetch($id);
270
-        $result=$localobject->delete($id);
268
+        $localobject = new User($this->savdb);
269
+        $result = $localobject->fetch($id);
270
+        $result = $localobject->delete($id);
271 271
 
272 272
         print __METHOD__." id=".$id." result=".$result."\n";
273 273
         $this->assertLessThan($result, 0);
@@ -284,15 +284,15 @@  discard block
 block discarded – undo
284 284
      */
285 285
     public function testUserAddPermission($id)
286 286
     {
287
-    	global $conf,$user,$langs,$db;
288
-    	$conf=$this->savconf;
289
-    	$user=$this->savuser;
290
-    	$langs=$this->savlangs;
291
-    	$db=$this->savdb;
287
+    	global $conf, $user, $langs, $db;
288
+    	$conf = $this->savconf;
289
+    	$user = $this->savuser;
290
+    	$langs = $this->savlangs;
291
+    	$db = $this->savdb;
292 292
 
293
-    	$localobject=new User($this->savdb);
294
-    	$result=$localobject->fetch(1);			// Other tests use the user id 1
295
-    	$result=$localobject->addrights(0, 'supplier_proposal');
293
+    	$localobject = new User($this->savdb);
294
+    	$result = $localobject->fetch(1); // Other tests use the user id 1
295
+    	$result = $localobject->addrights(0, 'supplier_proposal');
296 296
 
297 297
     	print __METHOD__." id=".$id." result=".$result."\n";
298 298
     	$this->assertLessThan($result, 0);
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      */
310 310
     public function changeProperties(&$localobject)
311 311
     {
312
-        $localobject->note='New note after update';
312
+        $localobject->note = 'New note after update';
313 313
     }
314 314
 
315 315
     /**
@@ -321,24 +321,24 @@  discard block
 block discarded – undo
321 321
      * @param   array       $fieldstoignorearray    Array of fields to ignore in diff
322 322
      * @return  array                               Array with differences
323 323
      */
324
-    public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id'))
324
+    public function objCompare($oA, $oB, $ignoretype = true, $fieldstoignorearray = array('id'))
325 325
     {
326
-        $retAr=array();
326
+        $retAr = array();
327 327
 
328 328
         if (get_class($oA) !== get_class($oB)) {
329
-            $retAr[]="Supplied objects are not of same class.";
329
+            $retAr[] = "Supplied objects are not of same class.";
330 330
         } else {
331
-            $oVarsA=get_object_vars($oA);
332
-            $oVarsB=get_object_vars($oB);
333
-            $aKeys=array_keys($oVarsA);
334
-            foreach($aKeys as $sKey) {
335
-                if (in_array($sKey,$fieldstoignorearray))
331
+            $oVarsA = get_object_vars($oA);
332
+            $oVarsB = get_object_vars($oB);
333
+            $aKeys = array_keys($oVarsA);
334
+            foreach ($aKeys as $sKey) {
335
+                if (in_array($sKey, $fieldstoignorearray))
336 336
                     continue;
337
-                if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) {
338
-                    $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
337
+                if (!$ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) {
338
+                    $retAr[] = $sKey.' : '.(is_object($oVarsA[$sKey]) ?get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ?get_class($oVarsB[$sKey]) : $oVarsB[$sKey]);
339 339
                 }
340 340
                 if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey]) {
341
-                    $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
341
+                    $retAr[] = $sKey.' : '.(is_object($oVarsA[$sKey]) ?get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ?get_class($oVarsB[$sKey]) : $oVarsB[$sKey]);
342 342
                 }
343 343
             }
344 344
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -332,8 +332,9 @@
 block discarded – undo
332 332
             $oVarsB=get_object_vars($oB);
333 333
             $aKeys=array_keys($oVarsA);
334 334
             foreach($aKeys as $sKey) {
335
-                if (in_array($sKey,$fieldstoignorearray))
336
-                    continue;
335
+                if (in_array($sKey,$fieldstoignorearray)) {
336
+                                    continue;
337
+                }
337 338
                 if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) {
338 339
                     $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
339 340
                 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/PdfDocTest.php 2 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 
35 35
 if (empty($user->id))
36 36
 {
37
-	print "Load permissions for admin user nb 1\n";
38
-	$user->fetch(1);
39
-	$user->getrights();
37
+    print "Load permissions for admin user nb 1\n";
38
+    $user->fetch(1);
39
+    $user->getrights();
40 40
 }
41 41
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
42 42
 
@@ -50,74 +50,74 @@  discard block
 block discarded – undo
50 50
  */
51 51
 class PdfDocTest extends PHPUnit_Framework_TestCase
52 52
 {
53
-	protected $savconf;
54
-	protected $savuser;
55
-	protected $savlangs;
56
-	protected $savdb;
57
-
58
-	/**
59
-	 * Constructor
60
-	 * We save global variables into local variables
61
-	 *
62
-	 * @return PdfDocTest
63
-	 */
64
-	function __construct()
65
-	{
66
-		parent::__construct();
67
-
68
-		//$this->sharedFixture
69
-		global $conf,$user,$langs,$db;
70
-		$this->savconf=$conf;
71
-		$this->savuser=$user;
72
-		$this->savlangs=$langs;
73
-		$this->savdb=$db;
74
-
75
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
76
-		//print " - db ".$db->db;
77
-		print "\n";
78
-	}
79
-
80
-	// Static methods
81
-  	public static function setUpBeforeClass()
53
+    protected $savconf;
54
+    protected $savuser;
55
+    protected $savlangs;
56
+    protected $savdb;
57
+
58
+    /**
59
+     * Constructor
60
+     * We save global variables into local variables
61
+     *
62
+     * @return PdfDocTest
63
+     */
64
+    function __construct()
65
+    {
66
+        parent::__construct();
67
+
68
+        //$this->sharedFixture
69
+        global $conf,$user,$langs,$db;
70
+        $this->savconf=$conf;
71
+        $this->savuser=$user;
72
+        $this->savlangs=$langs;
73
+        $this->savdb=$db;
74
+
75
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
76
+        //print " - db ".$db->db;
77
+        print "\n";
78
+    }
79
+
80
+    // Static methods
81
+        public static function setUpBeforeClass()
82 82
     {
83
-    	global $conf,$user,$langs,$db;
84
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
83
+        global $conf,$user,$langs,$db;
84
+        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
85 85
 
86
-    	print __METHOD__."\n";
86
+        print __METHOD__."\n";
87 87
     }
88 88
 
89 89
     // tear down after class
90 90
     public static function tearDownAfterClass()
91 91
     {
92
-    	global $conf,$user,$langs,$db;
93
-		$db->rollback();
92
+        global $conf,$user,$langs,$db;
93
+        $db->rollback();
94 94
 
95
-		print __METHOD__."\n";
95
+        print __METHOD__."\n";
96 96
     }
97 97
 
98
-	/**
99
-	 * Init phpunit tests
100
-	 *
101
-	 * @return	void
102
-	 */
98
+    /**
99
+     * Init phpunit tests
100
+     *
101
+     * @return	void
102
+     */
103 103
     protected function setUp()
104 104
     {
105
-    	global $conf,$user,$langs,$db;
106
-		$conf=$this->savconf;
107
-		$user=$this->savuser;
108
-		$langs=$this->savlangs;
109
-		$db=$this->savdb;
105
+        global $conf,$user,$langs,$db;
106
+        $conf=$this->savconf;
107
+        $user=$this->savuser;
108
+        $langs=$this->savlangs;
109
+        $db=$this->savdb;
110 110
 
111
-		print __METHOD__."\n";
111
+        print __METHOD__."\n";
112 112
     }
113
-	/**
114
-	 * End phpunit tests
115
-	 *
116
-	 * @return	void
117
-	 */
113
+    /**
114
+     * End phpunit tests
115
+     *
116
+     * @return	void
117
+     */
118 118
     protected function tearDown()
119 119
     {
120
-    	print __METHOD__."\n";
120
+        print __METHOD__."\n";
121 121
     }
122 122
 
123 123
     /**
@@ -127,48 +127,48 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function testPdfDocGetLineDesc()
129 129
     {
130
-    	global $conf,$user,$langs,$db;
131
-		$conf=$this->savconf;
132
-		$user=$this->savuser;
133
-		$langs=$this->savlangs;
134
-		$db=$this->savdb;
135
-
136
-		$localproduct=new Product($this->savdb);
137
-		$localproduct->fetch(0,'PIDRESS');
138
-		$product_id=$localproduct->id;
139
-		if ($product_id <= 0) { print "\n".__METHOD__." A product with ref PIDRESS must exists into database"; die(); }
140
-
141
-		$localobject=new Facture($this->savdb);
142
-		$localobject->initAsSpecimen();
143
-		$localobject->lines=array();
144
-		$localobject->lines[0]=new FactureLigne($this->savdb);
145
-		$localobject->lines[0]->fk_product=$product_id;
146
-		$localobject->lines[0]->label='Label 1';
147
-		$localobject->lines[0]->desc="This is a description with a é accent\n(Country of origin: France)";
148
-
149
-    	$result=pdf_getlinedesc($localobject,0,$langs);
150
-    	print __METHOD__." result=".$result."\n";
151
-    	$this->assertEquals($result,"PIDRESS - Label 1<br>This is a description with a &eacute; accent<br>(Country of origin: France)");
152
-
153
-    	$result=doc_getlinedesc($localobject->lines[0],$langs);
154
-    	print __METHOD__." result=".$result."\n";
155
-    	$this->assertEquals($result,"PIDRESS - Label 1\nThis is a description with a é accent\n(Country of origin: France)");
130
+        global $conf,$user,$langs,$db;
131
+        $conf=$this->savconf;
132
+        $user=$this->savuser;
133
+        $langs=$this->savlangs;
134
+        $db=$this->savdb;
135
+
136
+        $localproduct=new Product($this->savdb);
137
+        $localproduct->fetch(0,'PIDRESS');
138
+        $product_id=$localproduct->id;
139
+        if ($product_id <= 0) { print "\n".__METHOD__." A product with ref PIDRESS must exists into database"; die(); }
140
+
141
+        $localobject=new Facture($this->savdb);
142
+        $localobject->initAsSpecimen();
143
+        $localobject->lines=array();
144
+        $localobject->lines[0]=new FactureLigne($this->savdb);
145
+        $localobject->lines[0]->fk_product=$product_id;
146
+        $localobject->lines[0]->label='Label 1';
147
+        $localobject->lines[0]->desc="This is a description with a é accent\n(Country of origin: France)";
148
+
149
+        $result=pdf_getlinedesc($localobject,0,$langs);
150
+        print __METHOD__." result=".$result."\n";
151
+        $this->assertEquals($result,"PIDRESS - Label 1<br>This is a description with a &eacute; accent<br>(Country of origin: France)");
152
+
153
+        $result=doc_getlinedesc($localobject->lines[0],$langs);
154
+        print __METHOD__." result=".$result."\n";
155
+        $this->assertEquals($result,"PIDRESS - Label 1\nThis is a description with a é accent\n(Country of origin: France)");
156 156
     }
157 157
 
158 158
     /**
159
-    * testPdfGetHeightForLogo
160
-    *
161
-    * @return void
162
-    */
159
+     * testPdfGetHeightForLogo
160
+     *
161
+     * @return void
162
+     */
163 163
     public function testPdfGetHeightForLogo()
164 164
     {
165 165
         $file=dirname(__FILE__).'/img250x50.jpg';
166 166
         $result=pdf_getHeightForLogo($file);
167 167
         print __METHOD__." result=".$result."\n";
168
-    	$this->assertEquals($result,22);
168
+        $this->assertEquals($result,22);
169 169
         $file=dirname(__FILE__).'/img250x20.png';
170 170
         $result=pdf_getHeightForLogo($file);
171 171
         print __METHOD__." result=".$result."\n";
172
-    	$this->assertEquals($result,10.4);
172
+        $this->assertEquals($result,10.4);
173 173
     }
174 174
 }
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 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';
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	$user->fetch(1);
39 39
 	$user->getrights();
40 40
 }
41
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
41
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
42 42
 
43 43
 
44 44
 /**
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 		parent::__construct();
67 67
 
68 68
 		//$this->sharedFixture
69
-		global $conf,$user,$langs,$db;
70
-		$this->savconf=$conf;
71
-		$this->savuser=$user;
72
-		$this->savlangs=$langs;
73
-		$this->savdb=$db;
69
+		global $conf, $user, $langs, $db;
70
+		$this->savconf = $conf;
71
+		$this->savuser = $user;
72
+		$this->savlangs = $langs;
73
+		$this->savdb = $db;
74 74
 
75 75
 		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
76 76
 		//print " - db ".$db->db;
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	// Static methods
81 81
   	public static function setUpBeforeClass()
82 82
     {
83
-    	global $conf,$user,$langs,$db;
84
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
83
+    	global $conf, $user, $langs, $db;
84
+		$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
85 85
 
86 86
     	print __METHOD__."\n";
87 87
     }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     // tear down after class
90 90
     public static function tearDownAfterClass()
91 91
     {
92
-    	global $conf,$user,$langs,$db;
92
+    	global $conf, $user, $langs, $db;
93 93
 		$db->rollback();
94 94
 
95 95
 		print __METHOD__."\n";
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
     protected function setUp()
104 104
     {
105
-    	global $conf,$user,$langs,$db;
106
-		$conf=$this->savconf;
107
-		$user=$this->savuser;
108
-		$langs=$this->savlangs;
109
-		$db=$this->savdb;
105
+    	global $conf, $user, $langs, $db;
106
+		$conf = $this->savconf;
107
+		$user = $this->savuser;
108
+		$langs = $this->savlangs;
109
+		$db = $this->savdb;
110 110
 
111 111
 		print __METHOD__."\n";
112 112
     }
@@ -127,32 +127,32 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function testPdfDocGetLineDesc()
129 129
     {
130
-    	global $conf,$user,$langs,$db;
131
-		$conf=$this->savconf;
132
-		$user=$this->savuser;
133
-		$langs=$this->savlangs;
134
-		$db=$this->savdb;
135
-
136
-		$localproduct=new Product($this->savdb);
137
-		$localproduct->fetch(0,'PIDRESS');
138
-		$product_id=$localproduct->id;
130
+    	global $conf, $user, $langs, $db;
131
+		$conf = $this->savconf;
132
+		$user = $this->savuser;
133
+		$langs = $this->savlangs;
134
+		$db = $this->savdb;
135
+
136
+		$localproduct = new Product($this->savdb);
137
+		$localproduct->fetch(0, 'PIDRESS');
138
+		$product_id = $localproduct->id;
139 139
 		if ($product_id <= 0) { print "\n".__METHOD__." A product with ref PIDRESS must exists into database"; die(); }
140 140
 
141
-		$localobject=new Facture($this->savdb);
141
+		$localobject = new Facture($this->savdb);
142 142
 		$localobject->initAsSpecimen();
143
-		$localobject->lines=array();
144
-		$localobject->lines[0]=new FactureLigne($this->savdb);
145
-		$localobject->lines[0]->fk_product=$product_id;
146
-		$localobject->lines[0]->label='Label 1';
147
-		$localobject->lines[0]->desc="This is a description with a é accent\n(Country of origin: France)";
143
+		$localobject->lines = array();
144
+		$localobject->lines[0] = new FactureLigne($this->savdb);
145
+		$localobject->lines[0]->fk_product = $product_id;
146
+		$localobject->lines[0]->label = 'Label 1';
147
+		$localobject->lines[0]->desc = "This is a description with a é accent\n(Country of origin: France)";
148 148
 
149
-    	$result=pdf_getlinedesc($localobject,0,$langs);
149
+    	$result = pdf_getlinedesc($localobject, 0, $langs);
150 150
     	print __METHOD__." result=".$result."\n";
151
-    	$this->assertEquals($result,"PIDRESS - Label 1<br>This is a description with a &eacute; accent<br>(Country of origin: France)");
151
+    	$this->assertEquals($result, "PIDRESS - Label 1<br>This is a description with a &eacute; accent<br>(Country of origin: France)");
152 152
 
153
-    	$result=doc_getlinedesc($localobject->lines[0],$langs);
153
+    	$result = doc_getlinedesc($localobject->lines[0], $langs);
154 154
     	print __METHOD__." result=".$result."\n";
155
-    	$this->assertEquals($result,"PIDRESS - Label 1\nThis is a description with a é accent\n(Country of origin: France)");
155
+    	$this->assertEquals($result, "PIDRESS - Label 1\nThis is a description with a é accent\n(Country of origin: France)");
156 156
     }
157 157
 
158 158
     /**
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
     */
163 163
     public function testPdfGetHeightForLogo()
164 164
     {
165
-        $file=dirname(__FILE__).'/img250x50.jpg';
166
-        $result=pdf_getHeightForLogo($file);
165
+        $file = dirname(__FILE__).'/img250x50.jpg';
166
+        $result = pdf_getHeightForLogo($file);
167 167
         print __METHOD__." result=".$result."\n";
168
-    	$this->assertEquals($result,22);
169
-        $file=dirname(__FILE__).'/img250x20.png';
170
-        $result=pdf_getHeightForLogo($file);
168
+    	$this->assertEquals($result, 22);
169
+        $file = dirname(__FILE__).'/img250x20.png';
170
+        $result = pdf_getHeightForLogo($file);
171 171
         print __METHOD__." result=".$result."\n";
172
-    	$this->assertEquals($result,10.4);
172
+    	$this->assertEquals($result, 10.4);
173 173
     }
174 174
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/LoanTest.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
 if (empty($user->id))
33 33
 {
34
-	print "Load permissions for admin user nb 1\n";
35
-	$user->fetch(1);
36
-	$user->getrights();
34
+    print "Load permissions for admin user nb 1\n";
35
+    $user->fetch(1);
36
+    $user->getrights();
37 37
 }
38 38
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
39 39
 
@@ -47,75 +47,75 @@  discard block
 block discarded – undo
47 47
  */
48 48
 class LoanTest extends PHPUnit_Framework_TestCase
49 49
 {
50
-	protected $savconf;
51
-	protected $savuser;
52
-	protected $savlangs;
53
-	protected $savdb;
54
-
55
-	/**
56
-	 * Constructor
57
-	 * We save global variables into local variables
58
-	 *
59
-	 * @return LoanTest
60
-	 */
61
-	function __construct()
62
-	{
63
-		parent::__construct();
64
-
65
-		//$this->sharedFixture
66
-		global $conf,$user,$langs,$db;
67
-		$this->savconf=$conf;
68
-		$this->savuser=$user;
69
-		$this->savlangs=$langs;
70
-		$this->savdb=$db;
71
-
72
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
-		//print " - db ".$db->db;
74
-		print "\n";
75
-	}
76
-
77
-	// Static methods
78
-  	public static function setUpBeforeClass()
50
+    protected $savconf;
51
+    protected $savuser;
52
+    protected $savlangs;
53
+    protected $savdb;
54
+
55
+    /**
56
+     * Constructor
57
+     * We save global variables into local variables
58
+     *
59
+     * @return LoanTest
60
+     */
61
+    function __construct()
62
+    {
63
+        parent::__construct();
64
+
65
+        //$this->sharedFixture
66
+        global $conf,$user,$langs,$db;
67
+        $this->savconf=$conf;
68
+        $this->savuser=$user;
69
+        $this->savlangs=$langs;
70
+        $this->savdb=$db;
71
+
72
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
+        //print " - db ".$db->db;
74
+        print "\n";
75
+    }
76
+
77
+    // Static methods
78
+        public static function setUpBeforeClass()
79 79
     {
80
-    	global $conf,$user,$langs,$db;
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
-    	print __METHOD__."\n";
83
+        print __METHOD__."\n";
84 84
     }
85 85
 
86 86
     // tear down after class
87 87
     public static function tearDownAfterClass()
88 88
     {
89
-    	global $conf,$user,$langs,$db;
90
-		$db->rollback();
89
+        global $conf,$user,$langs,$db;
90
+        $db->rollback();
91 91
 
92
-		print __METHOD__."\n";
92
+        print __METHOD__."\n";
93 93
     }
94 94
 
95
-	/**
96
-	 * Init phpunit tests
97
-	 *
98
-	 * @return	void
99
-	 */
95
+    /**
96
+     * Init phpunit tests
97
+     *
98
+     * @return	void
99
+     */
100 100
     protected function setUp()
101 101
     {
102
-    	global $conf,$user,$langs,$db;
103
-		$conf=$this->savconf;
104
-		$user=$this->savuser;
105
-		$langs=$this->savlangs;
106
-		$db=$this->savdb;
107
-
108
-		print __METHOD__."\n";
109
-		//print $db->getVersion()."\n";
102
+        global $conf,$user,$langs,$db;
103
+        $conf=$this->savconf;
104
+        $user=$this->savuser;
105
+        $langs=$this->savlangs;
106
+        $db=$this->savdb;
107
+
108
+        print __METHOD__."\n";
109
+        //print $db->getVersion()."\n";
110 110
     }
111
-	/**
112
-	 * End phpunit tests
113
-	 *
114
-	 * @return	void
115
-	 */
111
+    /**
112
+     * End phpunit tests
113
+     *
114
+     * @return	void
115
+     */
116 116
     protected function tearDown()
117 117
     {
118
-    	print __METHOD__."\n";
118
+        print __METHOD__."\n";
119 119
     }
120 120
 
121 121
     /**
@@ -125,19 +125,19 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function testLoanCreate()
127 127
     {
128
-    	global $conf,$user,$langs,$db;
129
-		$conf=$this->savconf;
130
-		$user=$this->savuser;
131
-		$langs=$this->savlangs;
132
-		$db=$this->savdb;
133
-
134
-		$localobject=new Loan($this->savdb);
135
-    	$localobject->initAsSpecimen();
136
-    	$result=$localobject->create($user);
137
-
138
-    	$this->assertLessThan($result, 0);
139
-    	print __METHOD__." result=".$result."\n";
140
-    	return $result;
128
+        global $conf,$user,$langs,$db;
129
+        $conf=$this->savconf;
130
+        $user=$this->savuser;
131
+        $langs=$this->savlangs;
132
+        $db=$this->savdb;
133
+
134
+        $localobject=new Loan($this->savdb);
135
+        $localobject->initAsSpecimen();
136
+        $result=$localobject->create($user);
137
+
138
+        $this->assertLessThan($result, 0);
139
+        print __METHOD__." result=".$result."\n";
140
+        return $result;
141 141
     }
142 142
 
143 143
     /**
@@ -151,21 +151,21 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function testLoanFetch($id)
153 153
     {
154
-    	global $conf,$user,$langs,$db;
155
-		$conf=$this->savconf;
156
-		$user=$this->savuser;
157
-		$langs=$this->savlangs;
158
-		$db=$this->savdb;
159
-
160
-		$localobject=new Loan($this->savdb);
161
-    	$result=$localobject->fetch($id);
162
-
163
-    	$this->assertLessThan($result, 0);
164
-    	print __METHOD__." id=".$id." result=".$result."\n";
165
-    	return $localobject;
154
+        global $conf,$user,$langs,$db;
155
+        $conf=$this->savconf;
156
+        $user=$this->savuser;
157
+        $langs=$this->savlangs;
158
+        $db=$this->savdb;
159
+
160
+        $localobject=new Loan($this->savdb);
161
+        $result=$localobject->fetch($id);
162
+
163
+        $this->assertLessThan($result, 0);
164
+        print __METHOD__." id=".$id." result=".$result."\n";
165
+        return $localobject;
166 166
     }
167 167
 
168
-	/**
168
+    /**
169 169
      * testLoanOther
170 170
      *
171 171
      * @param	Loan	$localobject	Loan
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 
185 185
         $result=$localobject->set_paid($user);
186 186
 
187
-    	print __METHOD__." id=".$localobject->id." result=".$result."\n";
188
-    	$this->assertLessThan($result, 0);
187
+        print __METHOD__." id=".$localobject->id." result=".$result."\n";
188
+        $this->assertLessThan($result, 0);
189 189
         return $localobject->id;
190 190
     }
191 191
 
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
      */
201 201
     public function testLoanDelete($id)
202 202
     {
203
-    	global $conf,$user,$langs,$db;
204
-		$conf=$this->savconf;
205
-		$user=$this->savuser;
206
-		$langs=$this->savlangs;
207
-		$db=$this->savdb;
208
-
209
-		$localobject=new Loan($this->savdb);
210
-    	$result=$localobject->fetch($id);
211
-		$result=$localobject->delete($user);
212
-
213
-		print __METHOD__." id=".$id." result=".$result."\n";
214
-    	$this->assertLessThan($result, 0);
215
-    	return $result;
203
+        global $conf,$user,$langs,$db;
204
+        $conf=$this->savconf;
205
+        $user=$this->savuser;
206
+        $langs=$this->savlangs;
207
+        $db=$this->savdb;
208
+
209
+        $localobject=new Loan($this->savdb);
210
+        $result=$localobject->fetch($id);
211
+        $result=$localobject->delete($user);
212
+
213
+        print __METHOD__." id=".$id." result=".$result."\n";
214
+        $this->assertLessThan($result, 0);
215
+        return $result;
216 216
     }
217 217
 }
Please login to merge, or discard this 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';
@@ -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
 		//print $db->getVersion()."\n";
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function testLoanCreate()
127 127
     {
128
-    	global $conf,$user,$langs,$db;
129
-		$conf=$this->savconf;
130
-		$user=$this->savuser;
131
-		$langs=$this->savlangs;
132
-		$db=$this->savdb;
128
+    	global $conf, $user, $langs, $db;
129
+		$conf = $this->savconf;
130
+		$user = $this->savuser;
131
+		$langs = $this->savlangs;
132
+		$db = $this->savdb;
133 133
 
134
-		$localobject=new Loan($this->savdb);
134
+		$localobject = new Loan($this->savdb);
135 135
     	$localobject->initAsSpecimen();
136
-    	$result=$localobject->create($user);
136
+    	$result = $localobject->create($user);
137 137
 
138 138
     	$this->assertLessThan($result, 0);
139 139
     	print __METHOD__." result=".$result."\n";
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function testLoanFetch($id)
153 153
     {
154
-    	global $conf,$user,$langs,$db;
155
-		$conf=$this->savconf;
156
-		$user=$this->savuser;
157
-		$langs=$this->savlangs;
158
-		$db=$this->savdb;
154
+    	global $conf, $user, $langs, $db;
155
+		$conf = $this->savconf;
156
+		$user = $this->savuser;
157
+		$langs = $this->savlangs;
158
+		$db = $this->savdb;
159 159
 
160
-		$localobject=new Loan($this->savdb);
161
-    	$result=$localobject->fetch($id);
160
+		$localobject = new Loan($this->savdb);
161
+    	$result = $localobject->fetch($id);
162 162
 
163 163
     	$this->assertLessThan($result, 0);
164 164
     	print __METHOD__." id=".$id." result=".$result."\n";
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function testLoanOther($localobject)
178 178
     {
179
-        global $conf,$user,$langs,$db;
180
-        $conf=$this->savconf;
181
-        $user=$this->savuser;
182
-        $langs=$this->savlangs;
183
-        $db=$this->savdb;
179
+        global $conf, $user, $langs, $db;
180
+        $conf = $this->savconf;
181
+        $user = $this->savuser;
182
+        $langs = $this->savlangs;
183
+        $db = $this->savdb;
184 184
 
185
-        $result=$localobject->set_paid($user);
185
+        $result = $localobject->set_paid($user);
186 186
 
187 187
     	print __METHOD__." id=".$localobject->id." result=".$result."\n";
188 188
     	$this->assertLessThan($result, 0);
@@ -200,15 +200,15 @@  discard block
 block discarded – undo
200 200
      */
201 201
     public function testLoanDelete($id)
202 202
     {
203
-    	global $conf,$user,$langs,$db;
204
-		$conf=$this->savconf;
205
-		$user=$this->savuser;
206
-		$langs=$this->savlangs;
207
-		$db=$this->savdb;
208
-
209
-		$localobject=new Loan($this->savdb);
210
-    	$result=$localobject->fetch($id);
211
-		$result=$localobject->delete($user);
203
+    	global $conf, $user, $langs, $db;
204
+		$conf = $this->savconf;
205
+		$user = $this->savuser;
206
+		$langs = $this->savlangs;
207
+		$db = $this->savdb;
208
+
209
+		$localobject = new Loan($this->savdb);
210
+    	$result = $localobject->fetch($id);
211
+		$result = $localobject->delete($user);
212 212
 
213 213
 		print __METHOD__." id=".$id." result=".$result."\n";
214 214
     	$this->assertLessThan($result, 0);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/AdherentTest.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
      */
62 62
     function __construct()
63 63
     {
64
-    	parent::__construct();
64
+        parent::__construct();
65 65
 
66
-    	//$this->sharedFixture
66
+        //$this->sharedFixture
67 67
         global $conf,$user,$langs,$db;
68 68
         $this->savconf=$conf;
69 69
         $this->savuser=$user;
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
         $result=$localobject->update_note($localobject->note,'_private');
271 271
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
272 272
         $this->assertLessThan($result, 0);
273
-		$result=$localobject->update_note($localobject->note,'_public');
273
+        $result=$localobject->update_note($localobject->note,'_public');
274 274
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
275 275
         $this->assertLessThan($result, 0);
276 276
 
@@ -338,15 +338,15 @@  discard block
 block discarded – undo
338 338
         return $localobject;
339 339
     }
340 340
 
341
-     /**
342
-     * testAdherentSetUserId
343
-     *
344
-     * @param   Adherent    $localobject    Member instance
345
-     * @return  Adherent
346
-     *
347
-     * @depends testAdherentMakeSubstitution
348
-     * The depends says test is run only if previous is ok
349
-     */
341
+        /**
342
+         * testAdherentSetUserId
343
+         *
344
+         * @param   Adherent    $localobject    Member instance
345
+         * @return  Adherent
346
+         *
347
+         * @depends testAdherentMakeSubstitution
348
+         * The depends says test is run only if previous is ok
349
+         */
350 350
     public function testAdherentSetUserId(Adherent $localobject)
351 351
     {
352 352
         global $conf,$user,$langs,$db;
Please login to merge, or discard this patch.
Spacing   +126 added lines, -126 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
 /**
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
     	parent::__construct();
65 65
 
66 66
     	//$this->sharedFixture
67
-        global $conf,$user,$langs,$db;
68
-        $this->savconf=$conf;
69
-        $this->savuser=$user;
70
-        $this->savlangs=$langs;
71
-        $this->savdb=$db;
67
+        global $conf, $user, $langs, $db;
68
+        $this->savconf = $conf;
69
+        $this->savuser = $user;
70
+        $this->savlangs = $langs;
71
+        $this->savdb = $db;
72 72
 
73 73
         print __METHOD__." db->type=".$db->type." user->id=".$user->id;
74 74
         //print " - db ".$db->db;
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
     // Static methods
79 79
     public static function setUpBeforeClass()
80 80
     {
81
-        global $conf,$user,$langs,$db;
81
+        global $conf, $user, $langs, $db;
82 82
         $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
83 83
 
84
-        if (! empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) {
84
+        if (!empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) {
85 85
             print "\n".__METHOD__." Company must be setup to have name-firstname in order 'Firstname Lastname'\n";
86 86
             die();
87 87
         }
88
-        if (! empty($conf->global->MAIN_MODULE_LDAP)) { print "\n".__METHOD__." module LDAP must be disabled.\n"; die(); }
89
-        if (! empty($conf->global->MAIN_MODULE_MAILMANSPIP)) { print "\n".__METHOD__." module MailmanSpip must be disabled.\n"; die(); }
88
+        if (!empty($conf->global->MAIN_MODULE_LDAP)) { print "\n".__METHOD__." module LDAP must be disabled.\n"; die(); }
89
+        if (!empty($conf->global->MAIN_MODULE_MAILMANSPIP)) { print "\n".__METHOD__." module MailmanSpip must be disabled.\n"; die(); }
90 90
 
91 91
         print __METHOD__."\n";
92 92
     }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     // tear down after class
95 95
     public static function tearDownAfterClass()
96 96
     {
97
-        global $conf,$user,$langs,$db;
97
+        global $conf, $user, $langs, $db;
98 98
         $db->rollback();
99 99
 
100 100
         print __METHOD__."\n";
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
      */
108 108
     protected function setUp()
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 116
         print __METHOD__."\n";
117 117
     }
@@ -132,18 +132,18 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function testAdherentTypeCreate()
134 134
     {
135
-        global $conf,$user,$langs,$db;
136
-        $conf=$this->savconf;
137
-        $user=$this->savuser;
138
-        $langs=$this->savlangs;
139
-        $db=$this->savdb;
140
-
141
-        $localobject=new AdherentType($this->savdb);
142
-        $localobject->statut=1;
143
-        $localobject->label='Adherent type test';
144
-        $localobject->subscription=1;
145
-        $localobject->vote=1;
146
-        $result=$localobject->create($user);
135
+        global $conf, $user, $langs, $db;
136
+        $conf = $this->savconf;
137
+        $user = $this->savuser;
138
+        $langs = $this->savlangs;
139
+        $db = $this->savdb;
140
+
141
+        $localobject = new AdherentType($this->savdb);
142
+        $localobject->statut = 1;
143
+        $localobject->label = 'Adherent type test';
144
+        $localobject->subscription = 1;
145
+        $localobject->vote = 1;
146
+        $result = $localobject->create($user);
147 147
         print __METHOD__." result=".$result."\n";
148 148
         $this->assertLessThan($result, 0);
149 149
 
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function testAdherentCreate($fk_adherent_type)
163 163
     {
164
-        global $conf,$user,$langs,$db;
165
-        $conf=$this->savconf;
166
-        $user=$this->savuser;
167
-        $langs=$this->savlangs;
168
-        $db=$this->savdb;
164
+        global $conf, $user, $langs, $db;
165
+        $conf = $this->savconf;
166
+        $user = $this->savuser;
167
+        $langs = $this->savlangs;
168
+        $db = $this->savdb;
169 169
 
170
-        $localobject=new Adherent($this->savdb);
170
+        $localobject = new Adherent($this->savdb);
171 171
         $localobject->initAsSpecimen();
172
-        $localobject->typeid=$fk_adherent_type;
173
-        $result=$localobject->create($user);
172
+        $localobject->typeid = $fk_adherent_type;
173
+        $result = $localobject->create($user);
174 174
         print __METHOD__." result=".$result."\n";
175 175
         $this->assertLessThan($result, 0);
176 176
 
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
      */
189 189
     public function testAdherentFetch($id)
190 190
     {
191
-        global $conf,$user,$langs,$db;
192
-        $conf=$this->savconf;
193
-        $user=$this->savuser;
194
-        $langs=$this->savlangs;
195
-        $db=$this->savdb;
196
-
197
-        $localobject=new Adherent($this->savdb);
198
-        $result=$localobject->fetch($id);
191
+        global $conf, $user, $langs, $db;
192
+        $conf = $this->savconf;
193
+        $user = $this->savuser;
194
+        $langs = $this->savlangs;
195
+        $db = $this->savdb;
196
+
197
+        $localobject = new Adherent($this->savdb);
198
+        $result = $localobject->fetch($id);
199 199
         print __METHOD__." id=".$id." result=".$result."\n";
200 200
         $this->assertLessThan($result, 0);
201 201
         return $localobject;
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public function testAdherentFetchLogin(Adherent $localobject)
214 214
     {
215
-        global $conf,$user,$langs,$db;
216
-        $conf=$this->savconf;
217
-        $user=$this->savuser;
218
-        $langs=$this->savlangs;
219
-        $db=$this->savdb;
215
+        global $conf, $user, $langs, $db;
216
+        $conf = $this->savconf;
217
+        $user = $this->savuser;
218
+        $langs = $this->savlangs;
219
+        $db = $this->savdb;
220 220
 
221 221
         $newobject = new Adherent($this->savdb);
222 222
         $result = $newobject->fetch_login($localobject->login);
@@ -237,45 +237,45 @@  discard block
 block discarded – undo
237 237
      */
238 238
     public function testAdherentUpdate(Adherent $localobject)
239 239
     {
240
-        global $conf,$user,$langs,$db;
241
-        $conf=$this->savconf;
242
-        $user=$this->savuser;
243
-        $langs=$this->savlangs;
244
-        $db=$this->savdb;
240
+        global $conf, $user, $langs, $db;
241
+        $conf = $this->savconf;
242
+        $user = $this->savuser;
243
+        $langs = $this->savlangs;
244
+        $db = $this->savdb;
245 245
 
246 246
         $timestamp = dol_now();
247 247
 
248 248
         $localobject->civility_id = 0;
249
-        $localobject->login='newlogin';
250
-        $localobject->societe='New company';
251
-        $localobject->note='New note after update';
249
+        $localobject->login = 'newlogin';
250
+        $localobject->societe = 'New company';
251
+        $localobject->note = 'New note after update';
252 252
         //$localobject->note_public='New note public after update';
253
-        $localobject->lastname='New name';
254
-        $localobject->firstname='New firstname';
255
-        $localobject->gender='man';
256
-        $localobject->address='New address';
257
-        $localobject->zip='New zip';
258
-        $localobject->town='New town';
259
-        $localobject->country_id=2;
260
-        $localobject->statut=0;
261
-        $localobject->morphy=0;
262
-        $localobject->phone='New tel pro';
263
-        $localobject->phone_perso='New tel perso';
264
-        $localobject->phone_mobile='New tel mobile';
265
-        $localobject->email='[email protected]';
266
-        $localobject->birth=$timestamp;
267
-        $result=$localobject->update($user);
253
+        $localobject->lastname = 'New name';
254
+        $localobject->firstname = 'New firstname';
255
+        $localobject->gender = 'man';
256
+        $localobject->address = 'New address';
257
+        $localobject->zip = 'New zip';
258
+        $localobject->town = 'New town';
259
+        $localobject->country_id = 2;
260
+        $localobject->statut = 0;
261
+        $localobject->morphy = 0;
262
+        $localobject->phone = 'New tel pro';
263
+        $localobject->phone_perso = 'New tel perso';
264
+        $localobject->phone_mobile = 'New tel mobile';
265
+        $localobject->email = '[email protected]';
266
+        $localobject->birth = $timestamp;
267
+        $result = $localobject->update($user);
268 268
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
269 269
         $this->assertLessThan($result, 0);
270
-        $result=$localobject->update_note($localobject->note,'_private');
270
+        $result = $localobject->update_note($localobject->note, '_private');
271 271
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
272 272
         $this->assertLessThan($result, 0);
273
-		$result=$localobject->update_note($localobject->note,'_public');
273
+		$result = $localobject->update_note($localobject->note, '_public');
274 274
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
275 275
         $this->assertLessThan($result, 0);
276 276
 
277
-        $newobject=new Adherent($this->savdb);
278
-        $result=$newobject->fetch($localobject->id);
277
+        $newobject = new Adherent($this->savdb);
278
+        $result = $newobject->fetch($localobject->id);
279 279
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
280 280
         $this->assertLessThan($result, 0);
281 281
 
@@ -315,20 +315,20 @@  discard block
 block discarded – undo
315 315
      */
316 316
     public function testAdherentMakeSubstitution(Adherent $localobject)
317 317
     {
318
-        global $conf,$user,$langs,$db;
319
-        $conf=$this->savconf;
320
-        $user=$this->savuser;
321
-        $langs=$this->savlangs;
322
-        $db=$this->savdb;
318
+        global $conf, $user, $langs, $db;
319
+        $conf = $this->savconf;
320
+        $user = $this->savuser;
321
+        $langs = $this->savlangs;
322
+        $db = $this->savdb;
323 323
 
324
-        $conf->global->MAIN_FIRSTNAME_NAME_POSITION = 0;	// Force setup for firstname+lastname
324
+        $conf->global->MAIN_FIRSTNAME_NAME_POSITION = 0; // Force setup for firstname+lastname
325 325
 
326 326
         $template = '__CIVILITY__,__FIRSTNAME__,__LASTNAME__,__FULLNAME__,__COMPANY__,'.
327 327
                     '__ADDRESS__,__ZIP__,__TOWN__,__COUNTRY__,__EMAIL__,__BIRTH__,__PHOTO__,__LOGIN__';
328 328
 
329 329
         // If option to store clear password has been set, we get 'dolibspec' into PASSWORD field.
330 330
         $expected = ',New firstname,New name,New firstname New name,'.
331
-                    'New company,New address,New zip,New town,Belgium,[email protected],'.dol_print_date($localobject->birth,'day').',,'.
331
+                    'New company,New address,New zip,New town,Belgium,[email protected],'.dol_print_date($localobject->birth, 'day').',,'.
332 332
                     'newlogin';
333 333
 
334 334
         $result = $localobject->makeSubstitution($template);
@@ -349,11 +349,11 @@  discard block
 block discarded – undo
349 349
      */
350 350
     public function testAdherentSetUserId(Adherent $localobject)
351 351
     {
352
-        global $conf,$user,$langs,$db;
353
-        $conf=$this->savconf;
354
-        $user=$this->savuser;
355
-        $langs=$this->savlangs;
356
-        $db=$this->savdb;
352
+        global $conf, $user, $langs, $db;
353
+        $conf = $this->savconf;
354
+        $user = $this->savuser;
355
+        $langs = $this->savlangs;
356
+        $db = $this->savdb;
357 357
 
358 358
         //We associate member with user
359 359
         $result = $localobject->setUserId($user->id);
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
      */
392 392
     public function testAdherentSetThirdPartyId(Adherent $localobject)
393 393
     {
394
-        global $conf,$user,$langs,$db;
395
-        $conf=$this->savconf;
396
-        $user=$this->savuser;
397
-        $langs=$this->savlangs;
398
-        $db=$this->savdb;
394
+        global $conf, $user, $langs, $db;
395
+        $conf = $this->savconf;
396
+        $user = $this->savuser;
397
+        $langs = $this->savlangs;
398
+        $db = $this->savdb;
399 399
 
400 400
         //Create a Third Party
401 401
         $thirdparty = new Societe($db);
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         $this->assertNull($localobject->fk_soc);
424 424
 
425 425
         //Now we remove the third party
426
-        $result = $thirdparty->delete($thirdparty->id,$user);
426
+        $result = $thirdparty->delete($thirdparty->id, $user);
427 427
         $this->assertEquals($result, 1);
428 428
 
429 429
         return $localobject;
@@ -440,13 +440,13 @@  discard block
 block discarded – undo
440 440
      */
441 441
     public function testAdherentValidate(Adherent $localobject)
442 442
     {
443
-        global $conf,$user,$langs,$db;
444
-        $conf=$this->savconf;
445
-        $user=$this->savuser;
446
-        $langs=$this->savlangs;
447
-        $db=$this->savdb;
443
+        global $conf, $user, $langs, $db;
444
+        $conf = $this->savconf;
445
+        $user = $this->savuser;
446
+        $langs = $this->savlangs;
447
+        $db = $this->savdb;
448 448
 
449
-        $result=$localobject->validate($user);
449
+        $result = $localobject->validate($user);
450 450
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
451 451
         $this->assertLessThan($result, 0);
452 452
 
@@ -464,11 +464,11 @@  discard block
 block discarded – undo
464 464
      */
465 465
     public function testAdherentOther(Adherent $localobject)
466 466
     {
467
-        global $conf,$user,$langs,$db;
468
-        $conf=$this->savconf;
469
-        $user=$this->savuser;
470
-        $langs=$this->savlangs;
471
-        $db=$this->savdb;
467
+        global $conf, $user, $langs, $db;
468
+        $conf = $this->savconf;
469
+        $user = $this->savuser;
470
+        $langs = $this->savlangs;
471
+        $db = $this->savdb;
472 472
 
473 473
         /*$result=$localobject->setstatus(0);
474 474
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
@@ -493,11 +493,11 @@  discard block
 block discarded – undo
493 493
      */
494 494
     public function testAdherentResiliate(Adherent $localobject)
495 495
     {
496
-        global $conf,$user,$langs,$db;
497
-        $conf=$this->savconf;
498
-        $user=$this->savuser;
499
-        $langs=$this->savlangs;
500
-        $db=$this->savdb;
496
+        global $conf, $user, $langs, $db;
497
+        $conf = $this->savconf;
498
+        $user = $this->savuser;
499
+        $langs = $this->savlangs;
500
+        $db = $this->savdb;
501 501
 
502 502
         //Let's resilie un adherent
503 503
         $result = $localobject->resiliate($user);
@@ -530,13 +530,13 @@  discard block
 block discarded – undo
530 530
      */
531 531
     public function testAdherentDelete($localobject)
532 532
     {
533
-        global $conf,$user,$langs,$db;
534
-        $conf=$this->savconf;
535
-        $user=$this->savuser;
536
-        $langs=$this->savlangs;
537
-        $db=$this->savdb;
533
+        global $conf, $user, $langs, $db;
534
+        $conf = $this->savconf;
535
+        $user = $this->savuser;
536
+        $langs = $this->savlangs;
537
+        $db = $this->savdb;
538 538
 
539
-        $result=$localobject->delete($localobject->id, $user);
539
+        $result = $localobject->delete($localobject->id, $user);
540 540
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
541 541
         $this->assertLessThan($result, 0);
542 542
 
@@ -555,15 +555,15 @@  discard block
 block discarded – undo
555 555
      */
556 556
     public function testAdherentTypeDelete($localobject)
557 557
     {
558
-        global $conf,$user,$langs,$db;
559
-        $conf=$this->savconf;
560
-        $user=$this->savuser;
561
-        $langs=$this->savlangs;
562
-        $db=$this->savdb;
563
-
564
-        $localobjectat=new AdherentType($this->savdb);
565
-        $result=$localobjectat->fetch($localobject->typeid);
566
-        $result=$localobjectat->delete();
558
+        global $conf, $user, $langs, $db;
559
+        $conf = $this->savconf;
560
+        $user = $this->savuser;
561
+        $langs = $this->savlangs;
562
+        $db = $this->savdb;
563
+
564
+        $localobjectat = new AdherentType($this->savdb);
565
+        $result = $localobjectat->fetch($localobject->typeid);
566
+        $result = $localobjectat->delete();
567 567
         print __METHOD__." result=".$result."\n";
568 568
         $this->assertLessThan($result, 0);
569 569
 
Please login to merge, or discard this patch.