Test Failed
Push — master ( e0c20c...b8c830 )
by Alxarafe
39:29
created
dolibarr/test/phpunit/XCalLibTest.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
      */
60 60
     function __construct()
61 61
     {
62
-    	parent::__construct();
62
+        parent::__construct();
63 63
 
64
-    	//$this->sharedFixture
64
+        //$this->sharedFixture
65 65
         global $conf,$user,$langs,$db;
66 66
         $this->savconf=$conf;
67 67
         $this->savuser=$user;
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      * End phpunit tests
111 111
      *
112 112
      * @return	void
113
-    */
113
+     */
114 114
     protected function tearDown()
115 115
     {
116 116
         print __METHOD__."\n";
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *      \remarks    To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     $user->fetch(1);
35 35
     $user->getrights();
36 36
 }
37
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
37
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
38 38
 
39 39
 
40 40
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
     	parent::__construct();
63 63
 
64 64
     	//$this->sharedFixture
65
-        global $conf,$user,$langs,$db;
66
-        $this->savconf=$conf;
67
-        $this->savuser=$user;
68
-        $this->savlangs=$langs;
69
-        $this->savdb=$db;
65
+        global $conf, $user, $langs, $db;
66
+        $this->savconf = $conf;
67
+        $this->savuser = $user;
68
+        $this->savlangs = $langs;
69
+        $this->savdb = $db;
70 70
 
71 71
         print __METHOD__." db->type=".$db->type." user->id=".$user->id;
72 72
         //print " - db ".$db->db;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     // Static methods
77 77
     public static function setUpBeforeClass()
78 78
     {
79
-        global $conf,$user,$langs,$db;
79
+        global $conf, $user, $langs, $db;
80 80
         $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
81 81
 
82 82
         print __METHOD__."\n";
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     // tear down after class
86 86
     public static function tearDownAfterClass()
87 87
     {
88
-        global $conf,$user,$langs,$db;
88
+        global $conf, $user, $langs, $db;
89 89
         $db->rollback();
90 90
 
91 91
         print __METHOD__."\n";
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
      */
99 99
     protected function setUp()
100 100
     {
101
-        global $conf,$user,$langs,$db;
102
-        $conf=$this->savconf;
103
-        $user=$this->savuser;
104
-        $langs=$this->savlangs;
105
-        $db=$this->savdb;
101
+        global $conf, $user, $langs, $db;
102
+        $conf = $this->savconf;
103
+        $user = $this->savuser;
104
+        $langs = $this->savlangs;
105
+        $db = $this->savdb;
106 106
 
107 107
         print __METHOD__."\n";
108 108
     }
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function testQuotedPrintEncodeDecode()
126 126
     {
127
-        global $conf,$user,$langs,$db;
128
-        $conf=$this->savconf;
129
-        $user=$this->savuser;
130
-        $langs=$this->savlangs;
131
-        $db=$this->savdb;
132
-
133
-        $stringtoencode='ABCD=1234;';
134
-        $result=quotedPrintEncode($stringtoencode);
127
+        global $conf, $user, $langs, $db;
128
+        $conf = $this->savconf;
129
+        $user = $this->savuser;
130
+        $langs = $this->savlangs;
131
+        $db = $this->savdb;
132
+
133
+        $stringtoencode = 'ABCD=1234;';
134
+        $result = quotedPrintEncode($stringtoencode);
135 135
         print __METHOD__." result=".$result."\n";
136
-        $this->assertEquals('ABCD=3D1234;',$result);
136
+        $this->assertEquals('ABCD=3D1234;', $result);
137 137
 
138
-        $resultback=quotedPrintDecode($result);
138
+        $resultback = quotedPrintDecode($result);
139 139
         print __METHOD__." result=".$resultback."\n";
140
-        $this->assertEquals($stringtoencode,$resultback);
140
+        $this->assertEquals($stringtoencode, $resultback);
141 141
     }
142 142
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/DateLibTzFranceTest.php 2 patches
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
 if (empty($user->id))
33 33
 {
34
-	print "Load permissions for admin user nb 1\n";
35
-	$user->fetch(1);
36
-	$user->getrights();
34
+    print "Load permissions for admin user nb 1\n";
35
+    $user->fetch(1);
36
+    $user->getrights();
37 37
 }
38 38
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
39 39
 
@@ -47,79 +47,79 @@  discard block
 block discarded – undo
47 47
  */
48 48
 class DateLibTzFranceTest extends PHPUnit_Framework_TestCase
49 49
 {
50
-	protected $savconf;
51
-	protected $savuser;
52
-	protected $savlangs;
53
-	protected $savdb;
54
-
55
-	/**
56
-	 * Constructor
57
-	 * We save global variables into local variables
58
-	 *
59
-	 * @return DateLibTest
60
-	 */
61
-	function __construct()
62
-	{
63
-		parent::__construct();
64
-
65
-		//$this->sharedFixture
66
-		global $conf,$user,$langs,$db;
67
-		$this->savconf=$conf;
68
-		$this->savuser=$user;
69
-		$this->savlangs=$langs;
70
-		$this->savdb=$db;
71
-
72
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
-		//print " - db ".$db->db;
74
-		print "\n";
75
-	}
76
-
77
-	// Static methods
78
-  	public static function setUpBeforeClass()
50
+    protected $savconf;
51
+    protected $savuser;
52
+    protected $savlangs;
53
+    protected $savdb;
54
+
55
+    /**
56
+     * Constructor
57
+     * We save global variables into local variables
58
+     *
59
+     * @return DateLibTest
60
+     */
61
+    function __construct()
79 62
     {
80
-    	global $conf,$user,$langs,$db;
63
+        parent::__construct();
81 64
 
82
-    	if (getServerTimeZoneString() != 'Europe/Paris') {
83
-    		print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ+1 Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die();
84
-    	}
65
+        //$this->sharedFixture
66
+        global $conf,$user,$langs,$db;
67
+        $this->savconf=$conf;
68
+        $this->savuser=$user;
69
+        $this->savlangs=$langs;
70
+        $this->savdb=$db;
71
+
72
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
+        //print " - db ".$db->db;
74
+        print "\n";
75
+    }
85 76
 
86
-    	$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
77
+    // Static methods
78
+        public static function setUpBeforeClass()
79
+    {
80
+        global $conf,$user,$langs,$db;
81
+
82
+        if (getServerTimeZoneString() != 'Europe/Paris') {
83
+            print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ+1 Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die();
84
+        }
87 85
 
88
-    	print __METHOD__."\n";
86
+        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
87
+
88
+        print __METHOD__."\n";
89 89
     }
90 90
 
91 91
     // tear down after class
92 92
     public static function tearDownAfterClass()
93 93
     {
94
-    	global $conf,$user,$langs,$db;
95
-		$db->rollback();
94
+        global $conf,$user,$langs,$db;
95
+        $db->rollback();
96 96
 
97
-		print __METHOD__."\n";
97
+        print __METHOD__."\n";
98 98
     }
99 99
 
100
-	/**
101
-	 * Init phpunit tests
102
-	 *
103
-	 * @return	void
104
-	 */
100
+    /**
101
+     * Init phpunit tests
102
+     *
103
+     * @return	void
104
+     */
105 105
     protected function setUp()
106 106
     {
107
-    	global $conf,$user,$langs,$db;
108
-		$conf=$this->savconf;
109
-		$user=$this->savuser;
110
-		$langs=$this->savlangs;
111
-		$db=$this->savdb;
107
+        global $conf,$user,$langs,$db;
108
+        $conf=$this->savconf;
109
+        $user=$this->savuser;
110
+        $langs=$this->savlangs;
111
+        $db=$this->savdb;
112 112
 
113
-		print __METHOD__."\n";
113
+        print __METHOD__."\n";
114 114
     }
115
-	/**
116
-	 * End phpunit tests
117
-	 *
118
-	 * @return	void
119
-	 */
115
+    /**
116
+     * End phpunit tests
117
+     *
118
+     * @return	void
119
+     */
120 120
     protected function tearDown()
121 121
     {
122
-    	print __METHOD__."\n";
122
+        print __METHOD__."\n";
123 123
     }
124 124
 
125 125
     /**
@@ -139,66 +139,66 @@  discard block
 block discarded – undo
139 139
         $langs=$this->savlangs;
140 140
         $db=$this->savdb;
141 141
 
142
-    	// Check %Y-%m-%d %H:%M:%S format
142
+        // Check %Y-%m-%d %H:%M:%S format
143 143
         $result=dol_print_date(0,'%Y-%m-%d %H:%M:%S',false);
144
-       	print __METHOD__." result=".$result."\n";
145
-    	$this->assertEquals('1970-01-01 01:00:00',$result);
144
+            print __METHOD__." result=".$result."\n";
145
+        $this->assertEquals('1970-01-01 01:00:00',$result);
146 146
 
147
-    	// Check %Y-%m-%d %H:%M:%S format
147
+        // Check %Y-%m-%d %H:%M:%S format
148 148
         $result=dol_print_date(16725225600,'%Y-%m-%d %H:%M:%S',false);
149
-       	print __METHOD__." result=".$result."\n";
150
-    	$this->assertEquals('2500-01-01 01:00:00',$result);
151
-
152
-    	// Check %Y-%m-%d %H:%M:%S format
153
-    	$result=dol_print_date(-1830384000,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
154
-    	print __METHOD__." result=".$result."\n";
155
-    	$this->assertEquals('1912-01-01 01:00:00',$result);		// dol_print_date use a timezone, not epoch converter as it did not exists this year
156
-
157
-    	// Specific cas during war
158
-
159
-    	// 1940, no timezone
160
-    	$result=dol_print_date(-946771200,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
161
-    	print __METHOD__." result=".$result."\n";
162
-    	$this->assertEquals('1940-01-01 01:00:00',$result);		//  dol_print_date use a modern timezone, not epoch converter as it did not exists this year
163
-
164
-    	// 1941, timezone is added by germany to +2 (same for 1942)
165
-    	$result=dol_print_date(-915148800,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
166
-    	print __METHOD__." result=".$result."\n";
167
-    	$this->assertEquals('1941-01-01 01:00:00',$result);		// dol_print_date use a modern timezone, epoch converter use historic timezone
168
-
169
-    	// 1943, timezone is +1
170
-    	$result=dol_print_date(-852076800,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
171
-    	print __METHOD__." result=".$result."\n";
172
-    	$this->assertEquals('1943-01-01 01:00:00',$result);
173
-
174
-    	// test with negative timezone
175
-    	$result=dol_print_date(-1,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
176
-    	print __METHOD__." result=".$result."\n";
177
-    	$this->assertEquals('1970-01-01 00:59:59',$result);
178
-
179
-    	// Check dayhour format for fr_FR
180
-    	$outputlangs=new Translate('',$conf);
181
-    	$outputlangs->setDefaultLang('fr_FR');
182
-    	$outputlangs->load("main");
183
-
184
-    	$result=dol_print_date(0+24*3600,'dayhour',false,$outputlangs);
185
-    	print __METHOD__." result=".$result."\n";
186
-    	$this->assertEquals('02/01/1970 01:00',$result);
187
-
188
-    	// Check day format for en_US
189
-    	$outputlangs=new Translate('',$conf);
190
-    	$outputlangs->setDefaultLang('en_US');
191
-    	$outputlangs->load("main");
192
-
193
-    	$result=dol_print_date(0+24*3600,'day',false,$outputlangs);
194
-    	print __METHOD__." result=".$result."\n";
195
-    	$this->assertEquals('01/02/1970',$result);
196
-
197
-    	// Check %a and %b format for en_US
198
-    	$result=dol_print_date(0,'%a %b',false,$outputlangs);
199
-    	print __METHOD__." result=".$result."\n";
200
-    	$this->assertEquals('Thu Jan',$result);
201
-
202
-    	return $result;
149
+            print __METHOD__." result=".$result."\n";
150
+        $this->assertEquals('2500-01-01 01:00:00',$result);
151
+
152
+        // Check %Y-%m-%d %H:%M:%S format
153
+        $result=dol_print_date(-1830384000,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
154
+        print __METHOD__." result=".$result."\n";
155
+        $this->assertEquals('1912-01-01 01:00:00',$result);		// dol_print_date use a timezone, not epoch converter as it did not exists this year
156
+
157
+        // Specific cas during war
158
+
159
+        // 1940, no timezone
160
+        $result=dol_print_date(-946771200,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
161
+        print __METHOD__." result=".$result."\n";
162
+        $this->assertEquals('1940-01-01 01:00:00',$result);		//  dol_print_date use a modern timezone, not epoch converter as it did not exists this year
163
+
164
+        // 1941, timezone is added by germany to +2 (same for 1942)
165
+        $result=dol_print_date(-915148800,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
166
+        print __METHOD__." result=".$result."\n";
167
+        $this->assertEquals('1941-01-01 01:00:00',$result);		// dol_print_date use a modern timezone, epoch converter use historic timezone
168
+
169
+        // 1943, timezone is +1
170
+        $result=dol_print_date(-852076800,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
171
+        print __METHOD__." result=".$result."\n";
172
+        $this->assertEquals('1943-01-01 01:00:00',$result);
173
+
174
+        // test with negative timezone
175
+        $result=dol_print_date(-1,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
176
+        print __METHOD__." result=".$result."\n";
177
+        $this->assertEquals('1970-01-01 00:59:59',$result);
178
+
179
+        // Check dayhour format for fr_FR
180
+        $outputlangs=new Translate('',$conf);
181
+        $outputlangs->setDefaultLang('fr_FR');
182
+        $outputlangs->load("main");
183
+
184
+        $result=dol_print_date(0+24*3600,'dayhour',false,$outputlangs);
185
+        print __METHOD__." result=".$result."\n";
186
+        $this->assertEquals('02/01/1970 01:00',$result);
187
+
188
+        // Check day format for en_US
189
+        $outputlangs=new Translate('',$conf);
190
+        $outputlangs->setDefaultLang('en_US');
191
+        $outputlangs->load("main");
192
+
193
+        $result=dol_print_date(0+24*3600,'day',false,$outputlangs);
194
+        print __METHOD__." result=".$result."\n";
195
+        $this->assertEquals('01/02/1970',$result);
196
+
197
+        // Check %a and %b format for en_US
198
+        $result=dol_print_date(0,'%a %b',false,$outputlangs);
199
+        print __METHOD__." result=".$result."\n";
200
+        $this->assertEquals('Thu Jan',$result);
201
+
202
+        return $result;
203 203
     }
204 204
 }
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 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,13 +77,13 @@  discard block
 block discarded – undo
77 77
 	// Static methods
78 78
   	public static function setUpBeforeClass()
79 79
     {
80
-    	global $conf,$user,$langs,$db;
80
+    	global $conf, $user, $langs, $db;
81 81
 
82 82
     	if (getServerTimeZoneString() != 'Europe/Paris') {
83 83
     		print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ+1 Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die();
84 84
     	}
85 85
 
86
-    	$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
86
+    	$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
87 87
 
88 88
     	print __METHOD__."\n";
89 89
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     // tear down after class
92 92
     public static function tearDownAfterClass()
93 93
     {
94
-    	global $conf,$user,$langs,$db;
94
+    	global $conf, $user, $langs, $db;
95 95
 		$db->rollback();
96 96
 
97 97
 		print __METHOD__."\n";
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
     protected function setUp()
106 106
     {
107
-    	global $conf,$user,$langs,$db;
108
-		$conf=$this->savconf;
109
-		$user=$this->savuser;
110
-		$langs=$this->savlangs;
111
-		$db=$this->savdb;
107
+    	global $conf, $user, $langs, $db;
108
+		$conf = $this->savconf;
109
+		$user = $this->savuser;
110
+		$langs = $this->savlangs;
111
+		$db = $this->savdb;
112 112
 
113 113
 		print __METHOD__."\n";
114 114
     }
@@ -133,71 +133,71 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function testDolPrintDateTzFrance()
135 135
     {
136
-        global $conf,$user,$langs,$db;
137
-        $conf=$this->savconf;
138
-        $user=$this->savuser;
139
-        $langs=$this->savlangs;
140
-        $db=$this->savdb;
136
+        global $conf, $user, $langs, $db;
137
+        $conf = $this->savconf;
138
+        $user = $this->savuser;
139
+        $langs = $this->savlangs;
140
+        $db = $this->savdb;
141 141
 
142 142
     	// Check %Y-%m-%d %H:%M:%S format
143
-        $result=dol_print_date(0,'%Y-%m-%d %H:%M:%S',false);
143
+        $result = dol_print_date(0, '%Y-%m-%d %H:%M:%S', false);
144 144
        	print __METHOD__." result=".$result."\n";
145
-    	$this->assertEquals('1970-01-01 01:00:00',$result);
145
+    	$this->assertEquals('1970-01-01 01:00:00', $result);
146 146
 
147 147
     	// Check %Y-%m-%d %H:%M:%S format
148
-        $result=dol_print_date(16725225600,'%Y-%m-%d %H:%M:%S',false);
148
+        $result = dol_print_date(16725225600, '%Y-%m-%d %H:%M:%S', false);
149 149
        	print __METHOD__." result=".$result."\n";
150
-    	$this->assertEquals('2500-01-01 01:00:00',$result);
150
+    	$this->assertEquals('2500-01-01 01:00:00', $result);
151 151
 
152 152
     	// Check %Y-%m-%d %H:%M:%S format
153
-    	$result=dol_print_date(-1830384000,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
153
+    	$result = dol_print_date(-1830384000, '%Y-%m-%d %H:%M:%S', false); // http://www.epochconverter.com/
154 154
     	print __METHOD__." result=".$result."\n";
155
-    	$this->assertEquals('1912-01-01 01:00:00',$result);		// dol_print_date use a timezone, not epoch converter as it did not exists this year
155
+    	$this->assertEquals('1912-01-01 01:00:00', $result); // dol_print_date use a timezone, not epoch converter as it did not exists this year
156 156
 
157 157
     	// Specific cas during war
158 158
 
159 159
     	// 1940, no timezone
160
-    	$result=dol_print_date(-946771200,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
160
+    	$result = dol_print_date(-946771200, '%Y-%m-%d %H:%M:%S', false); // http://www.epochconverter.com/
161 161
     	print __METHOD__." result=".$result."\n";
162
-    	$this->assertEquals('1940-01-01 01:00:00',$result);		//  dol_print_date use a modern timezone, not epoch converter as it did not exists this year
162
+    	$this->assertEquals('1940-01-01 01:00:00', $result); //  dol_print_date use a modern timezone, not epoch converter as it did not exists this year
163 163
 
164 164
     	// 1941, timezone is added by germany to +2 (same for 1942)
165
-    	$result=dol_print_date(-915148800,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
165
+    	$result = dol_print_date(-915148800, '%Y-%m-%d %H:%M:%S', false); // http://www.epochconverter.com/
166 166
     	print __METHOD__." result=".$result."\n";
167
-    	$this->assertEquals('1941-01-01 01:00:00',$result);		// dol_print_date use a modern timezone, epoch converter use historic timezone
167
+    	$this->assertEquals('1941-01-01 01:00:00', $result); // dol_print_date use a modern timezone, epoch converter use historic timezone
168 168
 
169 169
     	// 1943, timezone is +1
170
-    	$result=dol_print_date(-852076800,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
170
+    	$result = dol_print_date(-852076800, '%Y-%m-%d %H:%M:%S', false); // http://www.epochconverter.com/
171 171
     	print __METHOD__." result=".$result."\n";
172
-    	$this->assertEquals('1943-01-01 01:00:00',$result);
172
+    	$this->assertEquals('1943-01-01 01:00:00', $result);
173 173
 
174 174
     	// test with negative timezone
175
-    	$result=dol_print_date(-1,'%Y-%m-%d %H:%M:%S',false);	// http://www.epochconverter.com/
175
+    	$result = dol_print_date(-1, '%Y-%m-%d %H:%M:%S', false); // http://www.epochconverter.com/
176 176
     	print __METHOD__." result=".$result."\n";
177
-    	$this->assertEquals('1970-01-01 00:59:59',$result);
177
+    	$this->assertEquals('1970-01-01 00:59:59', $result);
178 178
 
179 179
     	// Check dayhour format for fr_FR
180
-    	$outputlangs=new Translate('',$conf);
180
+    	$outputlangs = new Translate('', $conf);
181 181
     	$outputlangs->setDefaultLang('fr_FR');
182 182
     	$outputlangs->load("main");
183 183
 
184
-    	$result=dol_print_date(0+24*3600,'dayhour',false,$outputlangs);
184
+    	$result = dol_print_date(0 + 24 * 3600, 'dayhour', false, $outputlangs);
185 185
     	print __METHOD__." result=".$result."\n";
186
-    	$this->assertEquals('02/01/1970 01:00',$result);
186
+    	$this->assertEquals('02/01/1970 01:00', $result);
187 187
 
188 188
     	// Check day format for en_US
189
-    	$outputlangs=new Translate('',$conf);
189
+    	$outputlangs = new Translate('', $conf);
190 190
     	$outputlangs->setDefaultLang('en_US');
191 191
     	$outputlangs->load("main");
192 192
 
193
-    	$result=dol_print_date(0+24*3600,'day',false,$outputlangs);
193
+    	$result = dol_print_date(0 + 24 * 3600, 'day', false, $outputlangs);
194 194
     	print __METHOD__." result=".$result."\n";
195
-    	$this->assertEquals('01/02/1970',$result);
195
+    	$this->assertEquals('01/02/1970', $result);
196 196
 
197 197
     	// Check %a and %b format for en_US
198
-    	$result=dol_print_date(0,'%a %b',false,$outputlangs);
198
+    	$result = dol_print_date(0, '%a %b', false, $outputlangs);
199 199
     	print __METHOD__." result=".$result."\n";
200
-    	$this->assertEquals('Thu Jan',$result);
200
+    	$this->assertEquals('Thu Jan', $result);
201 201
 
202 202
     	return $result;
203 203
     }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/DateLibTest.php 2 patches
Indentation   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
 if (empty($user->id))
33 33
 {
34
-	print "Load permissions for admin user nb 1\n";
35
-	$user->fetch(1);
36
-	$user->getrights();
34
+    print "Load permissions for admin user nb 1\n";
35
+    $user->fetch(1);
36
+    $user->getrights();
37 37
 }
38 38
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
39 39
 
@@ -47,74 +47,74 @@  discard block
 block discarded – undo
47 47
  */
48 48
 class DateLibTest extends PHPUnit_Framework_TestCase
49 49
 {
50
-	protected $savconf;
51
-	protected $savuser;
52
-	protected $savlangs;
53
-	protected $savdb;
54
-
55
-	/**
56
-	 * Constructor
57
-	 * We save global variables into local variables
58
-	 *
59
-	 * @return DateLibTest
60
-	 */
61
-	function __construct()
62
-	{
63
-		parent::__construct();
64
-
65
-		//$this->sharedFixture
66
-		global $conf,$user,$langs,$db;
67
-		$this->savconf=$conf;
68
-		$this->savuser=$user;
69
-		$this->savlangs=$langs;
70
-		$this->savdb=$db;
71
-
72
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
-		//print " - db ".$db->db;
74
-		print "\n";
75
-	}
76
-
77
-	// Static methods
78
-  	public static function setUpBeforeClass()
50
+    protected $savconf;
51
+    protected $savuser;
52
+    protected $savlangs;
53
+    protected $savdb;
54
+
55
+    /**
56
+     * Constructor
57
+     * We save global variables into local variables
58
+     *
59
+     * @return DateLibTest
60
+     */
61
+    function __construct()
79 62
     {
80
-    	global $conf,$user,$langs,$db;
81
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
63
+        parent::__construct();
82 64
 
83
-    	print __METHOD__."\n";
65
+        //$this->sharedFixture
66
+        global $conf,$user,$langs,$db;
67
+        $this->savconf=$conf;
68
+        $this->savuser=$user;
69
+        $this->savlangs=$langs;
70
+        $this->savdb=$db;
71
+
72
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
+        //print " - db ".$db->db;
74
+        print "\n";
75
+    }
76
+
77
+    // Static methods
78
+        public static function setUpBeforeClass()
79
+    {
80
+        global $conf,$user,$langs,$db;
81
+        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
82
+
83
+        print __METHOD__."\n";
84 84
     }
85 85
 
86 86
     // tear down after class
87 87
     public static function tearDownAfterClass()
88 88
     {
89
-    	global $conf,$user,$langs,$db;
90
-		$db->rollback();
89
+        global $conf,$user,$langs,$db;
90
+        $db->rollback();
91 91
 
92
-		print __METHOD__."\n";
92
+        print __METHOD__."\n";
93 93
     }
94 94
 
95
-	/**
96
-	 * Init phpunit tests
97
-	 *
98
-	 * @return	void
99
-	 */
95
+    /**
96
+     * Init phpunit tests
97
+     *
98
+     * @return	void
99
+     */
100 100
     protected function setUp()
101 101
     {
102
-    	global $conf,$user,$langs,$db;
103
-		$conf=$this->savconf;
104
-		$user=$this->savuser;
105
-		$langs=$this->savlangs;
106
-		$db=$this->savdb;
102
+        global $conf,$user,$langs,$db;
103
+        $conf=$this->savconf;
104
+        $user=$this->savuser;
105
+        $langs=$this->savlangs;
106
+        $db=$this->savdb;
107 107
 
108
-		print __METHOD__."\n";
108
+        print __METHOD__."\n";
109 109
     }
110
-	/**
111
-	 * End phpunit tests
112
-	 *
113
-	 * @return	void
114
-	 */
110
+    /**
111
+     * End phpunit tests
112
+     *
113
+     * @return	void
114
+     */
115 115
     protected function tearDown()
116 116
     {
117
-    	print __METHOD__."\n";
117
+        print __METHOD__."\n";
118 118
     }
119 119
 
120 120
     /**
@@ -124,49 +124,49 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function testNumBetweenDay()
126 126
     {
127
-    	global $conf,$user,$langs,$db;
128
-		$conf=$this->savconf;
129
-		$user=$this->savuser;
130
-		$langs=$this->savlangs;
131
-		$db=$this->savdb;
127
+        global $conf,$user,$langs,$db;
128
+        $conf=$this->savconf;
129
+        $user=$this->savuser;
130
+        $langs=$this->savlangs;
131
+        $db=$this->savdb;
132 132
 
133
-		// With same hours
134
-		$date1=dol_mktime(0, 0, 0, 1, 1, 2012);
135
-		$date2=dol_mktime(0, 0, 0, 1, 2, 2012);
133
+        // With same hours
134
+        $date1=dol_mktime(0, 0, 0, 1, 1, 2012);
135
+        $date2=dol_mktime(0, 0, 0, 1, 2, 2012);
136 136
 
137
-		$result=num_between_day($date1,$date2,1);
138
-    	print __METHOD__." result=".$result."\n";
139
-		$this->assertEquals(2,$result);
137
+        $result=num_between_day($date1,$date2,1);
138
+        print __METHOD__." result=".$result."\n";
139
+        $this->assertEquals(2,$result);
140 140
 
141
-		$result=num_between_day($date1,$date2,0);
142
-    	print __METHOD__." result=".$result."\n";
143
-		$this->assertEquals(1,$result);
141
+        $result=num_between_day($date1,$date2,0);
142
+        print __METHOD__." result=".$result."\n";
143
+        $this->assertEquals(1,$result);
144 144
 
145
-		// With different hours
146
-		$date1=dol_mktime(0, 0, 0, 1, 1, 2012);
147
-		$date2=dol_mktime(12, 0, 0, 1, 2, 2012);
145
+        // With different hours
146
+        $date1=dol_mktime(0, 0, 0, 1, 1, 2012);
147
+        $date2=dol_mktime(12, 0, 0, 1, 2, 2012);
148 148
 
149
-		$result=num_between_day($date1,$date2,1);
150
-    	print __METHOD__." result=".$result."\n";
151
-		$this->assertEquals(2,$result);
149
+        $result=num_between_day($date1,$date2,1);
150
+        print __METHOD__." result=".$result."\n";
151
+        $this->assertEquals(2,$result);
152 152
 
153
-		$result=num_between_day($date1,$date2,0);
154
-    	print __METHOD__." result=".$result."\n";
155
-		$this->assertEquals(1,$result);
153
+        $result=num_between_day($date1,$date2,0);
154
+        print __METHOD__." result=".$result."\n";
155
+        $this->assertEquals(1,$result);
156 156
 
157
-		// With different date before and after sunlight hour (day to change sunlight hour is 2014-03-30)
158
-		$date1=dol_mktime(0, 0, 0, 3, 28, 2014, true);
159
-		$date2=dol_mktime(0, 0, 0, 3, 31, 2014, true);
157
+        // With different date before and after sunlight hour (day to change sunlight hour is 2014-03-30)
158
+        $date1=dol_mktime(0, 0, 0, 3, 28, 2014, true);
159
+        $date2=dol_mktime(0, 0, 0, 3, 31, 2014, true);
160 160
 
161
-		$result=num_between_day($date1,$date2,1);
162
-    	print __METHOD__." result=".$result."\n";
163
-		$this->assertEquals(4,$result);
161
+        $result=num_between_day($date1,$date2,1);
162
+        print __METHOD__." result=".$result."\n";
163
+        $this->assertEquals(4,$result);
164 164
 
165
-		$result=num_between_day($date1,$date2,0);
166
-    	print __METHOD__." result=".$result."\n";
167
-		$this->assertEquals(3,$result);
165
+        $result=num_between_day($date1,$date2,0);
166
+        print __METHOD__." result=".$result."\n";
167
+        $this->assertEquals(3,$result);
168 168
 
169
-		return $result;
169
+        return $result;
170 170
     }
171 171
 
172 172
     /**
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
      */
273 273
     public function testConvertTime2Seconds()
274 274
     {
275
-    	global $conf,$user,$langs,$db;
276
-		$conf=$this->savconf;
277
-		$user=$this->savuser;
278
-		$langs=$this->savlangs;
279
-		$db=$this->savdb;
275
+        global $conf,$user,$langs,$db;
276
+        $conf=$this->savconf;
277
+        $user=$this->savuser;
278
+        $langs=$this->savlangs;
279
+        $db=$this->savdb;
280 280
 
281
-		$result=convertTime2Seconds(1,1,2);
282
-    	print __METHOD__." result=".$result."\n";
283
-		$this->assertEquals(3662,$result);
281
+        $result=convertTime2Seconds(1,1,2);
282
+        print __METHOD__." result=".$result."\n";
283
+        $this->assertEquals(3662,$result);
284 284
 
285
-		return $result;
285
+        return $result;
286 286
     }
287 287
 
288 288
     /**
@@ -292,22 +292,22 @@  discard block
 block discarded – undo
292 292
      */
293 293
     public function testConvertSecondToTime()
294 294
     {
295
-    	global $conf,$user,$langs,$db;
296
-		$conf=$this->savconf;
297
-		$user=$this->savuser;
298
-		$langs=$this->savlangs;
299
-		$db=$this->savdb;
295
+        global $conf,$user,$langs,$db;
296
+        $conf=$this->savconf;
297
+        $user=$this->savuser;
298
+        $langs=$this->savlangs;
299
+        $db=$this->savdb;
300 300
 
301
-		$result=convertSecondToTime(0,'all',86400);
302
-    	print __METHOD__." result=".$result."\n";
303
-		$this->assertEquals('0',$result);
301
+        $result=convertSecondToTime(0,'all',86400);
302
+        print __METHOD__." result=".$result."\n";
303
+        $this->assertEquals('0',$result);
304 304
 
305
-		$result=convertSecondToTime(86400,'all',86400);
306
-    	print __METHOD__." result=".$result."\n";
307
-		$this->assertSame('1 '.$langs->trans("Day"),$result);
305
+        $result=convertSecondToTime(86400,'all',86400);
306
+        print __METHOD__." result=".$result."\n";
307
+        $this->assertSame('1 '.$langs->trans("Day"),$result);
308 308
 
309 309
 
310
-		return $result;
310
+        return $result;
311 311
     }
312 312
 
313 313
     /**
@@ -323,60 +323,60 @@  discard block
 block discarded – undo
323 323
         $langs=$this->savlangs;
324 324
         $db=$this->savdb;
325 325
 
326
-    	// Check %Y-%m-%d %H:%M:%S format
326
+        // Check %Y-%m-%d %H:%M:%S format
327 327
         $result=dol_print_date(0,'%Y-%m-%d %H:%M:%S',true);
328
-       	print __METHOD__." result=".$result."\n";
329
-    	$this->assertEquals('1970-01-01 00:00:00',$result);
330
-
331
-    	// Check %Y-%m-%d %H:%M:%S format
332
-    	$result=dol_print_date(16725225600,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
333
-    	print __METHOD__." result=".$result."\n";
334
-    	$this->assertEquals('2500-01-01 00:00:00',$result);
335
-
336
-    	// Check %Y-%m-%d %H:%M:%S format
337
-    	$result=dol_print_date(-1830384000,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
338
-    	print __METHOD__." result=".$result."\n";
339
-    	$this->assertEquals('1912-01-01 00:00:00',$result);	// dol_print_date use TZ (good) but epoch converter does not use it.
340
-
341
-    	// Check %Y-%m-%d %H:%M:%S format
342
-    	$result=dol_print_date(-11676096000,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
343
-    	print __METHOD__." result=".$result."\n";
344
-    	$this->assertEquals('1600-01-01 00:00:00',$result);
345
-
346
-    	// test with negative timezone
347
-    	$result=dol_print_date(-1,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
348
-    	print __METHOD__." result=".$result."\n";
349
-    	$this->assertEquals('1969-12-31 23:59:59',$result);
350
-
351
-    	// Check dayhour format for fr_FR
352
-    	$outputlangs=new Translate('',$conf);
353
-    	$outputlangs->setDefaultLang('fr_FR');
354
-    	$outputlangs->load("main");
355
-
356
-    	$result=dol_print_date(0+24*3600,'dayhour',true,$outputlangs);
357
-    	print __METHOD__." result=".$result."\n";
358
-    	$this->assertEquals('02/01/1970 00:00',$result);
359
-
360
-    	// Check %a and %b format for fr_FR
361
-    	$result=dol_print_date(0,'%a %b %B',true,$outputlangs);
362
-    	print __METHOD__." result=".$result."\n";
363
-    	$this->assertEquals('Jeu Jan. Janvier',$result);
364
-
365
-    	// Check day format for en_US
366
-    	$outputlangs=new Translate('',$conf);
367
-    	$outputlangs->setDefaultLang('en_US');
368
-    	$outputlangs->load("main");
369
-
370
-    	$result=dol_print_date(0+24*3600,'day',true,$outputlangs);
371
-    	print __METHOD__." result=".$result."\n";
372
-    	$this->assertEquals('01/02/1970',$result);
373
-
374
-    	// Check %a and %b format for en_US
375
-    	$result=dol_print_date(0,'%a %b %B',true,$outputlangs);
376
-    	print __METHOD__." result=".$result."\n";
377
-    	$this->assertEquals('Thu Jan January',$result);
378
-
379
-    	return $result;
328
+            print __METHOD__." result=".$result."\n";
329
+        $this->assertEquals('1970-01-01 00:00:00',$result);
330
+
331
+        // Check %Y-%m-%d %H:%M:%S format
332
+        $result=dol_print_date(16725225600,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
333
+        print __METHOD__." result=".$result."\n";
334
+        $this->assertEquals('2500-01-01 00:00:00',$result);
335
+
336
+        // Check %Y-%m-%d %H:%M:%S format
337
+        $result=dol_print_date(-1830384000,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
338
+        print __METHOD__." result=".$result."\n";
339
+        $this->assertEquals('1912-01-01 00:00:00',$result);	// dol_print_date use TZ (good) but epoch converter does not use it.
340
+
341
+        // Check %Y-%m-%d %H:%M:%S format
342
+        $result=dol_print_date(-11676096000,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
343
+        print __METHOD__." result=".$result."\n";
344
+        $this->assertEquals('1600-01-01 00:00:00',$result);
345
+
346
+        // test with negative timezone
347
+        $result=dol_print_date(-1,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
348
+        print __METHOD__." result=".$result."\n";
349
+        $this->assertEquals('1969-12-31 23:59:59',$result);
350
+
351
+        // Check dayhour format for fr_FR
352
+        $outputlangs=new Translate('',$conf);
353
+        $outputlangs->setDefaultLang('fr_FR');
354
+        $outputlangs->load("main");
355
+
356
+        $result=dol_print_date(0+24*3600,'dayhour',true,$outputlangs);
357
+        print __METHOD__." result=".$result."\n";
358
+        $this->assertEquals('02/01/1970 00:00',$result);
359
+
360
+        // Check %a and %b format for fr_FR
361
+        $result=dol_print_date(0,'%a %b %B',true,$outputlangs);
362
+        print __METHOD__." result=".$result."\n";
363
+        $this->assertEquals('Jeu Jan. Janvier',$result);
364
+
365
+        // Check day format for en_US
366
+        $outputlangs=new Translate('',$conf);
367
+        $outputlangs->setDefaultLang('en_US');
368
+        $outputlangs->load("main");
369
+
370
+        $result=dol_print_date(0+24*3600,'day',true,$outputlangs);
371
+        print __METHOD__." result=".$result."\n";
372
+        $this->assertEquals('01/02/1970',$result);
373
+
374
+        // Check %a and %b format for en_US
375
+        $result=dol_print_date(0,'%a %b %B',true,$outputlangs);
376
+        print __METHOD__." result=".$result."\n";
377
+        $this->assertEquals('Thu Jan January',$result);
378
+
379
+        return $result;
380 380
     }
381 381
 
382 382
     /**
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
         $outputlangs->load("main");
399 399
 
400 400
         $result=dol_print_date(dol_time_plus_duree(dol_time_plus_duree(dol_time_plus_duree(0,1,'m'),1,'y'),1,'d'),'dayhour',true,$outputlangs);
401
-       	print __METHOD__." result=".$result."\n";
402
-    	$this->assertEquals('02/02/1971 00:00',$result);
401
+            print __METHOD__." result=".$result."\n";
402
+        $this->assertEquals('02/02/1971 00:00',$result);
403 403
 
404
-    	return $result;
404
+        return $result;
405 405
     }
406 406
 
407 407
     /**
@@ -417,30 +417,30 @@  discard block
 block discarded – undo
417 417
         $langs=$this->savlangs;
418 418
         $db=$this->savdb;
419 419
 
420
-		$stime='19700102';
421
-		$result=dol_stringtotime($stime);
422
-		print __METHOD__." result=".$result."\n";
423
-		$this->assertEquals(86400,$result);
420
+        $stime='19700102';
421
+        $result=dol_stringtotime($stime);
422
+        print __METHOD__." result=".$result."\n";
423
+        $this->assertEquals(86400,$result);
424 424
 
425
-		$stime='1970-01-01T02:00:00Z';
425
+        $stime='1970-01-01T02:00:00Z';
426 426
         $result=dol_stringtotime($stime);
427
-    	print __METHOD__." result=".$result."\n";
428
-		$this->assertEquals(7200,$result);
427
+        print __METHOD__." result=".$result."\n";
428
+        $this->assertEquals(7200,$result);
429 429
 
430 430
         $stime='1970-01-01 02:00:00';
431 431
         $result=dol_stringtotime($stime);
432
-    	print __METHOD__." result=".$result."\n";
433
-		$this->assertEquals(7200,$result);
432
+        print __METHOD__." result=".$result."\n";
433
+        $this->assertEquals(7200,$result);
434 434
 
435 435
         $stime='19700101T020000Z';
436 436
         $result=dol_stringtotime($stime);
437
-    	print __METHOD__." result=".$result."\n";
438
-		$this->assertEquals(7200,$result);
437
+        print __METHOD__." result=".$result."\n";
438
+        $this->assertEquals(7200,$result);
439 439
 
440
-		$stime='19700101020000';
441
-		$result=dol_stringtotime($stime);
442
-		print __METHOD__." result=".$result."\n";
443
-		$this->assertEquals(7200,$result);
440
+        $stime='19700101020000';
441
+        $result=dol_stringtotime($stime);
442
+        print __METHOD__." result=".$result."\n";
443
+        $this->assertEquals(7200,$result);
444 444
 
445 445
         return $result;
446 446
     }
@@ -452,16 +452,16 @@  discard block
 block discarded – undo
452 452
      */
453 453
     public function testDolGetFirstDayWeek()
454 454
     {
455
-    	global $conf;
455
+        global $conf;
456 456
 
457
-    	$day=3; $month=2; $year=2015;
458
-    	$conf->global->MAIN_START_WEEK = 1;	// start on monday
459
-   		$prev = dol_get_first_day_week($day, $month, $year);
460
-		$this->assertEquals(2, (int) $prev['first_day']);		// monday for month 2, year 2014 is the 2
457
+        $day=3; $month=2; $year=2015;
458
+        $conf->global->MAIN_START_WEEK = 1;	// start on monday
459
+            $prev = dol_get_first_day_week($day, $month, $year);
460
+        $this->assertEquals(2, (int) $prev['first_day']);		// monday for month 2, year 2014 is the 2
461 461
 
462
-    	$day=3; $month=2; $year=2015;
463
-    	$conf->global->MAIN_START_WEEK = 0;	// start on sunday
464
-   		$prev = dol_get_first_day_week($day, $month, $year);
465
-		$this->assertEquals(1, (int) $prev['first_day']);		// sunday for month 2, year 2015 is the 1st
462
+        $day=3; $month=2; $year=2015;
463
+        $conf->global->MAIN_START_WEEK = 0;	// start on sunday
464
+            $prev = dol_get_first_day_week($day, $month, $year);
465
+        $this->assertEquals(1, (int) $prev['first_day']);		// sunday for month 2, year 2015 is the 1st
466 466
     }
467 467
 }
Please login to merge, or discard this patch.
Spacing   +161 added lines, -161 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,47 +124,47 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function testNumBetweenDay()
126 126
     {
127
-    	global $conf,$user,$langs,$db;
128
-		$conf=$this->savconf;
129
-		$user=$this->savuser;
130
-		$langs=$this->savlangs;
131
-		$db=$this->savdb;
127
+    	global $conf, $user, $langs, $db;
128
+		$conf = $this->savconf;
129
+		$user = $this->savuser;
130
+		$langs = $this->savlangs;
131
+		$db = $this->savdb;
132 132
 
133 133
 		// With same hours
134
-		$date1=dol_mktime(0, 0, 0, 1, 1, 2012);
135
-		$date2=dol_mktime(0, 0, 0, 1, 2, 2012);
134
+		$date1 = dol_mktime(0, 0, 0, 1, 1, 2012);
135
+		$date2 = dol_mktime(0, 0, 0, 1, 2, 2012);
136 136
 
137
-		$result=num_between_day($date1,$date2,1);
137
+		$result = num_between_day($date1, $date2, 1);
138 138
     	print __METHOD__." result=".$result."\n";
139
-		$this->assertEquals(2,$result);
139
+		$this->assertEquals(2, $result);
140 140
 
141
-		$result=num_between_day($date1,$date2,0);
141
+		$result = num_between_day($date1, $date2, 0);
142 142
     	print __METHOD__." result=".$result."\n";
143
-		$this->assertEquals(1,$result);
143
+		$this->assertEquals(1, $result);
144 144
 
145 145
 		// With different hours
146
-		$date1=dol_mktime(0, 0, 0, 1, 1, 2012);
147
-		$date2=dol_mktime(12, 0, 0, 1, 2, 2012);
146
+		$date1 = dol_mktime(0, 0, 0, 1, 1, 2012);
147
+		$date2 = dol_mktime(12, 0, 0, 1, 2, 2012);
148 148
 
149
-		$result=num_between_day($date1,$date2,1);
149
+		$result = num_between_day($date1, $date2, 1);
150 150
     	print __METHOD__." result=".$result."\n";
151
-		$this->assertEquals(2,$result);
151
+		$this->assertEquals(2, $result);
152 152
 
153
-		$result=num_between_day($date1,$date2,0);
153
+		$result = num_between_day($date1, $date2, 0);
154 154
     	print __METHOD__." result=".$result."\n";
155
-		$this->assertEquals(1,$result);
155
+		$this->assertEquals(1, $result);
156 156
 
157 157
 		// With different date before and after sunlight hour (day to change sunlight hour is 2014-03-30)
158
-		$date1=dol_mktime(0, 0, 0, 3, 28, 2014, true);
159
-		$date2=dol_mktime(0, 0, 0, 3, 31, 2014, true);
158
+		$date1 = dol_mktime(0, 0, 0, 3, 28, 2014, true);
159
+		$date2 = dol_mktime(0, 0, 0, 3, 31, 2014, true);
160 160
 
161
-		$result=num_between_day($date1,$date2,1);
161
+		$result = num_between_day($date1, $date2, 1);
162 162
     	print __METHOD__." result=".$result."\n";
163
-		$this->assertEquals(4,$result);
163
+		$this->assertEquals(4, $result);
164 164
 
165
-		$result=num_between_day($date1,$date2,0);
165
+		$result = num_between_day($date1, $date2, 0);
166 166
     	print __METHOD__." result=".$result."\n";
167
-		$this->assertEquals(3,$result);
167
+		$this->assertEquals(3, $result);
168 168
 
169 169
 		return $result;
170 170
     }
@@ -176,55 +176,55 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function testNumPublicHoliday()
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
         // With same hours - Tuesday/Wednesday jan 2013
186
-        $date1=dol_mktime(0, 0, 0, 1, 1, 2013);
187
-        $date2=dol_mktime(0, 0, 0, 1, 2, 2013);
186
+        $date1 = dol_mktime(0, 0, 0, 1, 1, 2013);
187
+        $date2 = dol_mktime(0, 0, 0, 1, 2, 2013);
188 188
 
189
-        $result=num_public_holiday($date1,$date2,'FR',1);
189
+        $result = num_public_holiday($date1, $date2, 'FR', 1);
190 190
         print __METHOD__." result=".$result."\n";
191
-        $this->assertEquals(1,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for FR');   // 1 closed days
191
+        $this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday/Wednesday jan 2013 for FR'); // 1 closed days
192 192
 
193
-        $result=num_public_holiday($date1,$date2,'XX',1);
193
+        $result = num_public_holiday($date1, $date2, 'XX', 1);
194 194
         print __METHOD__." result=".$result."\n";
195
-        $this->assertEquals(0,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for XX');   // no closed days (country unknown)
195
+        $this->assertEquals(0, $result, 'NumPublicHoliday for Tuesday/Wednesday jan 2013 for XX'); // no closed days (country unknown)
196 196
 
197 197
         // With same hours - Friday/Sunday jan 2013
198
-        $date1=dol_mktime(0, 0, 0, 1, 4, 2013);
199
-        $date2=dol_mktime(0, 0, 0, 1, 6, 2013);
198
+        $date1 = dol_mktime(0, 0, 0, 1, 4, 2013);
199
+        $date2 = dol_mktime(0, 0, 0, 1, 6, 2013);
200 200
 
201
-        $result=num_public_holiday($date1,$date2,'FR',1);
201
+        $result = num_public_holiday($date1, $date2, 'FR', 1);
202 202
         print __METHOD__." result=".$result."\n";
203
-        $this->assertEquals(2,$result,'NumPublicHoliday for FR');   // 1 opened day, 2 closed days
203
+        $this->assertEquals(2, $result, 'NumPublicHoliday for FR'); // 1 opened day, 2 closed days
204 204
 
205
-        $result=num_public_holiday($date1,$date2,'XX',1);
205
+        $result = num_public_holiday($date1, $date2, 'XX', 1);
206 206
         print __METHOD__." result=".$result."\n";
207
-        $this->assertEquals(2,$result,'NumPublicHoliday for XX');   // 1 opened day, 2 closed days (even if country unknown)
207
+        $this->assertEquals(2, $result, 'NumPublicHoliday for XX'); // 1 opened day, 2 closed days (even if country unknown)
208 208
 
209
-        $conf->global->HOLIDAY_MORE_PUBLIC_HOLIDAYS='12-13,2019-12-14';
209
+        $conf->global->HOLIDAY_MORE_PUBLIC_HOLIDAYS = '12-13,2019-12-14';
210 210
 
211
-        $date1=dol_mktime(0, 0, 0, 12, 13, 2018);
212
-        $date2=dol_mktime(0, 0, 0, 12, 13, 2018);
213
-        $result=num_public_holiday($date1,$date2,'YY',1);
211
+        $date1 = dol_mktime(0, 0, 0, 12, 13, 2018);
212
+        $date2 = dol_mktime(0, 0, 0, 12, 13, 2018);
213
+        $result = num_public_holiday($date1, $date2, 'YY', 1);
214 214
         print __METHOD__." result=".$result."\n";
215
-        $this->assertEquals(1,$result,'NumPublicHoliday for YY the 2018-12-13');   // 0 opened day, 1 closed days (even if country unknown)
215
+        $this->assertEquals(1, $result, 'NumPublicHoliday for YY the 2018-12-13'); // 0 opened day, 1 closed days (even if country unknown)
216 216
 
217
-        $date1=dol_mktime(0, 0, 0, 12, 14, 2018);
218
-        $date2=dol_mktime(0, 0, 0, 12, 14, 2018);
219
-        $result=num_public_holiday($date1,$date2,'YY',1);
217
+        $date1 = dol_mktime(0, 0, 0, 12, 14, 2018);
218
+        $date2 = dol_mktime(0, 0, 0, 12, 14, 2018);
219
+        $result = num_public_holiday($date1, $date2, 'YY', 1);
220 220
         print __METHOD__." result=".$result."\n";
221
-        $this->assertEquals(0,$result,'NumPublicHoliday for YY the 2018-12-14');   // 1 opened day, 0 closed days (even if country unknown)
221
+        $this->assertEquals(0, $result, 'NumPublicHoliday for YY the 2018-12-14'); // 1 opened day, 0 closed days (even if country unknown)
222 222
 
223
-        $date1=dol_mktime(0, 0, 0, 12, 14, 2019);
224
-        $date2=dol_mktime(0, 0, 0, 12, 14, 2019);
225
-        $result=num_public_holiday($date1,$date2,'YY',1);
223
+        $date1 = dol_mktime(0, 0, 0, 12, 14, 2019);
224
+        $date2 = dol_mktime(0, 0, 0, 12, 14, 2019);
225
+        $result = num_public_holiday($date1, $date2, 'YY', 1);
226 226
         print __METHOD__." result=".$result."\n";
227
-        $this->assertEquals(1,$result,'NumPublicHoliday for YY the 2019-12-14');   // 0 opened day, 1 closed days (even if country unknown)
227
+        $this->assertEquals(1, $result, 'NumPublicHoliday for YY the 2019-12-14'); // 0 opened day, 1 closed days (even if country unknown)
228 228
     }
229 229
 
230 230
     /**
@@ -234,35 +234,35 @@  discard block
 block discarded – undo
234 234
      */
235 235
     public function testNumOpenDay()
236 236
     {
237
-        global $conf,$user,$langs,$db;
238
-        $conf=$this->savconf;
239
-        $user=$this->savuser;
240
-        $langs=$this->savlangs;
241
-        $db=$this->savdb;
237
+        global $conf, $user, $langs, $db;
238
+        $conf = $this->savconf;
239
+        $user = $this->savuser;
240
+        $langs = $this->savlangs;
241
+        $db = $this->savdb;
242 242
 
243 243
         // With same hours - Tuesday/Wednesday jan 2013
244
-        $date1=dol_mktime(0, 0, 0, 1, 1, 2013);
245
-        $date2=dol_mktime(0, 0, 0, 1, 2, 2013);
244
+        $date1 = dol_mktime(0, 0, 0, 1, 1, 2013);
245
+        $date2 = dol_mktime(0, 0, 0, 1, 2, 2013);
246 246
 
247
-        $result=num_open_day($date1,$date2,0,1,0,'FR');
247
+        $result = num_open_day($date1, $date2, 0, 1, 0, 'FR');
248 248
         print __METHOD__." result=".$result."\n";
249
-        $this->assertEquals(1,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for FR');   // 1 opened days
249
+        $this->assertEquals(1, $result, 'NumOpenDay Tuesday/Wednesday jan 2013 for FR'); // 1 opened days
250 250
 
251
-        $result=num_open_day($date1,$date2,0,1,0,'XX');
251
+        $result = num_open_day($date1, $date2, 0, 1, 0, 'XX');
252 252
         print __METHOD__." result=".$result."\n";
253
-        $this->assertEquals(2,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for XX');   // 2 opened days (country unknown)
253
+        $this->assertEquals(2, $result, 'NumOpenDay Tuesday/Wednesday jan 2013 for XX'); // 2 opened days (country unknown)
254 254
 
255 255
         // With same hours - Friday/Sunday jan 2013
256
-        $date1=dol_mktime(0, 0, 0, 1, 4, 2013);
257
-        $date2=dol_mktime(0, 0, 0, 1, 6, 2013);
256
+        $date1 = dol_mktime(0, 0, 0, 1, 4, 2013);
257
+        $date2 = dol_mktime(0, 0, 0, 1, 6, 2013);
258 258
 
259
-        $result=num_open_day($date1,$date2,0,1,0,'FR');
259
+        $result = num_open_day($date1, $date2, 0, 1, 0, 'FR');
260 260
         print __METHOD__." result=".$result."\n";
261
-        $this->assertEquals(1,$result,'NumOpenDay for FR');   // 1 opened day, 2 closed
261
+        $this->assertEquals(1, $result, 'NumOpenDay for FR'); // 1 opened day, 2 closed
262 262
 
263
-        $result=num_open_day($date1,$date2,'XX',1);
263
+        $result = num_open_day($date1, $date2, 'XX', 1);
264 264
         print __METHOD__." result=".$result."\n";
265
-        $this->assertEquals(1,$result,'NumOpenDay for XX');   // 1 opened day, 2 closes (even if country unknown)
265
+        $this->assertEquals(1, $result, 'NumOpenDay for XX'); // 1 opened day, 2 closes (even if country unknown)
266 266
     }
267 267
 
268 268
     /**
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
      */
273 273
     public function testConvertTime2Seconds()
274 274
     {
275
-    	global $conf,$user,$langs,$db;
276
-		$conf=$this->savconf;
277
-		$user=$this->savuser;
278
-		$langs=$this->savlangs;
279
-		$db=$this->savdb;
275
+    	global $conf, $user, $langs, $db;
276
+		$conf = $this->savconf;
277
+		$user = $this->savuser;
278
+		$langs = $this->savlangs;
279
+		$db = $this->savdb;
280 280
 
281
-		$result=convertTime2Seconds(1,1,2);
281
+		$result = convertTime2Seconds(1, 1, 2);
282 282
     	print __METHOD__." result=".$result."\n";
283
-		$this->assertEquals(3662,$result);
283
+		$this->assertEquals(3662, $result);
284 284
 
285 285
 		return $result;
286 286
     }
@@ -292,19 +292,19 @@  discard block
 block discarded – undo
292 292
      */
293 293
     public function testConvertSecondToTime()
294 294
     {
295
-    	global $conf,$user,$langs,$db;
296
-		$conf=$this->savconf;
297
-		$user=$this->savuser;
298
-		$langs=$this->savlangs;
299
-		$db=$this->savdb;
295
+    	global $conf, $user, $langs, $db;
296
+		$conf = $this->savconf;
297
+		$user = $this->savuser;
298
+		$langs = $this->savlangs;
299
+		$db = $this->savdb;
300 300
 
301
-		$result=convertSecondToTime(0,'all',86400);
301
+		$result = convertSecondToTime(0, 'all', 86400);
302 302
     	print __METHOD__." result=".$result."\n";
303
-		$this->assertEquals('0',$result);
303
+		$this->assertEquals('0', $result);
304 304
 
305
-		$result=convertSecondToTime(86400,'all',86400);
305
+		$result = convertSecondToTime(86400, 'all', 86400);
306 306
     	print __METHOD__." result=".$result."\n";
307
-		$this->assertSame('1 '.$langs->trans("Day"),$result);
307
+		$this->assertSame('1 '.$langs->trans("Day"), $result);
308 308
 
309 309
 
310 310
 		return $result;
@@ -317,64 +317,64 @@  discard block
 block discarded – undo
317 317
      */
318 318
     public function testDolPrintDate()
319 319
     {
320
-        global $conf,$user,$langs,$db;
321
-        $conf=$this->savconf;
322
-        $user=$this->savuser;
323
-        $langs=$this->savlangs;
324
-        $db=$this->savdb;
320
+        global $conf, $user, $langs, $db;
321
+        $conf = $this->savconf;
322
+        $user = $this->savuser;
323
+        $langs = $this->savlangs;
324
+        $db = $this->savdb;
325 325
 
326 326
     	// Check %Y-%m-%d %H:%M:%S format
327
-        $result=dol_print_date(0,'%Y-%m-%d %H:%M:%S',true);
327
+        $result = dol_print_date(0, '%Y-%m-%d %H:%M:%S', true);
328 328
        	print __METHOD__." result=".$result."\n";
329
-    	$this->assertEquals('1970-01-01 00:00:00',$result);
329
+    	$this->assertEquals('1970-01-01 00:00:00', $result);
330 330
 
331 331
     	// Check %Y-%m-%d %H:%M:%S format
332
-    	$result=dol_print_date(16725225600,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
332
+    	$result = dol_print_date(16725225600, '%Y-%m-%d %H:%M:%S', true); // http://www.epochconverter.com/
333 333
     	print __METHOD__." result=".$result."\n";
334
-    	$this->assertEquals('2500-01-01 00:00:00',$result);
334
+    	$this->assertEquals('2500-01-01 00:00:00', $result);
335 335
 
336 336
     	// Check %Y-%m-%d %H:%M:%S format
337
-    	$result=dol_print_date(-1830384000,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
337
+    	$result = dol_print_date(-1830384000, '%Y-%m-%d %H:%M:%S', true); // http://www.epochconverter.com/
338 338
     	print __METHOD__." result=".$result."\n";
339
-    	$this->assertEquals('1912-01-01 00:00:00',$result);	// dol_print_date use TZ (good) but epoch converter does not use it.
339
+    	$this->assertEquals('1912-01-01 00:00:00', $result); // dol_print_date use TZ (good) but epoch converter does not use it.
340 340
 
341 341
     	// Check %Y-%m-%d %H:%M:%S format
342
-    	$result=dol_print_date(-11676096000,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
342
+    	$result = dol_print_date(-11676096000, '%Y-%m-%d %H:%M:%S', true); // http://www.epochconverter.com/
343 343
     	print __METHOD__." result=".$result."\n";
344
-    	$this->assertEquals('1600-01-01 00:00:00',$result);
344
+    	$this->assertEquals('1600-01-01 00:00:00', $result);
345 345
 
346 346
     	// test with negative timezone
347
-    	$result=dol_print_date(-1,'%Y-%m-%d %H:%M:%S',true);	// http://www.epochconverter.com/
347
+    	$result = dol_print_date(-1, '%Y-%m-%d %H:%M:%S', true); // http://www.epochconverter.com/
348 348
     	print __METHOD__." result=".$result."\n";
349
-    	$this->assertEquals('1969-12-31 23:59:59',$result);
349
+    	$this->assertEquals('1969-12-31 23:59:59', $result);
350 350
 
351 351
     	// Check dayhour format for fr_FR
352
-    	$outputlangs=new Translate('',$conf);
352
+    	$outputlangs = new Translate('', $conf);
353 353
     	$outputlangs->setDefaultLang('fr_FR');
354 354
     	$outputlangs->load("main");
355 355
 
356
-    	$result=dol_print_date(0+24*3600,'dayhour',true,$outputlangs);
356
+    	$result = dol_print_date(0 + 24 * 3600, 'dayhour', true, $outputlangs);
357 357
     	print __METHOD__." result=".$result."\n";
358
-    	$this->assertEquals('02/01/1970 00:00',$result);
358
+    	$this->assertEquals('02/01/1970 00:00', $result);
359 359
 
360 360
     	// Check %a and %b format for fr_FR
361
-    	$result=dol_print_date(0,'%a %b %B',true,$outputlangs);
361
+    	$result = dol_print_date(0, '%a %b %B', true, $outputlangs);
362 362
     	print __METHOD__." result=".$result."\n";
363
-    	$this->assertEquals('Jeu Jan. Janvier',$result);
363
+    	$this->assertEquals('Jeu Jan. Janvier', $result);
364 364
 
365 365
     	// Check day format for en_US
366
-    	$outputlangs=new Translate('',$conf);
366
+    	$outputlangs = new Translate('', $conf);
367 367
     	$outputlangs->setDefaultLang('en_US');
368 368
     	$outputlangs->load("main");
369 369
 
370
-    	$result=dol_print_date(0+24*3600,'day',true,$outputlangs);
370
+    	$result = dol_print_date(0 + 24 * 3600, 'day', true, $outputlangs);
371 371
     	print __METHOD__." result=".$result."\n";
372
-    	$this->assertEquals('01/02/1970',$result);
372
+    	$this->assertEquals('01/02/1970', $result);
373 373
 
374 374
     	// Check %a and %b format for en_US
375
-    	$result=dol_print_date(0,'%a %b %B',true,$outputlangs);
375
+    	$result = dol_print_date(0, '%a %b %B', true, $outputlangs);
376 376
     	print __METHOD__." result=".$result."\n";
377
-    	$this->assertEquals('Thu Jan January',$result);
377
+    	$this->assertEquals('Thu Jan January', $result);
378 378
 
379 379
     	return $result;
380 380
     }
@@ -386,20 +386,20 @@  discard block
 block discarded – undo
386 386
      */
387 387
     public function testDolTimePlusDuree()
388 388
     {
389
-        global $conf,$user,$langs,$db;
390
-        $conf=$this->savconf;
391
-        $user=$this->savuser;
392
-        $langs=$this->savlangs;
393
-        $db=$this->savdb;
389
+        global $conf, $user, $langs, $db;
390
+        $conf = $this->savconf;
391
+        $user = $this->savuser;
392
+        $langs = $this->savlangs;
393
+        $db = $this->savdb;
394 394
 
395 395
         // Check dayhour format for fr_FR
396
-        $outputlangs=new Translate('',$conf);
396
+        $outputlangs = new Translate('', $conf);
397 397
         $outputlangs->setDefaultLang('fr_FR');
398 398
         $outputlangs->load("main");
399 399
 
400
-        $result=dol_print_date(dol_time_plus_duree(dol_time_plus_duree(dol_time_plus_duree(0,1,'m'),1,'y'),1,'d'),'dayhour',true,$outputlangs);
400
+        $result = dol_print_date(dol_time_plus_duree(dol_time_plus_duree(dol_time_plus_duree(0, 1, 'm'), 1, 'y'), 1, 'd'), 'dayhour', true, $outputlangs);
401 401
        	print __METHOD__." result=".$result."\n";
402
-    	$this->assertEquals('02/02/1971 00:00',$result);
402
+    	$this->assertEquals('02/02/1971 00:00', $result);
403 403
 
404 404
     	return $result;
405 405
     }
@@ -411,36 +411,36 @@  discard block
 block discarded – undo
411 411
      */
412 412
     public function testDolStringToTime()
413 413
     {
414
-        global $conf,$user,$langs,$db;
415
-        $conf=$this->savconf;
416
-        $user=$this->savuser;
417
-        $langs=$this->savlangs;
418
-        $db=$this->savdb;
419
-
420
-		$stime='19700102';
421
-		$result=dol_stringtotime($stime);
414
+        global $conf, $user, $langs, $db;
415
+        $conf = $this->savconf;
416
+        $user = $this->savuser;
417
+        $langs = $this->savlangs;
418
+        $db = $this->savdb;
419
+
420
+		$stime = '19700102';
421
+		$result = dol_stringtotime($stime);
422 422
 		print __METHOD__." result=".$result."\n";
423
-		$this->assertEquals(86400,$result);
423
+		$this->assertEquals(86400, $result);
424 424
 
425
-		$stime='1970-01-01T02:00:00Z';
426
-        $result=dol_stringtotime($stime);
425
+		$stime = '1970-01-01T02:00:00Z';
426
+        $result = dol_stringtotime($stime);
427 427
     	print __METHOD__." result=".$result."\n";
428
-		$this->assertEquals(7200,$result);
428
+		$this->assertEquals(7200, $result);
429 429
 
430
-        $stime='1970-01-01 02:00:00';
431
-        $result=dol_stringtotime($stime);
430
+        $stime = '1970-01-01 02:00:00';
431
+        $result = dol_stringtotime($stime);
432 432
     	print __METHOD__." result=".$result."\n";
433
-		$this->assertEquals(7200,$result);
433
+		$this->assertEquals(7200, $result);
434 434
 
435
-        $stime='19700101T020000Z';
436
-        $result=dol_stringtotime($stime);
435
+        $stime = '19700101T020000Z';
436
+        $result = dol_stringtotime($stime);
437 437
     	print __METHOD__." result=".$result."\n";
438
-		$this->assertEquals(7200,$result);
438
+		$this->assertEquals(7200, $result);
439 439
 
440
-		$stime='19700101020000';
441
-		$result=dol_stringtotime($stime);
440
+		$stime = '19700101020000';
441
+		$result = dol_stringtotime($stime);
442 442
 		print __METHOD__." result=".$result."\n";
443
-		$this->assertEquals(7200,$result);
443
+		$this->assertEquals(7200, $result);
444 444
 
445 445
         return $result;
446 446
     }
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
     {
455 455
     	global $conf;
456 456
 
457
-    	$day=3; $month=2; $year=2015;
458
-    	$conf->global->MAIN_START_WEEK = 1;	// start on monday
457
+    	$day = 3; $month = 2; $year = 2015;
458
+    	$conf->global->MAIN_START_WEEK = 1; // start on monday
459 459
    		$prev = dol_get_first_day_week($day, $month, $year);
460
-		$this->assertEquals(2, (int) $prev['first_day']);		// monday for month 2, year 2014 is the 2
460
+		$this->assertEquals(2, (int) $prev['first_day']); // monday for month 2, year 2014 is the 2
461 461
 
462
-    	$day=3; $month=2; $year=2015;
463
-    	$conf->global->MAIN_START_WEEK = 0;	// start on sunday
462
+    	$day = 3; $month = 2; $year = 2015;
463
+    	$conf->global->MAIN_START_WEEK = 0; // start on sunday
464 464
    		$prev = dol_get_first_day_week($day, $month, $year);
465
-		$this->assertEquals(1, (int) $prev['first_day']);		// sunday for month 2, year 2015 is the 1st
465
+		$this->assertEquals(1, (int) $prev['first_day']); // sunday for month 2, year 2015 is the 1st
466 466
     }
467 467
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/EntrepotTest.php 2 patches
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
 if (empty($user->id))
33 33
 {
34
-	print "Load permissions for admin user nb 1\n";
35
-	$user->fetch(1);
36
-	$user->getrights();
34
+    print "Load permissions for admin user nb 1\n";
35
+    $user->fetch(1);
36
+    $user->getrights();
37 37
 }
38 38
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
39 39
 
@@ -47,78 +47,78 @@  discard block
 block discarded – undo
47 47
  */
48 48
 class EntrepotTest extends PHPUnit_Framework_TestCase
49 49
 {
50
-	protected $savconf;
51
-	protected $savuser;
52
-	protected $savlangs;
53
-	protected $savdb;
54
-
55
-	/**
56
-	 * Constructor
57
-	 * We save global variables into local variables
58
-	 *
59
-	 * @return EntrepotTest
60
-	 */
61
-	function __construct()
62
-	{
63
-		parent::__construct();
64
-
65
-		//$this->sharedFixture
66
-		global $conf,$user,$langs,$db;
67
-		$this->savconf=$conf;
68
-		$this->savuser=$user;
69
-		$this->savlangs=$langs;
70
-		$this->savdb=$db;
71
-
72
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
-		//print " - db ".$db->db;
74
-		print "\n";
75
-	}
76
-
77
-	// Static methods
78
-  	public static function setUpBeforeClass()
50
+    protected $savconf;
51
+    protected $savuser;
52
+    protected $savlangs;
53
+    protected $savdb;
54
+
55
+    /**
56
+     * Constructor
57
+     * We save global variables into local variables
58
+     *
59
+     * @return EntrepotTest
60
+     */
61
+    function __construct()
62
+    {
63
+        parent::__construct();
64
+
65
+        //$this->sharedFixture
66
+        global $conf,$user,$langs,$db;
67
+        $this->savconf=$conf;
68
+        $this->savuser=$user;
69
+        $this->savlangs=$langs;
70
+        $this->savdb=$db;
71
+
72
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
+        //print " - db ".$db->db;
74
+        print "\n";
75
+    }
76
+
77
+    // Static methods
78
+        public static function setUpBeforeClass()
79 79
     {
80
-    	global $conf,$user,$langs,$db;
80
+        global $conf,$user,$langs,$db;
81 81
 
82
-    	if (empty($conf->stock->enabled)) { print __METHOD__." Module Stock must be enabled.\n"; die(); }
82
+        if (empty($conf->stock->enabled)) { print __METHOD__." Module Stock must be enabled.\n"; die(); }
83 83
 
84 84
         $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
85 85
 
86
-    	print __METHOD__."\n";
86
+        print __METHOD__."\n";
87 87
     }
88 88
 
89 89
     // tear down after class
90 90
     public static function tearDownAfterClass()
91 91
     {
92
-    	global $conf,$user,$langs,$db;
93
-		$db->rollback();
92
+        global $conf,$user,$langs,$db;
93
+        $db->rollback();
94 94
 
95
-		print __METHOD__."\n";
95
+        print __METHOD__."\n";
96 96
     }
97 97
 
98
-	/**
99
-	 * Init phpunit tests
100
-	 *
101
-	 * @return	void
102
-	 */
98
+    /**
99
+     * Init phpunit tests
100
+     *
101
+     * @return	void
102
+     */
103 103
     protected function setUp()
104 104
     {
105
-    	global $conf,$user,$langs,$db;
106
-		$conf=$this->savconf;
107
-		$user=$this->savuser;
108
-		$langs=$this->savlangs;
109
-		$db=$this->savdb;
105
+        global $conf,$user,$langs,$db;
106
+        $conf=$this->savconf;
107
+        $user=$this->savuser;
108
+        $langs=$this->savlangs;
109
+        $db=$this->savdb;
110 110
 
111
-		print __METHOD__."\n";
111
+        print __METHOD__."\n";
112 112
     }
113 113
 
114
-	/**
115
-	 * End phpunit tests
116
-	 *
117
-	 * @return	void
118
-	 */
114
+    /**
115
+     * End phpunit tests
116
+     *
117
+     * @return	void
118
+     */
119 119
     protected function tearDown()
120 120
     {
121
-    	print __METHOD__."\n";
121
+        print __METHOD__."\n";
122 122
     }
123 123
 
124 124
     /**
@@ -128,20 +128,20 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function testEntrepotCreate()
130 130
     {
131
-    	global $conf,$user,$langs,$db;
132
-		$conf=$this->savconf;
133
-		$user=$this->savuser;
134
-		$langs=$this->savlangs;
135
-		$db=$this->savdb;
131
+        global $conf,$user,$langs,$db;
132
+        $conf=$this->savconf;
133
+        $user=$this->savuser;
134
+        $langs=$this->savlangs;
135
+        $db=$this->savdb;
136 136
 
137
-		$localobject=new Entrepot($this->savdb);
138
-    	$localobject->initAsSpecimen();
139
-    	$result=$localobject->create($user);
137
+        $localobject=new Entrepot($this->savdb);
138
+        $localobject->initAsSpecimen();
139
+        $result=$localobject->create($user);
140 140
 
141 141
         print __METHOD__." result=".$result."\n";
142
-    	$this->assertLessThanOrEqual($result, 0);
142
+        $this->assertLessThanOrEqual($result, 0);
143 143
 
144
-    	return $result;
144
+        return $result;
145 145
     }
146 146
 
147 147
     /**
@@ -155,18 +155,18 @@  discard block
 block discarded – undo
155 155
      */
156 156
     public function testEntrepotFetch($id)
157 157
     {
158
-    	global $conf,$user,$langs,$db;
159
-		$conf=$this->savconf;
160
-		$user=$this->savuser;
161
-		$langs=$this->savlangs;
162
-		$db=$this->savdb;
163
-
164
-		$localobject=new Entrepot($this->savdb);
165
-    	$result=$localobject->fetch($id);
158
+        global $conf,$user,$langs,$db;
159
+        $conf=$this->savconf;
160
+        $user=$this->savuser;
161
+        $langs=$this->savlangs;
162
+        $db=$this->savdb;
163
+
164
+        $localobject=new Entrepot($this->savdb);
165
+        $result=$localobject->fetch($id);
166 166
         print __METHOD__." id=".$id." result=".$result."\n";
167
-    	$this->assertLessThan($result, 0);
167
+        $this->assertLessThan($result, 0);
168 168
 
169
-    	return $localobject;
169
+        return $localobject;
170 170
     }
171 171
 
172 172
     /**
@@ -180,18 +180,18 @@  discard block
 block discarded – undo
180 180
      */
181 181
     public function testEntrepotUpdate($localobject)
182 182
     {
183
-    	global $conf,$user,$langs,$db;
184
-		$conf=$this->savconf;
185
-		$user=$this->savuser;
186
-		$langs=$this->savlangs;
187
-		$db=$this->savdb;
188
-
189
-		$localobject->note='New note after update';
190
-    	$result=$localobject->update($localobject->id,$user);
191
-    	print __METHOD__." id=".$localobject->id." result=".$result."\n";
192
-    	$this->assertLessThan($result, 0);
193
-
194
-    	return $localobject;
183
+        global $conf,$user,$langs,$db;
184
+        $conf=$this->savconf;
185
+        $user=$this->savuser;
186
+        $langs=$this->savlangs;
187
+        $db=$this->savdb;
188
+
189
+        $localobject->note='New note after update';
190
+        $result=$localobject->update($localobject->id,$user);
191
+        print __METHOD__." id=".$localobject->id." result=".$result."\n";
192
+        $this->assertLessThan($result, 0);
193
+
194
+        return $localobject;
195 195
     }
196 196
 
197 197
     /**
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function testEntrepotOther($localobject)
207 207
     {
208
-    	global $conf,$user,$langs,$db;
209
-		$conf=$this->savconf;
210
-		$user=$this->savuser;
211
-		$langs=$this->savlangs;
212
-		$db=$this->savdb;
208
+        global $conf,$user,$langs,$db;
209
+        $conf=$this->savconf;
210
+        $user=$this->savuser;
211
+        $langs=$this->savlangs;
212
+        $db=$this->savdb;
213 213
 
214 214
 
215 215
         return $localobject->id;
@@ -226,20 +226,20 @@  discard block
 block discarded – undo
226 226
      */
227 227
     public function testEntrepotDelete($id)
228 228
     {
229
-    	global $conf,$user,$langs,$db;
230
-		$conf=$this->savconf;
231
-		$user=$this->savuser;
232
-		$langs=$this->savlangs;
233
-		$db=$this->savdb;
229
+        global $conf,$user,$langs,$db;
230
+        $conf=$this->savconf;
231
+        $user=$this->savuser;
232
+        $langs=$this->savlangs;
233
+        $db=$this->savdb;
234 234
 
235
-		$localobject=new Entrepot($this->savdb);
236
-    	$result=$localobject->fetch($id);
235
+        $localobject=new Entrepot($this->savdb);
236
+        $result=$localobject->fetch($id);
237 237
 
238
-    	$result=$localobject->delete($user);
239
-		print __METHOD__." id=".$id." result=".$result."\n";
240
-    	$this->assertLessThan($result, 0);
238
+        $result=$localobject->delete($user);
239
+        print __METHOD__." id=".$id." result=".$result."\n";
240
+        $this->assertLessThan($result, 0);
241 241
 
242
-    	return $result;
242
+        return $result;
243 243
     }
244 244
 
245 245
     /**
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 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,11 +77,11 @@  discard block
 block discarded – undo
77 77
 	// Static methods
78 78
   	public static function setUpBeforeClass()
79 79
     {
80
-    	global $conf,$user,$langs,$db;
80
+    	global $conf, $user, $langs, $db;
81 81
 
82 82
     	if (empty($conf->stock->enabled)) { print __METHOD__." Module Stock must be enabled.\n"; die(); }
83 83
 
84
-        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
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
     }
@@ -128,15 +128,15 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function testEntrepotCreate()
130 130
     {
131
-    	global $conf,$user,$langs,$db;
132
-		$conf=$this->savconf;
133
-		$user=$this->savuser;
134
-		$langs=$this->savlangs;
135
-		$db=$this->savdb;
131
+    	global $conf, $user, $langs, $db;
132
+		$conf = $this->savconf;
133
+		$user = $this->savuser;
134
+		$langs = $this->savlangs;
135
+		$db = $this->savdb;
136 136
 
137
-		$localobject=new Entrepot($this->savdb);
137
+		$localobject = new Entrepot($this->savdb);
138 138
     	$localobject->initAsSpecimen();
139
-    	$result=$localobject->create($user);
139
+    	$result = $localobject->create($user);
140 140
 
141 141
         print __METHOD__." result=".$result."\n";
142 142
     	$this->assertLessThanOrEqual($result, 0);
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
      */
156 156
     public function testEntrepotFetch($id)
157 157
     {
158
-    	global $conf,$user,$langs,$db;
159
-		$conf=$this->savconf;
160
-		$user=$this->savuser;
161
-		$langs=$this->savlangs;
162
-		$db=$this->savdb;
163
-
164
-		$localobject=new Entrepot($this->savdb);
165
-    	$result=$localobject->fetch($id);
158
+    	global $conf, $user, $langs, $db;
159
+		$conf = $this->savconf;
160
+		$user = $this->savuser;
161
+		$langs = $this->savlangs;
162
+		$db = $this->savdb;
163
+
164
+		$localobject = new Entrepot($this->savdb);
165
+    	$result = $localobject->fetch($id);
166 166
         print __METHOD__." id=".$id." result=".$result."\n";
167 167
     	$this->assertLessThan($result, 0);
168 168
 
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
      */
181 181
     public function testEntrepotUpdate($localobject)
182 182
     {
183
-    	global $conf,$user,$langs,$db;
184
-		$conf=$this->savconf;
185
-		$user=$this->savuser;
186
-		$langs=$this->savlangs;
187
-		$db=$this->savdb;
188
-
189
-		$localobject->note='New note after update';
190
-    	$result=$localobject->update($localobject->id,$user);
183
+    	global $conf, $user, $langs, $db;
184
+		$conf = $this->savconf;
185
+		$user = $this->savuser;
186
+		$langs = $this->savlangs;
187
+		$db = $this->savdb;
188
+
189
+		$localobject->note = 'New note after update';
190
+    	$result = $localobject->update($localobject->id, $user);
191 191
     	print __METHOD__." id=".$localobject->id." result=".$result."\n";
192 192
     	$this->assertLessThan($result, 0);
193 193
 
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function testEntrepotOther($localobject)
207 207
     {
208
-    	global $conf,$user,$langs,$db;
209
-		$conf=$this->savconf;
210
-		$user=$this->savuser;
211
-		$langs=$this->savlangs;
212
-		$db=$this->savdb;
208
+    	global $conf, $user, $langs, $db;
209
+		$conf = $this->savconf;
210
+		$user = $this->savuser;
211
+		$langs = $this->savlangs;
212
+		$db = $this->savdb;
213 213
 
214 214
 
215 215
         return $localobject->id;
@@ -226,16 +226,16 @@  discard block
 block discarded – undo
226 226
      */
227 227
     public function testEntrepotDelete($id)
228 228
     {
229
-    	global $conf,$user,$langs,$db;
230
-		$conf=$this->savconf;
231
-		$user=$this->savuser;
232
-		$langs=$this->savlangs;
233
-		$db=$this->savdb;
229
+    	global $conf, $user, $langs, $db;
230
+		$conf = $this->savconf;
231
+		$user = $this->savuser;
232
+		$langs = $this->savlangs;
233
+		$db = $this->savdb;
234 234
 
235
-		$localobject=new Entrepot($this->savdb);
236
-    	$result=$localobject->fetch($id);
235
+		$localobject = new Entrepot($this->savdb);
236
+    	$result = $localobject->fetch($id);
237 237
 
238
-    	$result=$localobject->delete($user);
238
+    	$result = $localobject->delete($user);
239 239
 		print __METHOD__." id=".$id." result=".$result."\n";
240 240
     	$this->assertLessThan($result, 0);
241 241
 
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
      */
250 250
     public function testEntrepotStatic()
251 251
     {
252
-        global $conf,$user,$langs,$db;
253
-        $conf=$this->savconf;
254
-        $user=$this->savuser;
255
-        $langs=$this->savlangs;
256
-        $db=$this->savdb;
252
+        global $conf, $user, $langs, $db;
253
+        $conf = $this->savconf;
254
+        $user = $this->savuser;
255
+        $langs = $this->savlangs;
256
+        $db = $this->savdb;
257 257
 
258
-        $localobject=new Entrepot($db);
258
+        $localobject = new Entrepot($db);
259 259
 
260 260
         return;
261 261
     }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/SocieteTest.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
      */
61 61
     function __construct()
62 62
     {
63
-    	parent::__construct();
63
+        parent::__construct();
64 64
 
65
-    	//$this->sharedFixture
65
+        //$this->sharedFixture
66 66
         global $conf,$user,$langs,$db;
67 67
         $this->savconf=$conf;
68 68
         $this->savuser=$user;
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
      *
181 181
      * @param   Societe $localobject    Company
182 182
      * @return  Societe $localobject    Company
183
-    *
183
+     *
184 184
      * @depends testSocieteFetch
185 185
      * The depends says test is run only if previous is ok
186 186
      */
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
214 214
         $this->assertLessThan($result, 0);
215 215
 
216
-		$result=$localobject->update_note($localobject->note_private,'_private');
217
-		print __METHOD__." id=".$localobject->id." result=".$result."\n";
218
-		$this->assertLessThan($result, 0, 'Holiday::update_note (private) error');
216
+        $result=$localobject->update_note($localobject->note_private,'_private');
217
+        print __METHOD__." id=".$localobject->id." result=".$result."\n";
218
+        $this->assertLessThan($result, 0, 'Holiday::update_note (private) error');
219 219
 
220
-		$result=$localobject->update_note($localobject->note_public, '_public');
221
-		print __METHOD__." id=".$localobject->id." result=".$result."\n";
222
-		$this->assertLessThan($result, 0, 'Holiday::update_note (public) error');
220
+        $result=$localobject->update_note($localobject->note_public, '_public');
221
+        print __METHOD__." id=".$localobject->id." result=".$result."\n";
222
+        $this->assertLessThan($result, 0, 'Holiday::update_note (public) error');
223 223
 
224 224
         $newobject=new Societe($this->savdb);
225 225
         $result=$newobject->fetch($localobject->id);
Please login to merge, or discard this patch.
Spacing   +133 added lines, -133 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,13 +77,13 @@  discard block
 block discarded – undo
77 77
     // Static methods
78 78
     public static function setUpBeforeClass()
79 79
     {
80
-        global $conf,$user,$langs,$db;
80
+        global $conf, $user, $langs, $db;
81 81
 
82 82
         if ($conf->global->SOCIETE_CODECLIENT_ADDON != 'mod_codeclient_monkey') { print "\n".__METHOD__." third party ref checker must be setup to 'mod_codeclient_monkey' not to '".$conf->global->SOCIETE_CODECLIENT_ADDON."'.\n"; die(); }
83 83
 
84
-        if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) { print "\n".__METHOD__." constant MAIN_DISABLEPROFIDRULES must be empty (if a module set it, disable module).\n"; die(); }
84
+        if (!empty($conf->global->MAIN_DISABLEPROFIDRULES)) { print "\n".__METHOD__." constant MAIN_DISABLEPROFIDRULES must be empty (if a module set it, disable module).\n"; die(); }
85 85
 
86
-        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
86
+        $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
87 87
 
88 88
         print __METHOD__."\n";
89 89
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     // tear down after class
92 92
     public static function tearDownAfterClass()
93 93
     {
94
-        global $conf,$user,$langs,$db;
94
+        global $conf, $user, $langs, $db;
95 95
         $db->rollback();
96 96
 
97 97
         print __METHOD__."\n";
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
      */
105 105
     protected function setUp()
106 106
     {
107
-        global $conf,$user,$langs,$db;
108
-        $conf=$this->savconf;
109
-        $user=$this->savuser;
110
-        $langs=$this->savlangs;
111
-        $db=$this->savdb;
107
+        global $conf, $user, $langs, $db;
108
+        $conf = $this->savconf;
109
+        $user = $this->savuser;
110
+        $langs = $this->savlangs;
111
+        $db = $this->savdb;
112 112
 
113 113
         print __METHOD__."\n";
114 114
     }
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function testSocieteCreate()
132 132
     {
133
-        global $conf,$user,$langs,$db;
134
-        $conf=$this->savconf;
135
-        $user=$this->savuser;
136
-        $langs=$this->savlangs;
137
-        $db=$this->savdb;
133
+        global $conf, $user, $langs, $db;
134
+        $conf = $this->savconf;
135
+        $user = $this->savuser;
136
+        $langs = $this->savlangs;
137
+        $db = $this->savdb;
138 138
 
139
-        $localobject=new Societe($this->savdb);
139
+        $localobject = new Societe($this->savdb);
140 140
         $localobject->initAsSpecimen();
141
-        $result=$localobject->create($user);
141
+        $result = $localobject->create($user);
142 142
 
143 143
         print __METHOD__." result=".$result."\n";
144 144
         $this->assertLessThanOrEqual($result, 0);
@@ -157,18 +157,18 @@  discard block
 block discarded – undo
157 157
      */
158 158
     public function testSocieteFetch($id)
159 159
     {
160
-        global $conf,$user,$langs,$db;
161
-        $conf=$this->savconf;
162
-        $user=$this->savuser;
163
-        $langs=$this->savlangs;
164
-        $db=$this->savdb;
165
-
166
-        $localobject=new Societe($this->savdb);
167
-        $result=$localobject->fetch($id);
160
+        global $conf, $user, $langs, $db;
161
+        $conf = $this->savconf;
162
+        $user = $this->savuser;
163
+        $langs = $this->savlangs;
164
+        $db = $this->savdb;
165
+
166
+        $localobject = new Societe($this->savdb);
167
+        $result = $localobject->fetch($id);
168 168
         print __METHOD__." id=".$id." result=".$result."\n";
169 169
         $this->assertLessThan($result, 0);
170 170
 
171
-        $result=$localobject->verify();
171
+        $result = $localobject->verify();
172 172
         print __METHOD__." id=".$id." result=".$result."\n";
173 173
         $this->assertEquals($result, 0);
174 174
 
@@ -186,43 +186,43 @@  discard block
 block discarded – undo
186 186
      */
187 187
     public function testSocieteUpdate($localobject)
188 188
     {
189
-        global $conf,$user,$langs,$db;
190
-        $conf=$this->savconf;
191
-        $user=$this->savuser;
192
-        $langs=$this->savlangs;
193
-        $db=$this->savdb;
194
-
195
-        $localobject->note_private='New private note after update';
196
-        $localobject->note_public='New public note after update';
197
-        $localobject->name='New name';
198
-        $localobject->address='New address';
199
-        $localobject->zip='New zip';
200
-        $localobject->town='New town';
201
-        $localobject->country_id=2;
202
-        $localobject->status=0;
203
-        $localobject->phone='New tel';
204
-        $localobject->fax='New fax';
205
-        $localobject->email='[email protected]';
206
-        $localobject->url='New url';
207
-        $localobject->idprof1='new idprof1';
208
-        $localobject->idprof2='new idprof2';
209
-        $localobject->idprof3='new idprof3';
210
-        $localobject->idprof4='new idprof4';
211
-
212
-        $result=$localobject->update($localobject->id,$user);
189
+        global $conf, $user, $langs, $db;
190
+        $conf = $this->savconf;
191
+        $user = $this->savuser;
192
+        $langs = $this->savlangs;
193
+        $db = $this->savdb;
194
+
195
+        $localobject->note_private = 'New private note after update';
196
+        $localobject->note_public = 'New public note after update';
197
+        $localobject->name = 'New name';
198
+        $localobject->address = 'New address';
199
+        $localobject->zip = 'New zip';
200
+        $localobject->town = 'New town';
201
+        $localobject->country_id = 2;
202
+        $localobject->status = 0;
203
+        $localobject->phone = 'New tel';
204
+        $localobject->fax = 'New fax';
205
+        $localobject->email = '[email protected]';
206
+        $localobject->url = 'New url';
207
+        $localobject->idprof1 = 'new idprof1';
208
+        $localobject->idprof2 = 'new idprof2';
209
+        $localobject->idprof3 = 'new idprof3';
210
+        $localobject->idprof4 = 'new idprof4';
211
+
212
+        $result = $localobject->update($localobject->id, $user);
213 213
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
214 214
         $this->assertLessThan($result, 0);
215 215
 
216
-		$result=$localobject->update_note($localobject->note_private,'_private');
216
+		$result = $localobject->update_note($localobject->note_private, '_private');
217 217
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
218 218
 		$this->assertLessThan($result, 0, 'Holiday::update_note (private) error');
219 219
 
220
-		$result=$localobject->update_note($localobject->note_public, '_public');
220
+		$result = $localobject->update_note($localobject->note_public, '_public');
221 221
 		print __METHOD__." id=".$localobject->id." result=".$result."\n";
222 222
 		$this->assertLessThan($result, 0, 'Holiday::update_note (public) error');
223 223
 
224
-        $newobject=new Societe($this->savdb);
225
-        $result=$newobject->fetch($localobject->id);
224
+        $newobject = new Societe($this->savdb);
225
+        $result = $newobject->fetch($localobject->id);
226 226
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
227 227
         $this->assertLessThan($result, 0);
228 228
 
@@ -259,42 +259,42 @@  discard block
 block discarded – undo
259 259
     public function testIdProfCheck($localobject)
260 260
     {
261 261
         // OK FR
262
-        $localobject->country_code='FR';
263
-        $localobject->idprof1=493861496;
264
-        $localobject->idprof2=49386149600021;
265
-        $result=$localobject->id_prof_check(1,$localobject);    // Must be > 0
262
+        $localobject->country_code = 'FR';
263
+        $localobject->idprof1 = 493861496;
264
+        $localobject->idprof2 = 49386149600021;
265
+        $result = $localobject->id_prof_check(1, $localobject); // Must be > 0
266 266
         print __METHOD__." OK FR idprof1 result=".$result."\n";
267 267
         $this->assertGreaterThanOrEqual(1, $result);
268
-        $result=$localobject->id_prof_check(2,$localobject);    // Must be > 0
268
+        $result = $localobject->id_prof_check(2, $localobject); // Must be > 0
269 269
         print __METHOD__." OK FR idprof2 result=".$result."\n";
270 270
         $this->assertGreaterThanOrEqual(1, $result);
271 271
 
272 272
         // KO FR
273
-        $localobject->country_code='FR';
274
-        $localobject->idprof1='id1ko';
275
-        $localobject->idprof2='id2ko';
276
-        $result=$localobject->id_prof_check(1,$localobject);    // Must be <= 0
273
+        $localobject->country_code = 'FR';
274
+        $localobject->idprof1 = 'id1ko';
275
+        $localobject->idprof2 = 'id2ko';
276
+        $result = $localobject->id_prof_check(1, $localobject); // Must be <= 0
277 277
         print __METHOD__." KO FR idprof1 result=".$result."\n";
278 278
         $this->assertLessThan(1, $result);
279
-        $result=$localobject->id_prof_check(2,$localobject);    // Must be <= 0
279
+        $result = $localobject->id_prof_check(2, $localobject); // Must be <= 0
280 280
         print __METHOD__." KO FR idprof2 result=".$result."\n";
281 281
         $this->assertLessThan(1, $result);
282 282
 
283 283
         // KO ES
284
-        $localobject->country_code='ES';
285
-        $localobject->idprof1='id1ko';
286
-        $result=$localobject->id_prof_check(1,$localobject);    // Must be <= 0
284
+        $localobject->country_code = 'ES';
285
+        $localobject->idprof1 = 'id1ko';
286
+        $result = $localobject->id_prof_check(1, $localobject); // Must be <= 0
287 287
         print __METHOD__." KO ES idprof1 result=".$result."\n";
288 288
         $this->assertLessThan(1, $result);
289 289
 
290 290
         // OK AR
291
-        $localobject->country_code='AR';
292
-        $localobject->idprof1='id1ko';
293
-        $localobject->idprof2='id2ko';
294
-        $result=$localobject->id_prof_check(1,$localobject);    // Must be > 0
291
+        $localobject->country_code = 'AR';
292
+        $localobject->idprof1 = 'id1ko';
293
+        $localobject->idprof2 = 'id2ko';
294
+        $result = $localobject->id_prof_check(1, $localobject); // Must be > 0
295 295
         print __METHOD__." OK AR idprof1 result=".$result."\n";
296 296
         $this->assertGreaterThanOrEqual(0, $result);
297
-        $result=$localobject->id_prof_check(2,$localobject);    // Must be > 0
297
+        $result = $localobject->id_prof_check(2, $localobject); // Must be > 0
298 298
         print __METHOD__." OK AR idprof2 result=".$result."\n";
299 299
         $this->assertGreaterThanOrEqual(1, $result);
300 300
 
@@ -313,29 +313,29 @@  discard block
 block discarded – undo
313 313
      */
314 314
     public function testSocieteOther($localobject)
315 315
     {
316
-        global $conf,$user,$langs,$db;
317
-        $conf=$this->savconf;
318
-        $user=$this->savuser;
319
-        $langs=$this->savlangs;
320
-        $db=$this->savdb;
316
+        global $conf, $user, $langs, $db;
317
+        $conf = $this->savconf;
318
+        $user = $this->savuser;
319
+        $langs = $this->savlangs;
320
+        $db = $this->savdb;
321 321
 
322
-        $result=$localobject->set_as_client();
322
+        $result = $localobject->set_as_client();
323 323
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
324 324
         $this->assertLessThan($result, 0);
325 325
 
326
-        $result=$localobject->set_price_level(1,$user);
326
+        $result = $localobject->set_price_level(1, $user);
327 327
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
328 328
         $this->assertLessThan($result, 0);
329 329
 
330
-        $result=$localobject->set_remise_client(10,'Gift',$user);
330
+        $result = $localobject->set_remise_client(10, 'Gift', $user);
331 331
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
332 332
         $this->assertLessThan($result, 0);
333 333
 
334
-        $result=$localobject->getNomUrl(1);
334
+        $result = $localobject->getNomUrl(1);
335 335
         print __METHOD__." id=".$localobject->id." result=".$result."\n";
336 336
         $this->assertNotEquals($result, '');
337 337
 
338
-        $result=$localobject->isInEEC();
338
+        $result = $localobject->isInEEC();
339 339
         print __METHOD__." id=".$localobject->id." country_code=".$localobject->country_code." result=".$result."\n";
340 340
         $this->assertTrue(true, $result);
341 341
 
@@ -358,16 +358,16 @@  discard block
 block discarded – undo
358 358
      */
359 359
     public function testSocieteDelete($id)
360 360
     {
361
-        global $conf,$user,$langs,$db;
362
-        $conf=$this->savconf;
363
-        $user=$this->savuser;
364
-        $langs=$this->savlangs;
365
-        $db=$this->savdb;
361
+        global $conf, $user, $langs, $db;
362
+        $conf = $this->savconf;
363
+        $user = $this->savuser;
364
+        $langs = $this->savlangs;
365
+        $db = $this->savdb;
366 366
 
367
-        $localobject=new Societe($this->savdb);
368
-        $result=$localobject->fetch($id);
367
+        $localobject = new Societe($this->savdb);
368
+        $result = $localobject->fetch($id);
369 369
 
370
-        $result=$localobject->delete($id, $user);
370
+        $result = $localobject->delete($id, $user);
371 371
         print __METHOD__." id=".$id." result=".$result."\n";
372 372
         $this->assertLessThan($result, 0);
373 373
 
@@ -381,13 +381,13 @@  discard block
 block discarded – undo
381 381
      */
382 382
     public function testSocieteStatic()
383 383
     {
384
-        global $conf,$user,$langs,$db;
385
-        $conf=$this->savconf;
386
-        $user=$this->savuser;
387
-        $langs=$this->savlangs;
388
-        $db=$this->savdb;
384
+        global $conf, $user, $langs, $db;
385
+        $conf = $this->savconf;
386
+        $user = $this->savuser;
387
+        $langs = $this->savlangs;
388
+        $db = $this->savdb;
389 389
 
390
-        $localobject=new Societe($db);
390
+        $localobject = new Societe($db);
391 391
 
392 392
 
393 393
         return;
@@ -401,57 +401,57 @@  discard block
 block discarded – undo
401 401
      */
402 402
     public function testSocieteGetFullAddress()
403 403
     {
404
-        global $conf,$user,$langs,$db;
405
-        $conf=$this->savconf;
406
-        $user=$this->savuser;
407
-        $langs=$this->savlangs;
408
-        $db=$this->savdb;
404
+        global $conf, $user, $langs, $db;
405
+        $conf = $this->savconf;
406
+        $user = $this->savuser;
407
+        $langs = $this->savlangs;
408
+        $db = $this->savdb;
409 409
 
410
-        $localobjectadd=new Societe($db);
410
+        $localobjectadd = new Societe($db);
411 411
         $localobjectadd->initAsSpecimen();
412 412
 
413 413
         // France
414 414
         unset($localobjectadd->country_code);
415
-        $localobjectadd->country_id=1;
416
-        $localobjectadd->name='New name';
417
-        $localobjectadd->address='New address';
418
-        $localobjectadd->zip='New zip';
419
-        $localobjectadd->town='New town';
420
-        $result=$localobjectadd->getFullAddress(1);
415
+        $localobjectadd->country_id = 1;
416
+        $localobjectadd->name = 'New name';
417
+        $localobjectadd->address = 'New address';
418
+        $localobjectadd->zip = 'New zip';
419
+        $localobjectadd->town = 'New town';
420
+        $result = $localobjectadd->getFullAddress(1);
421 421
         print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
422 422
         $this->assertContains("New address\nNew zip New town\nFrance", $result);
423 423
 
424 424
         // Belgium
425 425
         unset($localobjectadd->country_code);
426
-        $localobjectadd->country_id=2;
427
-        $localobjectadd->name='New name';
428
-        $localobjectadd->address='New address';
429
-        $localobjectadd->zip='New zip';
430
-        $localobjectadd->town='New town';
431
-        $result=$localobjectadd->getFullAddress(1);
426
+        $localobjectadd->country_id = 2;
427
+        $localobjectadd->name = 'New name';
428
+        $localobjectadd->address = 'New address';
429
+        $localobjectadd->zip = 'New zip';
430
+        $localobjectadd->town = 'New town';
431
+        $result = $localobjectadd->getFullAddress(1);
432 432
         print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
433 433
         $this->assertContains("New address\nNew zip New town\nBelgium", $result);
434 434
 
435 435
         // Switzerland
436 436
         unset($localobjectadd->country_code);
437
-        $localobjectadd->country_id=6;
438
-        $localobjectadd->name='New name';
439
-        $localobjectadd->address='New address';
440
-        $localobjectadd->zip='New zip';
441
-        $localobjectadd->town='New town';
442
-        $result=$localobjectadd->getFullAddress(1);
437
+        $localobjectadd->country_id = 6;
438
+        $localobjectadd->name = 'New name';
439
+        $localobjectadd->address = 'New address';
440
+        $localobjectadd->zip = 'New zip';
441
+        $localobjectadd->town = 'New town';
442
+        $result = $localobjectadd->getFullAddress(1);
443 443
         print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
444 444
         $this->assertContains("New address\nNew zip New town\nSwitzerland", $result);
445 445
 
446 446
         // USA
447 447
         unset($localobjectadd->country_code);
448
-        $localobjectadd->country_id=11;
449
-        $localobjectadd->name='New name';
450
-        $localobjectadd->address='New address';
451
-        $localobjectadd->zip='New zip';
452
-        $localobjectadd->town='New town';
453
-        $localobjectadd->state='New state';
454
-        $result=$localobjectadd->getFullAddress(1);
448
+        $localobjectadd->country_id = 11;
449
+        $localobjectadd->name = 'New name';
450
+        $localobjectadd->address = 'New address';
451
+        $localobjectadd->zip = 'New zip';
452
+        $localobjectadd->town = 'New town';
453
+        $localobjectadd->state = 'New state';
454
+        $result = $localobjectadd->getFullAddress(1);
455 455
         print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
456 456
         $this->assertContains("New address\nNew town, New state, New zip\nUnited States", $result);
457 457
 
Please login to merge, or discard this patch.
dolibarr/test/phpunit/WebservicesThirdpartyTest.php 2 patches
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
      */
71 71
     function __construct()
72 72
     {
73
-    	parent::__construct();
73
+        parent::__construct();
74 74
 
75
-    	//$this->sharedFixture
75
+        //$this->sharedFixture
76 76
         global $conf,$user,$langs,$db;
77 77
         $this->savconf=$conf;
78 78
         $this->savuser=$user;
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
         print __METHOD__." create nusoap_client for URL=".$this->_WS_DOL_URL."\n";
86 86
         $this->soapclient = new nusoap_client($this->_WS_DOL_URL);
87 87
         if ($this->soapclient) {
88
-        	$this->soapclient->soap_defencoding='UTF-8';
89
-        	$this->soapclient->decodeUTF8(false);
88
+            $this->soapclient->soap_defencoding='UTF-8';
89
+            $this->soapclient->decodeUTF8(false);
90 90
         }
91 91
 
92 92
         print __METHOD__." db->type=".$db->type." user->id=".$user->id;
@@ -145,86 +145,86 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function testWSThirdpartycreateThirdParty()
147 147
     {
148
-    	global $conf,$user,$langs,$db;
149
-    	$conf=$this->savconf;
150
-    	$user=$this->savuser;
151
-    	$langs=$this->savlangs;
152
-    	$db=$this->savdb;
153
-
154
-    	$WS_METHOD  = 'createThirdParty';
155
-
156
-
157
-    	// Call the WebService method and store its result in $result.
158
-    	$authentication=array(
159
-    			'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
160
-    			'sourceapplication'=>'DEMO',
161
-    			'login'=>'admin',
162
-    			'password'=>'admin',
163
-    			'entity'=>'');
164
-
165
-    	$body = array (
166
-    			"id" => null,
167
-    			"ref" => "name",
168
-    			"ref_ext" => "12",
169
-    			"fk_user_author" => null,
170
-    			"status" => null,
171
-    			"client" => 1,
172
-    			"supplier" => 0,
173
-    			"customer_code" => "CU0901-5678",
174
-    			"supplier_code" => "SU0901-5678",
175
-    			"customer_code_accountancy" => "",
176
-    			"supplier_code_accountancy" => "",
177
-    			"date_creation" => "", // dateTime
178
-    			"date_modification" => "", // dateTime
179
-    			"note_private" => "",
180
-    			"note_public" => "",
181
-    			"address" => "",
182
-    			"zip" => "",
183
-    			"town" => "",
184
-    			"province_id" => "",
185
-    			"country_id" => "",
186
-    			"country_code" => "",
187
-    			"country" => "",
188
-    			"phone" => "",
189
-    			"fax" => "",
190
-    			"email" => "",
191
-    			"url" => "",
192
-    			"profid1" => "",
193
-    			"profid2" => "",
194
-    			"profid3" => "",
195
-    			"profid4" => "",
196
-    			"profid5" => "",
197
-    			"profid6" => "",
198
-    			"capital" => "",
199
-    			"vat_used" => "",
200
-    			"vat_number" => ""
201
-    	);
202
-
203
-    	// Test URL
204
-    	$result='';
205
-    	$parameters = array('authentication'=>$authentication, 'thirdparty'=>$body);
206
-    	print __METHOD__." call method ".$WS_METHOD."\n";
207
-    	try {
208
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,'');
209
-    	} catch(SoapFault $exception) {
210
-    		echo $exception;
211
-    		$result=0;
212
-    	}
213
-    	if (! $result || ! empty($result['faultstring'])) {
214
-    		//var_dump($soapclient);
215
-    		print $this->soapclient->error_str;
216
-    		print "\n<br>\n";
217
-    		print $this->soapclient->request;
218
-    		print "\n<br>\n";
219
-    		print $this->soapclient->response;
220
-    		print "\n";
221
-    	}
222
-
223
-    	print __METHOD__." result=".$result['result']['result_code']."\n";
224
-    	$this->assertEquals('OK',$result['result']['result_code']);
225
-    	$this->assertEquals('name',$result['ref']);
226
-
227
-    	return $result;
148
+        global $conf,$user,$langs,$db;
149
+        $conf=$this->savconf;
150
+        $user=$this->savuser;
151
+        $langs=$this->savlangs;
152
+        $db=$this->savdb;
153
+
154
+        $WS_METHOD  = 'createThirdParty';
155
+
156
+
157
+        // Call the WebService method and store its result in $result.
158
+        $authentication=array(
159
+                'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
160
+                'sourceapplication'=>'DEMO',
161
+                'login'=>'admin',
162
+                'password'=>'admin',
163
+                'entity'=>'');
164
+
165
+        $body = array (
166
+                "id" => null,
167
+                "ref" => "name",
168
+                "ref_ext" => "12",
169
+                "fk_user_author" => null,
170
+                "status" => null,
171
+                "client" => 1,
172
+                "supplier" => 0,
173
+                "customer_code" => "CU0901-5678",
174
+                "supplier_code" => "SU0901-5678",
175
+                "customer_code_accountancy" => "",
176
+                "supplier_code_accountancy" => "",
177
+                "date_creation" => "", // dateTime
178
+                "date_modification" => "", // dateTime
179
+                "note_private" => "",
180
+                "note_public" => "",
181
+                "address" => "",
182
+                "zip" => "",
183
+                "town" => "",
184
+                "province_id" => "",
185
+                "country_id" => "",
186
+                "country_code" => "",
187
+                "country" => "",
188
+                "phone" => "",
189
+                "fax" => "",
190
+                "email" => "",
191
+                "url" => "",
192
+                "profid1" => "",
193
+                "profid2" => "",
194
+                "profid3" => "",
195
+                "profid4" => "",
196
+                "profid5" => "",
197
+                "profid6" => "",
198
+                "capital" => "",
199
+                "vat_used" => "",
200
+                "vat_number" => ""
201
+        );
202
+
203
+        // Test URL
204
+        $result='';
205
+        $parameters = array('authentication'=>$authentication, 'thirdparty'=>$body);
206
+        print __METHOD__." call method ".$WS_METHOD."\n";
207
+        try {
208
+            $result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,'');
209
+        } catch(SoapFault $exception) {
210
+            echo $exception;
211
+            $result=0;
212
+        }
213
+        if (! $result || ! empty($result['faultstring'])) {
214
+            //var_dump($soapclient);
215
+            print $this->soapclient->error_str;
216
+            print "\n<br>\n";
217
+            print $this->soapclient->request;
218
+            print "\n<br>\n";
219
+            print $this->soapclient->response;
220
+            print "\n";
221
+        }
222
+
223
+        print __METHOD__." result=".$result['result']['result_code']."\n";
224
+        $this->assertEquals('OK',$result['result']['result_code']);
225
+        $this->assertEquals('name',$result['ref']);
226
+
227
+        return $result;
228 228
     }
229 229
 
230 230
     /**
@@ -292,62 +292,62 @@  discard block
 block discarded – undo
292 292
      *
293 293
      * Use ref_ext to retrieve thirdparty
294 294
      *
295
-	 * @depends testWSThirdpartycreateThirdParty
296
-	 *
295
+     * @depends testWSThirdpartycreateThirdParty
296
+     *
297 297
      * @param	array	$result		thirdparty created by create method
298 298
      * @return	array				thirdparty
299 299
      */
300 300
     public function testWSThirdpartygetThirdPartyByRefExt($result)
301 301
     {
302
-    	global $conf,$user,$langs,$db;
303
-    	$conf=$this->savconf;
304
-    	$user=$this->savuser;
305
-    	$langs=$this->savlangs;
306
-    	$db=$this->savdb;
307
-    	$id = $result['id'];
308
-
309
-    	$WS_METHOD  = 'getThirdParty';
310
-
311
-    	// Call the WebService method and store its result in $result.
312
-    	$authentication=array(
313
-    			'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
314
-    			'sourceapplication'=>'DEMO',
315
-    			'login'=>'admin',
316
-    			'password'=>'admin',
317
-    			'entity'=>'');
318
-
319
-    	// Test URL
320
-    	$result='';
321
-    	$parameters = array('authentication'=>$authentication, 'id'=>'', 'ref'=>'', 'ref_ext'=>'12');
322
-    	print __METHOD__." call method ".$WS_METHOD."\n";
323
-    	try {
324
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->_ns,'');
325
-    	} catch(SoapFault $exception) {
326
-    		echo $exception;
327
-    		$result=0;
328
-    	}
329
-    	print $this->soapclient->response;
330
-    	if (! $result || ! empty($result['faultstring'])) {
331
-    		//var_dump($soapclient);
332
-    		print $this->soapclient->error_str;
333
-    		print "\n<br>\n";
334
-    		print $this->soapclient->request;
335
-    		print "\n<br>\n";
336
-    		print $this->soapclient->response;
337
-    		print "\n";
338
-    	}
339
-
340
-    	print __METHOD__." result=".$result['result']['result_code']."\n";
341
-    	$this->assertEquals('OK',$result['result']['result_code']);
342
-    	$this->assertEquals($id, $result['thirdparty']['id']);
343
-    	$this->assertEquals('name', $result['thirdparty']['ref']);
344
-    	$this->assertEquals('12', $result['thirdparty']['ref_ext']);
345
-    	$this->assertEquals('0', $result['thirdparty']['status']);
346
-    	$this->assertEquals('1', $result['thirdparty']['client']);
347
-    	$this->assertEquals('0', $result['thirdparty']['supplier']);
348
-
349
-
350
-    	return $result;
302
+        global $conf,$user,$langs,$db;
303
+        $conf=$this->savconf;
304
+        $user=$this->savuser;
305
+        $langs=$this->savlangs;
306
+        $db=$this->savdb;
307
+        $id = $result['id'];
308
+
309
+        $WS_METHOD  = 'getThirdParty';
310
+
311
+        // Call the WebService method and store its result in $result.
312
+        $authentication=array(
313
+                'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
314
+                'sourceapplication'=>'DEMO',
315
+                'login'=>'admin',
316
+                'password'=>'admin',
317
+                'entity'=>'');
318
+
319
+        // Test URL
320
+        $result='';
321
+        $parameters = array('authentication'=>$authentication, 'id'=>'', 'ref'=>'', 'ref_ext'=>'12');
322
+        print __METHOD__." call method ".$WS_METHOD."\n";
323
+        try {
324
+            $result = $this->soapclient->call($WS_METHOD,$parameters,$this->_ns,'');
325
+        } catch(SoapFault $exception) {
326
+            echo $exception;
327
+            $result=0;
328
+        }
329
+        print $this->soapclient->response;
330
+        if (! $result || ! empty($result['faultstring'])) {
331
+            //var_dump($soapclient);
332
+            print $this->soapclient->error_str;
333
+            print "\n<br>\n";
334
+            print $this->soapclient->request;
335
+            print "\n<br>\n";
336
+            print $this->soapclient->response;
337
+            print "\n";
338
+        }
339
+
340
+        print __METHOD__." result=".$result['result']['result_code']."\n";
341
+        $this->assertEquals('OK',$result['result']['result_code']);
342
+        $this->assertEquals($id, $result['thirdparty']['id']);
343
+        $this->assertEquals('name', $result['thirdparty']['ref']);
344
+        $this->assertEquals('12', $result['thirdparty']['ref_ext']);
345
+        $this->assertEquals('0', $result['thirdparty']['status']);
346
+        $this->assertEquals('1', $result['thirdparty']['client']);
347
+        $this->assertEquals('0', $result['thirdparty']['supplier']);
348
+
349
+
350
+        return $result;
351 351
     }
352 352
 
353 353
     /**
@@ -360,44 +360,44 @@  discard block
 block discarded – undo
360 360
      */
361 361
     public function testWSThirdpartydeleteThirdPartyById($result)
362 362
     {
363
-    	global $conf,$user,$langs,$db;
364
-    	$conf=$this->savconf;
365
-    	$user=$this->savuser;
366
-    	$langs=$this->savlangs;
367
-    	$db=$this->savdb;
368
-    	$id = $result['id'];
369
-
370
-    	$WS_METHOD  = 'deleteThirdParty';
371
-
372
-    	// Call the WebService method and store its result in $result.
373
-    	$authentication=array(
374
-    			'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
375
-    			'sourceapplication'=>'DEMO',
376
-    			'login'=>'admin',
377
-    			'password'=>'admin',
378
-    			'entity'=>'');
379
-
380
-    	$result='';
381
-    	$parameters = array('authentication'=>$authentication, 'id'=>$id, 'ref'=>'', 'ref_ext'=>'');
382
-    	print __METHOD__." call method ".$WS_METHOD."\n";
383
-    	try {
384
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->_ns,'');
385
-    	} catch(SoapFault $exception) {
386
-    		echo $exception;
387
-    		$result=0;
388
-    	}
389
-    	if (! $result || ! empty($result['faultstring'])) {
390
-    		print $this->soapclient->error_str;
391
-    		print "\n<br>\n";
392
-    		print $this->soapclient->request;
393
-    		print "\n<br>\n";
394
-    		print $this->soapclient->response;
395
-    		print "\n";
396
-    	}
397
-
398
-    	print __METHOD__." result=".$result['result']['result_code']."\n";
399
-    	$this->assertEquals('OK',$result['result']['result_code']);
400
-
401
-    	return $result;
363
+        global $conf,$user,$langs,$db;
364
+        $conf=$this->savconf;
365
+        $user=$this->savuser;
366
+        $langs=$this->savlangs;
367
+        $db=$this->savdb;
368
+        $id = $result['id'];
369
+
370
+        $WS_METHOD  = 'deleteThirdParty';
371
+
372
+        // Call the WebService method and store its result in $result.
373
+        $authentication=array(
374
+                'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
375
+                'sourceapplication'=>'DEMO',
376
+                'login'=>'admin',
377
+                'password'=>'admin',
378
+                'entity'=>'');
379
+
380
+        $result='';
381
+        $parameters = array('authentication'=>$authentication, 'id'=>$id, 'ref'=>'', 'ref_ext'=>'');
382
+        print __METHOD__." call method ".$WS_METHOD."\n";
383
+        try {
384
+            $result = $this->soapclient->call($WS_METHOD,$parameters,$this->_ns,'');
385
+        } catch(SoapFault $exception) {
386
+            echo $exception;
387
+            $result=0;
388
+        }
389
+        if (! $result || ! empty($result['faultstring'])) {
390
+            print $this->soapclient->error_str;
391
+            print "\n<br>\n";
392
+            print $this->soapclient->request;
393
+            print "\n<br>\n";
394
+            print $this->soapclient->response;
395
+            print "\n";
396
+        }
397
+
398
+        print __METHOD__." result=".$result['result']['result_code']."\n";
399
+        $this->assertEquals('OK',$result['result']['result_code']);
400
+
401
+        return $result;
402 402
     }
403 403
 }
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
  *      \remarks    To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
30 30
 require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php';
31
-require_once NUSOAP_PATH.'/nusoap.php';        // Include SOAP
31
+require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
32 32
 
33 33
 
34 34
 if (empty($user->id)) {
@@ -36,9 +36,9 @@  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
-$conf->global->MAIN_UMASK='0666';
41
+$conf->global->MAIN_UMASK = '0666';
42 42
 
43 43
 
44 44
 /**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     protected $soapclient;
58 58
 
59 59
     private $_WS_DOL_URL;
60
-    private $_ns='http://www.dolibarr.org/ns/';
60
+    private $_ns = 'http://www.dolibarr.org/ns/';
61 61
 
62 62
 
63 63
 
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
     	parent::__construct();
74 74
 
75 75
     	//$this->sharedFixture
76
-        global $conf,$user,$langs,$db;
77
-        $this->savconf=$conf;
78
-        $this->savuser=$user;
79
-        $this->savlangs=$langs;
80
-        $this->savdb=$db;
76
+        global $conf, $user, $langs, $db;
77
+        $this->savconf = $conf;
78
+        $this->savuser = $user;
79
+        $this->savlangs = $langs;
80
+        $this->savdb = $db;
81 81
 
82 82
         $this->_WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php';
83 83
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         print __METHOD__." create nusoap_client for URL=".$this->_WS_DOL_URL."\n";
86 86
         $this->soapclient = new nusoap_client($this->_WS_DOL_URL);
87 87
         if ($this->soapclient) {
88
-        	$this->soapclient->soap_defencoding='UTF-8';
88
+        	$this->soapclient->soap_defencoding = 'UTF-8';
89 89
         	$this->soapclient->decodeUTF8(false);
90 90
         }
91 91
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
     // Static methods
98 98
     public static function setUpBeforeClass()
99 99
     {
100
-        global $conf,$user,$langs,$db;
101
-        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
100
+        global $conf, $user, $langs, $db;
101
+        $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
102 102
 
103 103
         print __METHOD__."\n";
104 104
     }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     // tear down after class
107 107
     public static function tearDownAfterClass()
108 108
     {
109
-        global $conf,$user,$langs,$db;
109
+        global $conf, $user, $langs, $db;
110 110
         $db->rollback();
111 111
 
112 112
         print __METHOD__."\n";
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
      */
120 120
     protected function setUp()
121 121
     {
122
-        global $conf,$user,$langs,$db;
123
-        $conf=$this->savconf;
124
-        $user=$this->savuser;
125
-        $langs=$this->savlangs;
126
-        $db=$this->savdb;
122
+        global $conf, $user, $langs, $db;
123
+        $conf = $this->savconf;
124
+        $user = $this->savuser;
125
+        $langs = $this->savlangs;
126
+        $db = $this->savdb;
127 127
 
128 128
         print __METHOD__."\n";
129 129
     }
@@ -145,24 +145,24 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function testWSThirdpartycreateThirdParty()
147 147
     {
148
-    	global $conf,$user,$langs,$db;
149
-    	$conf=$this->savconf;
150
-    	$user=$this->savuser;
151
-    	$langs=$this->savlangs;
152
-    	$db=$this->savdb;
148
+    	global $conf, $user, $langs, $db;
149
+    	$conf = $this->savconf;
150
+    	$user = $this->savuser;
151
+    	$langs = $this->savlangs;
152
+    	$db = $this->savdb;
153 153
 
154
-    	$WS_METHOD  = 'createThirdParty';
154
+    	$WS_METHOD = 'createThirdParty';
155 155
 
156 156
 
157 157
     	// Call the WebService method and store its result in $result.
158
-    	$authentication=array(
158
+    	$authentication = array(
159 159
     			'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
160 160
     			'sourceapplication'=>'DEMO',
161 161
     			'login'=>'admin',
162 162
     			'password'=>'admin',
163 163
     			'entity'=>'');
164 164
 
165
-    	$body = array (
165
+    	$body = array(
166 166
     			"id" => null,
167 167
     			"ref" => "name",
168 168
     			"ref_ext" => "12",
@@ -201,16 +201,16 @@  discard block
 block discarded – undo
201 201
     	);
202 202
 
203 203
     	// Test URL
204
-    	$result='';
204
+    	$result = '';
205 205
     	$parameters = array('authentication'=>$authentication, 'thirdparty'=>$body);
206 206
     	print __METHOD__." call method ".$WS_METHOD."\n";
207 207
     	try {
208
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->ns,'');
209
-    	} catch(SoapFault $exception) {
208
+    		$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
209
+    	} catch (SoapFault $exception) {
210 210
     		echo $exception;
211
-    		$result=0;
211
+    		$result = 0;
212 212
     	}
213
-    	if (! $result || ! empty($result['faultstring'])) {
213
+    	if (!$result || !empty($result['faultstring'])) {
214 214
     		//var_dump($soapclient);
215 215
     		print $this->soapclient->error_str;
216 216
     		print "\n<br>\n";
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
     	}
222 222
 
223 223
     	print __METHOD__." result=".$result['result']['result_code']."\n";
224
-    	$this->assertEquals('OK',$result['result']['result_code']);
225
-    	$this->assertEquals('name',$result['ref']);
224
+    	$this->assertEquals('OK', $result['result']['result_code']);
225
+    	$this->assertEquals('name', $result['ref']);
226 226
 
227 227
     	return $result;
228 228
     }
@@ -238,33 +238,33 @@  discard block
 block discarded – undo
238 238
      */
239 239
     public function testWSThirdpartygetThirdPartyById($result)
240 240
     {
241
-        global $conf,$user,$langs,$db;
242
-        $conf=$this->savconf;
243
-        $user=$this->savuser;
244
-        $langs=$this->savlangs;
245
-        $db=$this->savdb;
241
+        global $conf, $user, $langs, $db;
242
+        $conf = $this->savconf;
243
+        $user = $this->savuser;
244
+        $langs = $this->savlangs;
245
+        $db = $this->savdb;
246 246
         $id = $result['id'];
247 247
 
248
-        $WS_METHOD  = 'getThirdParty';
248
+        $WS_METHOD = 'getThirdParty';
249 249
 
250 250
         // Call the WebService method and store its result in $result.
251
-        $authentication=array(
251
+        $authentication = array(
252 252
         'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
253 253
         'sourceapplication'=>'DEMO',
254 254
         'login'=>'admin',
255 255
         'password'=>'admin',
256 256
         'entity'=>'');
257 257
 
258
-        $result='';
258
+        $result = '';
259 259
         $parameters = array('authentication'=>$authentication, 'id'=>$id);
260 260
         print __METHOD__." call method ".$WS_METHOD."\n";
261 261
         try {
262
-            $result = $this->soapclient->call($WS_METHOD,$parameters,$this->_ns,'');
263
-        } catch(SoapFault $exception) {
262
+            $result = $this->soapclient->call($WS_METHOD, $parameters, $this->_ns, '');
263
+        } catch (SoapFault $exception) {
264 264
             echo $exception;
265
-            $result=0;
265
+            $result = 0;
266 266
         }
267
-        if (! $result || ! empty($result['faultstring'])) {
267
+        if (!$result || !empty($result['faultstring'])) {
268 268
             //var_dump($soapclient);
269 269
             print $this->soapclient->error_str;
270 270
             print "\n<br>\n";
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         }
276 276
 
277 277
         print __METHOD__." result=".$result['result']['result_code']."\n";
278
-        $this->assertEquals('OK',$result['result']['result_code']);
278
+        $this->assertEquals('OK', $result['result']['result_code']);
279 279
         $this->assertEquals($id, $result['thirdparty']['id']);
280 280
         $this->assertEquals('name', $result['thirdparty']['ref']);
281 281
         $this->assertEquals('12', $result['thirdparty']['ref_ext']);
@@ -299,17 +299,17 @@  discard block
 block discarded – undo
299 299
      */
300 300
     public function testWSThirdpartygetThirdPartyByRefExt($result)
301 301
     {
302
-    	global $conf,$user,$langs,$db;
303
-    	$conf=$this->savconf;
304
-    	$user=$this->savuser;
305
-    	$langs=$this->savlangs;
306
-    	$db=$this->savdb;
302
+    	global $conf, $user, $langs, $db;
303
+    	$conf = $this->savconf;
304
+    	$user = $this->savuser;
305
+    	$langs = $this->savlangs;
306
+    	$db = $this->savdb;
307 307
     	$id = $result['id'];
308 308
 
309
-    	$WS_METHOD  = 'getThirdParty';
309
+    	$WS_METHOD = 'getThirdParty';
310 310
 
311 311
     	// Call the WebService method and store its result in $result.
312
-    	$authentication=array(
312
+    	$authentication = array(
313 313
     			'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
314 314
     			'sourceapplication'=>'DEMO',
315 315
     			'login'=>'admin',
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
     			'entity'=>'');
318 318
 
319 319
     	// Test URL
320
-    	$result='';
320
+    	$result = '';
321 321
     	$parameters = array('authentication'=>$authentication, 'id'=>'', 'ref'=>'', 'ref_ext'=>'12');
322 322
     	print __METHOD__." call method ".$WS_METHOD."\n";
323 323
     	try {
324
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->_ns,'');
325
-    	} catch(SoapFault $exception) {
324
+    		$result = $this->soapclient->call($WS_METHOD, $parameters, $this->_ns, '');
325
+    	} catch (SoapFault $exception) {
326 326
     		echo $exception;
327
-    		$result=0;
327
+    		$result = 0;
328 328
     	}
329 329
     	print $this->soapclient->response;
330
-    	if (! $result || ! empty($result['faultstring'])) {
330
+    	if (!$result || !empty($result['faultstring'])) {
331 331
     		//var_dump($soapclient);
332 332
     		print $this->soapclient->error_str;
333 333
     		print "\n<br>\n";
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
     	}
339 339
 
340 340
     	print __METHOD__." result=".$result['result']['result_code']."\n";
341
-    	$this->assertEquals('OK',$result['result']['result_code']);
341
+    	$this->assertEquals('OK', $result['result']['result_code']);
342 342
     	$this->assertEquals($id, $result['thirdparty']['id']);
343 343
     	$this->assertEquals('name', $result['thirdparty']['ref']);
344 344
     	$this->assertEquals('12', $result['thirdparty']['ref_ext']);
@@ -360,33 +360,33 @@  discard block
 block discarded – undo
360 360
      */
361 361
     public function testWSThirdpartydeleteThirdPartyById($result)
362 362
     {
363
-    	global $conf,$user,$langs,$db;
364
-    	$conf=$this->savconf;
365
-    	$user=$this->savuser;
366
-    	$langs=$this->savlangs;
367
-    	$db=$this->savdb;
363
+    	global $conf, $user, $langs, $db;
364
+    	$conf = $this->savconf;
365
+    	$user = $this->savuser;
366
+    	$langs = $this->savlangs;
367
+    	$db = $this->savdb;
368 368
     	$id = $result['id'];
369 369
 
370
-    	$WS_METHOD  = 'deleteThirdParty';
370
+    	$WS_METHOD = 'deleteThirdParty';
371 371
 
372 372
     	// Call the WebService method and store its result in $result.
373
-    	$authentication=array(
373
+    	$authentication = array(
374 374
     			'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
375 375
     			'sourceapplication'=>'DEMO',
376 376
     			'login'=>'admin',
377 377
     			'password'=>'admin',
378 378
     			'entity'=>'');
379 379
 
380
-    	$result='';
380
+    	$result = '';
381 381
     	$parameters = array('authentication'=>$authentication, 'id'=>$id, 'ref'=>'', 'ref_ext'=>'');
382 382
     	print __METHOD__." call method ".$WS_METHOD."\n";
383 383
     	try {
384
-    		$result = $this->soapclient->call($WS_METHOD,$parameters,$this->_ns,'');
385
-    	} catch(SoapFault $exception) {
384
+    		$result = $this->soapclient->call($WS_METHOD, $parameters, $this->_ns, '');
385
+    	} catch (SoapFault $exception) {
386 386
     		echo $exception;
387
-    		$result=0;
387
+    		$result = 0;
388 388
     	}
389
-    	if (! $result || ! empty($result['faultstring'])) {
389
+    	if (!$result || !empty($result['faultstring'])) {
390 390
     		print $this->soapclient->error_str;
391 391
     		print "\n<br>\n";
392 392
     		print $this->soapclient->request;
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
     	}
397 397
 
398 398
     	print __METHOD__." result=".$result['result']['result_code']."\n";
399
-    	$this->assertEquals('OK',$result['result']['result_code']);
399
+    	$this->assertEquals('OK', $result['result']['result_code']);
400 400
 
401 401
     	return $result;
402 402
     }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/LangTest.php 3 patches
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -59,75 +59,75 @@  discard block
 block discarded – undo
59 59
  */
60 60
 class LangTest extends PHPUnit_Framework_TestCase
61 61
 {
62
-	protected $savconf;
63
-	protected $savuser;
64
-	protected $savlangs;
65
-	protected $savdb;
66
-
67
-	/**
68
-	 * Constructor
69
-	 * We save global variables into local variables
70
-	 *
71
-	 * @return SecurityTest
72
-	 */
73
-	function __construct()
74
-	{
75
-		parent::__construct();
76
-
77
-		//$this->sharedFixture
78
-		global $conf,$user,$langs,$db;
79
-		$this->savconf=$conf;
80
-		$this->savuser=$user;
81
-		$this->savlangs=$langs;
82
-		$this->savdb=$db;
83
-
84
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
85
-		//print " - db ".$db->db;
86
-		print "\n";
87
-	}
88
-
89
-	// Static methods
90
-  	public static function setUpBeforeClass()
62
+    protected $savconf;
63
+    protected $savuser;
64
+    protected $savlangs;
65
+    protected $savdb;
66
+
67
+    /**
68
+     * Constructor
69
+     * We save global variables into local variables
70
+     *
71
+     * @return SecurityTest
72
+     */
73
+    function __construct()
74
+    {
75
+        parent::__construct();
76
+
77
+        //$this->sharedFixture
78
+        global $conf,$user,$langs,$db;
79
+        $this->savconf=$conf;
80
+        $this->savuser=$user;
81
+        $this->savlangs=$langs;
82
+        $this->savdb=$db;
83
+
84
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
85
+        //print " - db ".$db->db;
86
+        print "\n";
87
+    }
88
+
89
+    // Static methods
90
+        public static function setUpBeforeClass()
91 91
     {
92
-    	global $conf,$user,$langs,$db;
93
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
92
+        global $conf,$user,$langs,$db;
93
+        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
94 94
 
95
-    	print __METHOD__."\n";
95
+        print __METHOD__."\n";
96 96
     }
97 97
 
98 98
     // tear down after class
99 99
     public static function tearDownAfterClass()
100 100
     {
101
-    	global $conf,$user,$langs,$db;
102
-		$db->rollback();
101
+        global $conf,$user,$langs,$db;
102
+        $db->rollback();
103 103
 
104
-		print __METHOD__."\n";
104
+        print __METHOD__."\n";
105 105
     }
106 106
 
107
-	/**
108
-	 * Init phpunit tests
109
-	 *
110
-	 * @return	void
111
-	 */
107
+    /**
108
+     * Init phpunit tests
109
+     *
110
+     * @return	void
111
+     */
112 112
     protected function setUp()
113 113
     {
114
-    	global $conf,$user,$langs,$db;
115
-		$conf=$this->savconf;
116
-		$user=$this->savuser;
117
-		$langs=$this->savlangs;
118
-		$db=$this->savdb;
114
+        global $conf,$user,$langs,$db;
115
+        $conf=$this->savconf;
116
+        $user=$this->savuser;
117
+        $langs=$this->savlangs;
118
+        $db=$this->savdb;
119 119
 
120
-		print __METHOD__."\n";
120
+        print __METHOD__."\n";
121 121
     }
122 122
 
123
-	/**
124
-	 * End phpunit tests
125
-	 *
126
-	 * @return	void
127
-	 */
123
+    /**
124
+     * End phpunit tests
125
+     *
126
+     * @return	void
127
+     */
128 128
     protected function tearDown()
129 129
     {
130
-    	print __METHOD__."\n";
130
+        print __METHOD__."\n";
131 131
     }
132 132
 
133 133
     /**
@@ -137,43 +137,43 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function testLang()
139 139
     {
140
-    	global $conf,$user,$langs,$db;
141
-		$conf=$this->savconf;
142
-		$user=$this->savuser;
143
-		$langs=$this->savlangs;
144
-		$db=$this->savdb;
140
+        global $conf,$user,$langs,$db;
141
+        $conf=$this->savconf;
142
+        $user=$this->savuser;
143
+        $langs=$this->savlangs;
144
+        $db=$this->savdb;
145 145
 
146 146
         include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
147 147
 
148
-		$filesarray = scandir(DOL_DOCUMENT_ROOT.'/langs');
149
-		foreach($filesarray as $key => $code)
150
-		{
151
-			if (! preg_match('/^[a-z]+_[A-Z]+$/',$code)) continue;
152
-
153
-			print 'Check language file for lang code='.$code."\n";
154
-			$tmplangs=new Translate('',$conf);
155
-    		$langcode=$code;
156
-        	$tmplangs->setDefaultLang($langcode);
157
-			$tmplangs->load("main");
158
-
159
-			$result=$tmplangs->transnoentitiesnoconv("SeparatorDecimal");
160
-			print __METHOD__." SeparatorDecimal=".$result."\n";
161
-			$this->assertContains($result,array('.',',','/',' ','','None'), 'Error for decimal separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
162
-
163
-			$result=$tmplangs->transnoentitiesnoconv("SeparatorThousand");
164
-			print __METHOD__." SeparatorThousand=".$result."\n";
165
-			$this->assertContains($result, array('.',',','/',' ','','\'','None','Space'), 'Error for thousand separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
166
-
167
-			// Test java string contains only d,M,y,/,-,. and not m,...
168
-			$result=$tmplangs->transnoentitiesnoconv("FormatDateShortJava");
169
-			print __METHOD__." FormatDateShortJava=".$result."\n";
170
-			$this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJava KO for lang code '.$code);
171
-			$result=$tmplangs->trans("FormatDateShortJavaInput");
172
-			print __METHOD__." FormatDateShortJavaInput=".$result."\n";
173
-			$this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJavaInput KO for lang code '.$code);
174
-
175
-			unset($tmplangs);
176
-		}
148
+        $filesarray = scandir(DOL_DOCUMENT_ROOT.'/langs');
149
+        foreach($filesarray as $key => $code)
150
+        {
151
+            if (! preg_match('/^[a-z]+_[A-Z]+$/',$code)) continue;
152
+
153
+            print 'Check language file for lang code='.$code."\n";
154
+            $tmplangs=new Translate('',$conf);
155
+            $langcode=$code;
156
+            $tmplangs->setDefaultLang($langcode);
157
+            $tmplangs->load("main");
158
+
159
+            $result=$tmplangs->transnoentitiesnoconv("SeparatorDecimal");
160
+            print __METHOD__." SeparatorDecimal=".$result."\n";
161
+            $this->assertContains($result,array('.',',','/',' ','','None'), 'Error for decimal separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
162
+
163
+            $result=$tmplangs->transnoentitiesnoconv("SeparatorThousand");
164
+            print __METHOD__." SeparatorThousand=".$result."\n";
165
+            $this->assertContains($result, array('.',',','/',' ','','\'','None','Space'), 'Error for thousand separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
166
+
167
+            // Test java string contains only d,M,y,/,-,. and not m,...
168
+            $result=$tmplangs->transnoentitiesnoconv("FormatDateShortJava");
169
+            print __METHOD__." FormatDateShortJava=".$result."\n";
170
+            $this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJava KO for lang code '.$code);
171
+            $result=$tmplangs->trans("FormatDateShortJavaInput");
172
+            print __METHOD__." FormatDateShortJavaInput=".$result."\n";
173
+            $this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJavaInput KO for lang code '.$code);
174
+
175
+            unset($tmplangs);
176
+        }
177 177
 
178 178
         return;
179 179
     }
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -23,23 +23,23 @@  discard block
 block discarded – undo
23 23
  *		\remarks	To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
30 30
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php';
31 31
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php';
32 32
 
33
-if (! defined('NOREQUIREUSER'))  define('NOREQUIREUSER','1');
34
-if (! defined('NOREQUIREDB'))    define('NOREQUIREDB','1');
35
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
36
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
37
-if (! defined('NOCSRFCHECK'))    define('NOCSRFCHECK','1');
38
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
39
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1'); // If there is no menu to show
40
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
41
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
42
-if (! defined("NOLOGIN"))        define("NOLOGIN",'1');       // If this page is public (can be called outside logged session)
33
+if (!defined('NOREQUIREUSER'))  define('NOREQUIREUSER', '1');
34
+if (!defined('NOREQUIREDB'))    define('NOREQUIREDB', '1');
35
+if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
36
+if (!defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
37
+if (!defined('NOCSRFCHECK'))    define('NOCSRFCHECK', '1');
38
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
39
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1'); // If there is no menu to show
40
+if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
41
+if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
42
+if (!defined("NOLOGIN"))        define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
43 43
 
44 44
 if (empty($user->id))
45 45
 {
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     $user->fetch(1);
48 48
     $user->getrights();
49 49
 }
50
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
50
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
51 51
 
52 52
 
53 53
 /**
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 		parent::__construct();
76 76
 
77 77
 		//$this->sharedFixture
78
-		global $conf,$user,$langs,$db;
79
-		$this->savconf=$conf;
80
-		$this->savuser=$user;
81
-		$this->savlangs=$langs;
82
-		$this->savdb=$db;
78
+		global $conf, $user, $langs, $db;
79
+		$this->savconf = $conf;
80
+		$this->savuser = $user;
81
+		$this->savlangs = $langs;
82
+		$this->savdb = $db;
83 83
 
84 84
 		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
85 85
 		//print " - db ".$db->db;
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 	// Static methods
90 90
   	public static function setUpBeforeClass()
91 91
     {
92
-    	global $conf,$user,$langs,$db;
93
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
92
+    	global $conf, $user, $langs, $db;
93
+		$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
94 94
 
95 95
     	print __METHOD__."\n";
96 96
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     // tear down after class
99 99
     public static function tearDownAfterClass()
100 100
     {
101
-    	global $conf,$user,$langs,$db;
101
+    	global $conf, $user, $langs, $db;
102 102
 		$db->rollback();
103 103
 
104 104
 		print __METHOD__."\n";
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
     protected function setUp()
113 113
     {
114
-    	global $conf,$user,$langs,$db;
115
-		$conf=$this->savconf;
116
-		$user=$this->savuser;
117
-		$langs=$this->savlangs;
118
-		$db=$this->savdb;
114
+    	global $conf, $user, $langs, $db;
115
+		$conf = $this->savconf;
116
+		$user = $this->savuser;
117
+		$langs = $this->savlangs;
118
+		$db = $this->savdb;
119 119
 
120 120
 		print __METHOD__."\n";
121 121
     }
@@ -137,40 +137,40 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function testLang()
139 139
     {
140
-    	global $conf,$user,$langs,$db;
141
-		$conf=$this->savconf;
142
-		$user=$this->savuser;
143
-		$langs=$this->savlangs;
144
-		$db=$this->savdb;
140
+    	global $conf, $user, $langs, $db;
141
+		$conf = $this->savconf;
142
+		$user = $this->savuser;
143
+		$langs = $this->savlangs;
144
+		$db = $this->savdb;
145 145
 
146 146
         include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
147 147
 
148 148
 		$filesarray = scandir(DOL_DOCUMENT_ROOT.'/langs');
149
-		foreach($filesarray as $key => $code)
149
+		foreach ($filesarray as $key => $code)
150 150
 		{
151
-			if (! preg_match('/^[a-z]+_[A-Z]+$/',$code)) continue;
151
+			if (!preg_match('/^[a-z]+_[A-Z]+$/', $code)) continue;
152 152
 
153 153
 			print 'Check language file for lang code='.$code."\n";
154
-			$tmplangs=new Translate('',$conf);
155
-    		$langcode=$code;
154
+			$tmplangs = new Translate('', $conf);
155
+    		$langcode = $code;
156 156
         	$tmplangs->setDefaultLang($langcode);
157 157
 			$tmplangs->load("main");
158 158
 
159
-			$result=$tmplangs->transnoentitiesnoconv("SeparatorDecimal");
159
+			$result = $tmplangs->transnoentitiesnoconv("SeparatorDecimal");
160 160
 			print __METHOD__." SeparatorDecimal=".$result."\n";
161
-			$this->assertContains($result,array('.',',','/',' ','','None'), 'Error for decimal separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
161
+			$this->assertContains($result, array('.', ',', '/', ' ', '', 'None'), 'Error for decimal separator for lang code '.$code); // Note that ، that is coma for RTL languages is not supported
162 162
 
163
-			$result=$tmplangs->transnoentitiesnoconv("SeparatorThousand");
163
+			$result = $tmplangs->transnoentitiesnoconv("SeparatorThousand");
164 164
 			print __METHOD__." SeparatorThousand=".$result."\n";
165
-			$this->assertContains($result, array('.',',','/',' ','','\'','None','Space'), 'Error for thousand separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
165
+			$this->assertContains($result, array('.', ',', '/', ' ', '', '\'', 'None', 'Space'), 'Error for thousand separator for lang code '.$code); // Note that ، that is coma for RTL languages is not supported
166 166
 
167 167
 			// Test java string contains only d,M,y,/,-,. and not m,...
168
-			$result=$tmplangs->transnoentitiesnoconv("FormatDateShortJava");
168
+			$result = $tmplangs->transnoentitiesnoconv("FormatDateShortJava");
169 169
 			print __METHOD__." FormatDateShortJava=".$result."\n";
170
-			$this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJava KO for lang code '.$code);
171
-			$result=$tmplangs->trans("FormatDateShortJavaInput");
170
+			$this->assertRegExp('/^[dMy\/\-\.]+$/', $result, 'FormatDateShortJava KO for lang code '.$code);
171
+			$result = $tmplangs->trans("FormatDateShortJavaInput");
172 172
 			print __METHOD__." FormatDateShortJavaInput=".$result."\n";
173
-			$this->assertRegExp('/^[dMy\/\-\.]+$/',$result,'FormatDateShortJavaInput KO for lang code '.$code);
173
+			$this->assertRegExp('/^[dMy\/\-\.]+$/', $result, 'FormatDateShortJavaInput KO for lang code '.$code);
174 174
 
175 175
 			unset($tmplangs);
176 176
 		}
Please login to merge, or discard this patch.
Braces   +36 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,16 +30,39 @@  discard block
 block discarded – undo
30 30
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php';
31 31
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php';
32 32
 
33
-if (! defined('NOREQUIREUSER'))  define('NOREQUIREUSER','1');
34
-if (! defined('NOREQUIREDB'))    define('NOREQUIREDB','1');
35
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
36
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
37
-if (! defined('NOCSRFCHECK'))    define('NOCSRFCHECK','1');
38
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
39
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1'); // If there is no menu to show
40
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
41
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
42
-if (! defined("NOLOGIN"))        define("NOLOGIN",'1');       // If this page is public (can be called outside logged session)
33
+if (! defined('NOREQUIREUSER')) {
34
+    define('NOREQUIREUSER','1');
35
+}
36
+if (! defined('NOREQUIREDB')) {
37
+    define('NOREQUIREDB','1');
38
+}
39
+if (! defined('NOREQUIRESOC')) {
40
+    define('NOREQUIRESOC','1');
41
+}
42
+if (! defined('NOREQUIRETRAN')) {
43
+    define('NOREQUIRETRAN','1');
44
+}
45
+if (! defined('NOCSRFCHECK')) {
46
+    define('NOCSRFCHECK','1');
47
+}
48
+if (! defined('NOTOKENRENEWAL')) {
49
+    define('NOTOKENRENEWAL','1');
50
+}
51
+if (! defined('NOREQUIREMENU')) {
52
+    define('NOREQUIREMENU','1');
53
+}
54
+// If there is no menu to show
55
+if (! defined('NOREQUIREHTML')) {
56
+    define('NOREQUIREHTML','1');
57
+}
58
+// If we don't need to load the html.form.class.php
59
+if (! defined('NOREQUIREAJAX')) {
60
+    define('NOREQUIREAJAX','1');
61
+}
62
+if (! defined("NOLOGIN")) {
63
+    define("NOLOGIN",'1');
64
+}
65
+// If this page is public (can be called outside logged session)
43 66
 
44 67
 if (empty($user->id))
45 68
 {
@@ -148,7 +171,9 @@  discard block
 block discarded – undo
148 171
 		$filesarray = scandir(DOL_DOCUMENT_ROOT.'/langs');
149 172
 		foreach($filesarray as $key => $code)
150 173
 		{
151
-			if (! preg_match('/^[a-z]+_[A-Z]+$/',$code)) continue;
174
+			if (! preg_match('/^[a-z]+_[A-Z]+$/',$code)) {
175
+			    continue;
176
+			}
152 177
 
153 178
 			print 'Check language file for lang code='.$code."\n";
154 179
 			$tmplangs=new Translate('',$conf);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/PaypalTest.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 if (empty($user->id))
34 34
 {
35
-	print "Load permissions for admin user nb 1\n";
36
-	$user->fetch(1);
37
-	$user->getrights();
35
+    print "Load permissions for admin user nb 1\n";
36
+    $user->fetch(1);
37
+    $user->getrights();
38 38
 }
39 39
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
40 40
 
@@ -48,78 +48,78 @@  discard block
 block discarded – undo
48 48
  */
49 49
 class PaypalTest extends PHPUnit_Framework_TestCase
50 50
 {
51
-	protected $savconf;
52
-	protected $savuser;
53
-	protected $savlangs;
54
-	protected $savdb;
55
-
56
-	/**
57
-	 * Constructor
58
-	 * We save global variables into local variables
59
-	 *
60
-	 * @return ProductTest
61
-	 */
62
-	function __construct()
63
-	{
64
-		parent::__construct();
65
-
66
-		//$this->sharedFixture
67
-		global $conf,$user,$langs,$db;
68
-		$this->savconf=$conf;
69
-		$this->savuser=$user;
70
-		$this->savlangs=$langs;
71
-		$this->savdb=$db;
72
-
73
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
74
-		//print " - db ".$db->db;
75
-		print "\n";
76
-	}
77
-
78
-	// Static methods
79
-  	public static function setUpBeforeClass()
51
+    protected $savconf;
52
+    protected $savuser;
53
+    protected $savlangs;
54
+    protected $savdb;
55
+
56
+    /**
57
+     * Constructor
58
+     * We save global variables into local variables
59
+     *
60
+     * @return ProductTest
61
+     */
62
+    function __construct()
80 63
     {
81
-    	global $conf,$user,$langs,$db;
64
+        parent::__construct();
65
+
66
+        //$this->sharedFixture
67
+        global $conf,$user,$langs,$db;
68
+        $this->savconf=$conf;
69
+        $this->savuser=$user;
70
+        $this->savlangs=$langs;
71
+        $this->savdb=$db;
72
+
73
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
74
+        //print " - db ".$db->db;
75
+        print "\n";
76
+    }
77
+
78
+    // Static methods
79
+        public static function setUpBeforeClass()
80
+    {
81
+        global $conf,$user,$langs,$db;
82 82
 
83
-    	if (empty($conf->paypal->enabled)) { print __METHOD__." Module Paypal must be enabled.\n"; die(); }
83
+        if (empty($conf->paypal->enabled)) { print __METHOD__." Module Paypal must be enabled.\n"; die(); }
84 84
 
85 85
         $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
86 86
 
87
-    	print __METHOD__."\n";
87
+        print __METHOD__."\n";
88 88
     }
89 89
 
90 90
     // tear down after class
91 91
     public static function tearDownAfterClass()
92 92
     {
93
-    	global $conf,$user,$langs,$db;
94
-		$db->rollback();
93
+        global $conf,$user,$langs,$db;
94
+        $db->rollback();
95 95
 
96
-		print __METHOD__."\n";
96
+        print __METHOD__."\n";
97 97
     }
98 98
 
99
-	/**
100
-	 * Init phpunit tests
101
-	 *
102
-	 * @return	void
103
-	 */
99
+    /**
100
+     * Init phpunit tests
101
+     *
102
+     * @return	void
103
+     */
104 104
     protected function setUp()
105 105
     {
106
-    	global $conf,$user,$langs,$db;
107
-		$conf=$this->savconf;
108
-		$user=$this->savuser;
109
-		$langs=$this->savlangs;
110
-		$db=$this->savdb;
106
+        global $conf,$user,$langs,$db;
107
+        $conf=$this->savconf;
108
+        $user=$this->savuser;
109
+        $langs=$this->savlangs;
110
+        $db=$this->savdb;
111 111
 
112
-		print __METHOD__."\n";
112
+        print __METHOD__."\n";
113 113
     }
114 114
 
115
-	/**
116
-	 * End phpunit tests
117
-	 *
118
-	 * @return	void
119
-	 */
115
+    /**
116
+     * End phpunit tests
117
+     *
118
+     * @return	void
119
+     */
120 120
     protected function tearDown()
121 121
     {
122
-    	print __METHOD__."\n";
122
+        print __METHOD__."\n";
123 123
     }
124 124
 
125 125
     /**
@@ -129,20 +129,20 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function testPaypalOk()
131 131
     {
132
-    	global $conf,$user,$langs,$db;
133
-		$conf=$this->savconf;
134
-		$user=$this->savuser;
135
-		$langs=$this->savlangs;
136
-		$db=$this->savdb;
132
+        global $conf,$user,$langs,$db;
133
+        $conf=$this->savconf;
134
+        $user=$this->savuser;
135
+        $langs=$this->savlangs;
136
+        $db=$this->savdb;
137 137
 
138
-		$urltotest=getPaypalPaymentUrl(1,'free');
139
-		print "urltotest=".$urltotest."\n";
138
+        $urltotest=getPaypalPaymentUrl(1,'free');
139
+        print "urltotest=".$urltotest."\n";
140 140
 
141
-		$result=getURLContent($urltotest, 'GET');
141
+        $result=getURLContent($urltotest, 'GET');
142 142
 
143 143
         print __METHOD__." result=".$result."\n";
144
-    	$this->assertLessThanOrEqual($result, 0);
144
+        $this->assertLessThanOrEqual($result, 0);
145 145
 
146
-    	return $result;
146
+        return $result;
147 147
     }
148 148
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 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,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,11 +78,11 @@  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
 
83 83
     	if (empty($conf->paypal->enabled)) { print __METHOD__." Module Paypal must be enabled.\n"; die(); }
84 84
 
85
-        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
85
+        $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
86 86
 
87 87
     	print __METHOD__."\n";
88 88
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     // tear down after class
91 91
     public static function tearDownAfterClass()
92 92
     {
93
-    	global $conf,$user,$langs,$db;
93
+    	global $conf, $user, $langs, $db;
94 94
 		$db->rollback();
95 95
 
96 96
 		print __METHOD__."\n";
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
     protected function setUp()
105 105
     {
106
-    	global $conf,$user,$langs,$db;
107
-		$conf=$this->savconf;
108
-		$user=$this->savuser;
109
-		$langs=$this->savlangs;
110
-		$db=$this->savdb;
106
+    	global $conf, $user, $langs, $db;
107
+		$conf = $this->savconf;
108
+		$user = $this->savuser;
109
+		$langs = $this->savlangs;
110
+		$db = $this->savdb;
111 111
 
112 112
 		print __METHOD__."\n";
113 113
     }
@@ -129,16 +129,16 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function testPaypalOk()
131 131
     {
132
-    	global $conf,$user,$langs,$db;
133
-		$conf=$this->savconf;
134
-		$user=$this->savuser;
135
-		$langs=$this->savlangs;
136
-		$db=$this->savdb;
132
+    	global $conf, $user, $langs, $db;
133
+		$conf = $this->savconf;
134
+		$user = $this->savuser;
135
+		$langs = $this->savlangs;
136
+		$db = $this->savdb;
137 137
 
138
-		$urltotest=getPaypalPaymentUrl(1,'free');
138
+		$urltotest = getPaypalPaymentUrl(1, 'free');
139 139
 		print "urltotest=".$urltotest."\n";
140 140
 
141
-		$result=getURLContent($urltotest, 'GET');
141
+		$result = getURLContent($urltotest, 'GET');
142 142
 
143 143
         print __METHOD__." result=".$result."\n";
144 144
     	$this->assertLessThanOrEqual($result, 0);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/PgsqlTest.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 if (empty($user->id))
34 34
 {
35
-	print "Load permissions for admin user nb 1\n";
36
-	$user->fetch(1);
37
-	$user->getrights();
35
+    print "Load permissions for admin user nb 1\n";
36
+    $user->fetch(1);
37
+    $user->getrights();
38 38
 }
39 39
 
40 40
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
@@ -49,75 +49,75 @@  discard block
 block discarded – undo
49 49
  */
50 50
 class PgsqlTest extends PHPUnit_Framework_TestCase
51 51
 {
52
-	protected $savconf;
53
-	protected $savuser;
54
-	protected $savlangs;
55
-	protected $savdb;
56
-
57
-	/**
58
-	 * Constructor
59
-	 * We save global variables into local variables
60
-	 *
61
-	 * @return ContactTest
62
-	 */
63
-	function __construct()
64
-	{
65
-		parent::__construct();
66
-
67
-		//$this->sharedFixture
68
-		global $conf,$user,$langs,$db;
69
-		$this->savconf=$conf;
70
-		$this->savuser=$user;
71
-		$this->savlangs=$langs;
72
-		$this->savdb=$db;
73
-
74
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
75
-		//print " - db ".$db->db;
76
-		print "\n";
77
-	}
78
-
79
-	// Static methods
80
-  	public static function setUpBeforeClass()
52
+    protected $savconf;
53
+    protected $savuser;
54
+    protected $savlangs;
55
+    protected $savdb;
56
+
57
+    /**
58
+     * Constructor
59
+     * We save global variables into local variables
60
+     *
61
+     * @return ContactTest
62
+     */
63
+    function __construct()
81 64
     {
82
-    	global $conf,$user,$langs,$db;
65
+        parent::__construct();
66
+
67
+        //$this->sharedFixture
68
+        global $conf,$user,$langs,$db;
69
+        $this->savconf=$conf;
70
+        $this->savuser=$user;
71
+        $this->savlangs=$langs;
72
+        $this->savdb=$db;
73
+
74
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
75
+        //print " - db ".$db->db;
76
+        print "\n";
77
+    }
78
+
79
+    // Static methods
80
+        public static function setUpBeforeClass()
81
+    {
82
+        global $conf,$user,$langs,$db;
83 83
 
84 84
         $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
85 85
 
86
-    	print __METHOD__."\n";
86
+        print __METHOD__."\n";
87 87
     }
88 88
 
89 89
     // tear down after class
90 90
     public static function tearDownAfterClass()
91 91
     {
92
-    	global $conf,$user,$langs,$db;
93
-		$db->rollback();
92
+        global $conf,$user,$langs,$db;
93
+        $db->rollback();
94 94
 
95
-		print __METHOD__."\n";
95
+        print __METHOD__."\n";
96 96
     }
97 97
 
98
-	/**
99
-	 * Init phpunit tests
100
-	 *
101
-	 * @return	void
102
-	 */
98
+    /**
99
+     * Init phpunit tests
100
+     *
101
+     * @return	void
102
+     */
103 103
     protected function setUp()
104 104
     {
105
-    	global $conf,$user,$langs,$db;
106
-		$conf=$this->savconf;
107
-		$user=$this->savuser;
108
-		$langs=$this->savlangs;
109
-		$db=$this->savdb;
105
+        global $conf,$user,$langs,$db;
106
+        $conf=$this->savconf;
107
+        $user=$this->savuser;
108
+        $langs=$this->savlangs;
109
+        $db=$this->savdb;
110 110
 
111
-		print __METHOD__."\n";
111
+        print __METHOD__."\n";
112 112
     }
113
-	/**
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,11 +127,11 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function testConvertSQLFromMysql()
129 129
     {
130
-    	global $conf,$user,$langs,$db;
131
-		$conf=$this->savconf;
132
-		$user=$this->savuser;
133
-		$langs=$this->savlangs;
134
-		$db=$this->savdb;
130
+        global $conf,$user,$langs,$db;
131
+        $conf=$this->savconf;
132
+        $user=$this->savuser;
133
+        $langs=$this->savlangs;
134
+        $db=$this->savdb;
135 135
 
136 136
         $sql="ALTER TABLE llx_table RENAME TO llx_table_new;";
137 137
         $result=DoliDBPgsql::convertSQLFromMysql($sql);
@@ -159,23 +159,23 @@  discard block
 block discarded – undo
159 159
         $this->assertEquals($result, "-- ALTER TABLE llx_table MODIFY name varchar(60); replaced by --\nALTER TABLE llx_table ALTER COLUMN name TYPE varchar(60);");
160 160
 
161 161
         // Create a constraint
162
-		$sql='ALTER TABLE llx_tablechild ADD CONSTRAINT fk_tablechild_fk_fieldparent FOREIGN KEY (fk_fieldparent) REFERENCES llx_tableparent (rowid)';
163
-		$result=DoliDBPgsql::convertSQLFromMysql($sql);
162
+        $sql='ALTER TABLE llx_tablechild ADD CONSTRAINT fk_tablechild_fk_fieldparent FOREIGN KEY (fk_fieldparent) REFERENCES llx_tableparent (rowid)';
163
+        $result=DoliDBPgsql::convertSQLFromMysql($sql);
164 164
         print __METHOD__." result=".$result."\n";
165
-    	$this->assertEquals($result, $sql.' DEFERRABLE INITIALLY IMMEDIATE;');
165
+        $this->assertEquals($result, $sql.' DEFERRABLE INITIALLY IMMEDIATE;');
166 166
 
167 167
         // Test GROUP_CONCAT (without SEPARATOR)
168
-		$sql="SELECT a.b, GROUP_CONCAT(a.c) FROM table GROUP BY a.b";
169
-		$result=DoliDBPgsql::convertSQLFromMysql($sql);
168
+        $sql="SELECT a.b, GROUP_CONCAT(a.c) FROM table GROUP BY a.b";
169
+        $result=DoliDBPgsql::convertSQLFromMysql($sql);
170 170
         print __METHOD__." result=".$result."\n";
171
-    	$this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (without SEPARATOR)');
171
+        $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (without SEPARATOR)');
172 172
 
173 173
         // Test GROUP_CONCAT (with SEPARATOR)
174
-		$sql="SELECT a.b, GROUP_CONCAT(a.c SEPARATOR ',') FROM table GROUP BY a.b";
175
-		$result=DoliDBPgsql::convertSQLFromMysql($sql);
174
+        $sql="SELECT a.b, GROUP_CONCAT(a.c SEPARATOR ',') FROM table GROUP BY a.b";
175
+        $result=DoliDBPgsql::convertSQLFromMysql($sql);
176 176
         print __METHOD__." result=".$result."\n";
177
-    	$this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (with SEPARATOR)');
177
+        $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (with SEPARATOR)');
178 178
 
179
-    	return $result;
179
+        return $result;
180 180
     }
181 181
 }
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *		\remarks	To run this script as CLI:  phpunit filename.php
24 24
  */
25 25
 
26
-global $conf,$user,$langs,$db;
26
+global $conf, $user, $langs, $db;
27 27
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
28 28
 //require_once 'PHPUnit/Autoload.php';
29 29
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	$user->getrights();
38 38
 }
39 39
 
40
-$conf->global->MAIN_DISABLE_ALL_MAILS=1;
40
+$conf->global->MAIN_DISABLE_ALL_MAILS = 1;
41 41
 
42 42
 
43 43
 /**
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 		parent::__construct();
66 66
 
67 67
 		//$this->sharedFixture
68
-		global $conf,$user,$langs,$db;
69
-		$this->savconf=$conf;
70
-		$this->savuser=$user;
71
-		$this->savlangs=$langs;
72
-		$this->savdb=$db;
68
+		global $conf, $user, $langs, $db;
69
+		$this->savconf = $conf;
70
+		$this->savuser = $user;
71
+		$this->savlangs = $langs;
72
+		$this->savdb = $db;
73 73
 
74 74
 		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
75 75
 		//print " - db ".$db->db;
@@ -79,9 +79,9 @@  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
 
84
-        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
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,52 +127,52 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function testConvertSQLFromMysql()
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
-        $sql="ALTER TABLE llx_table RENAME TO llx_table_new;";
137
-        $result=DoliDBPgsql::convertSQLFromMysql($sql);
130
+    	global $conf, $user, $langs, $db;
131
+		$conf = $this->savconf;
132
+		$user = $this->savuser;
133
+		$langs = $this->savlangs;
134
+		$db = $this->savdb;
135
+
136
+        $sql = "ALTER TABLE llx_table RENAME TO llx_table_new;";
137
+        $result = DoliDBPgsql::convertSQLFromMysql($sql);
138 138
         print __METHOD__." result=".$result."\n";
139 139
         $this->assertEquals($result, "ALTER TABLE llx_table RENAME TO llx_table_new;");
140 140
 
141
-        $sql="ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;";
142
-        $result=DoliDBPgsql::convertSQLFromMysql($sql);
141
+        $sql = "ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;";
142
+        $result = DoliDBPgsql::convertSQLFromMysql($sql);
143 143
         print __METHOD__." result=".$result."\n";
144 144
         $this->assertEquals($result, "ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0';");
145 145
 
146
-        $sql="ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);";
147
-        $result=DoliDBPgsql::convertSQLFromMysql($sql);
146
+        $sql = "ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);";
147
+        $result = DoliDBPgsql::convertSQLFromMysql($sql);
148 148
         print __METHOD__." result=".$result."\n";
149 149
         $this->assertEquals($result, "-- ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); replaced by --\nALTER TABLE llx_table RENAME COLUMN oldname TO newname");
150 150
 
151
-        $sql="ALTER TABLE llx_table DROP COLUMN oldname;";
152
-        $result=DoliDBPgsql::convertSQLFromMysql($sql);
151
+        $sql = "ALTER TABLE llx_table DROP COLUMN oldname;";
152
+        $result = DoliDBPgsql::convertSQLFromMysql($sql);
153 153
         print __METHOD__." result=".$result."\n";
154 154
         $this->assertEquals($result, $sql);
155 155
 
156
-        $sql="ALTER TABLE llx_table MODIFY name varchar(60);";
157
-        $result=DoliDBPgsql::convertSQLFromMysql($sql);
156
+        $sql = "ALTER TABLE llx_table MODIFY name varchar(60);";
157
+        $result = DoliDBPgsql::convertSQLFromMysql($sql);
158 158
         print __METHOD__." result=".$result."\n";
159 159
         $this->assertEquals($result, "-- ALTER TABLE llx_table MODIFY name varchar(60); replaced by --\nALTER TABLE llx_table ALTER COLUMN name TYPE varchar(60);");
160 160
 
161 161
         // Create a constraint
162
-		$sql='ALTER TABLE llx_tablechild ADD CONSTRAINT fk_tablechild_fk_fieldparent FOREIGN KEY (fk_fieldparent) REFERENCES llx_tableparent (rowid)';
163
-		$result=DoliDBPgsql::convertSQLFromMysql($sql);
162
+		$sql = 'ALTER TABLE llx_tablechild ADD CONSTRAINT fk_tablechild_fk_fieldparent FOREIGN KEY (fk_fieldparent) REFERENCES llx_tableparent (rowid)';
163
+		$result = DoliDBPgsql::convertSQLFromMysql($sql);
164 164
         print __METHOD__." result=".$result."\n";
165 165
     	$this->assertEquals($result, $sql.' DEFERRABLE INITIALLY IMMEDIATE;');
166 166
 
167 167
         // Test GROUP_CONCAT (without SEPARATOR)
168
-		$sql="SELECT a.b, GROUP_CONCAT(a.c) FROM table GROUP BY a.b";
169
-		$result=DoliDBPgsql::convertSQLFromMysql($sql);
168
+		$sql = "SELECT a.b, GROUP_CONCAT(a.c) FROM table GROUP BY a.b";
169
+		$result = DoliDBPgsql::convertSQLFromMysql($sql);
170 170
         print __METHOD__." result=".$result."\n";
171 171
     	$this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (without SEPARATOR)');
172 172
 
173 173
         // Test GROUP_CONCAT (with SEPARATOR)
174
-		$sql="SELECT a.b, GROUP_CONCAT(a.c SEPARATOR ',') FROM table GROUP BY a.b";
175
-		$result=DoliDBPgsql::convertSQLFromMysql($sql);
174
+		$sql = "SELECT a.b, GROUP_CONCAT(a.c SEPARATOR ',') FROM table GROUP BY a.b";
175
+		$result = DoliDBPgsql::convertSQLFromMysql($sql);
176 176
         print __METHOD__." result=".$result."\n";
177 177
     	$this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (with SEPARATOR)');
178 178
 
Please login to merge, or discard this patch.