Test Failed
Push — master ( ed0f4f...3aebc2 )
by Alxarafe
43:14
created
dolibarr/test/phpunit/UserGroupTest.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
      */
60 60
     function __construct()
61 61
     {
62
-    	parent::__construct();
62
+        parent::__construct();
63 63
 
64
-    	//$this->sharedFixture
64
+        //$this->sharedFixture
65 65
         global $conf,$user,$langs,$db;
66 66
         $this->savconf=$conf;
67 67
         $this->savuser=$user;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      * Init phpunit tests
96 96
      *
97 97
      * @return  void
98
-    */
98
+     */
99 99
     protected function setUp()
100 100
     {
101 101
         global $conf,$user,$langs,$db;
Please login to merge, or discard this patch.
dolibarr/test/phpunit/functional/InstallTest.php 1 patch
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -23,263 +23,263 @@
 block discarded – undo
23 23
  */
24 24
 class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
25 25
 {
26
-	protected static $url = 'https://dev.dolibarr.org';
27
-	protected static $db_name = 'dolibarr_test';
28
-	protected static $db_host = 'localhost';
29
-	protected static $db_admin_user = 'root';
30
-	protected static $db_admin_pass = '';
31
-	protected static $db_user = 'dolibarr';
32
-	protected static $db_pass = 'dolibarr';
33
-	protected static $dol_admin_user = 'admin';
34
-	protected static $dol_admin_pass = 'admin';
35
-
36
-	public static $browsers = array(
37
-		array(
38
-			'browser' => 'chrome',
39
-			'browserName' => 'chrome',
40
-			'sessionStrategy' => 'shared',
41
-			'desiredCapabilities' => array()
42
-		)
43
-	);
26
+    protected static $url = 'https://dev.dolibarr.org';
27
+    protected static $db_name = 'dolibarr_test';
28
+    protected static $db_host = 'localhost';
29
+    protected static $db_admin_user = 'root';
30
+    protected static $db_admin_pass = '';
31
+    protected static $db_user = 'dolibarr';
32
+    protected static $db_pass = 'dolibarr';
33
+    protected static $dol_admin_user = 'admin';
34
+    protected static $dol_admin_pass = 'admin';
35
+
36
+    public static $browsers = array(
37
+        array(
38
+            'browser' => 'chrome',
39
+            'browserName' => 'chrome',
40
+            'sessionStrategy' => 'shared',
41
+            'desiredCapabilities' => array()
42
+        )
43
+    );
44 44
 
45 45
     /**
46 46
      * setUpBeforeClass
47 47
      *
48 48
      * @return	void
49 49
      */
50
-	public static function setUpBeforeClass()
51
-	{
52
-		// Make sure we backup and remove the configuration file to force new install.
53
-		@rename('htdocs/conf/conf.php', sys_get_temp_dir() . '/conf.php');
50
+    public static function setUpBeforeClass()
51
+    {
52
+        // Make sure we backup and remove the configuration file to force new install.
53
+        @rename('htdocs/conf/conf.php', sys_get_temp_dir() . '/conf.php');
54 54
 
55
-		// Start without a database
56
-		self::dropTestDatabase();
55
+        // Start without a database
56
+        self::dropTestDatabase();
57 57
 
58
-		// Run the tests in the same window
59
-		self::shareSession(true);
60
-	}
58
+        // Run the tests in the same window
59
+        self::shareSession(true);
60
+    }
61 61
 
62 62
     /**
63 63
      * dropTestDatabase
64 64
      *
65 65
      * @return	void
66 66
      */
67
-	protected static function dropTestDatabase()
68
-	{
69
-		$mysqli = new mysqli(self::$db_host, self::$db_admin_user, self::$db_admin_pass);
70
-		$mysqli->query("DROP DATABASE " . self::$db_name);
71
-	}
67
+    protected static function dropTestDatabase()
68
+    {
69
+        $mysqli = new mysqli(self::$db_host, self::$db_admin_user, self::$db_admin_pass);
70
+        $mysqli->query("DROP DATABASE " . self::$db_name);
71
+    }
72 72
 
73 73
     /**
74 74
      * tearDownAfterClass
75 75
      *
76 76
      * @return	void
77 77
      */
78
-	public static function tearDownAfterClass()
79
-	{
80
-		// Remove the generated configuration and restore the backed up file.
81
-		@unlink('htdocs/conf/conf.php');
82
-		@rename(sys_get_temp_dir() . '/conf.php', 'htdocs/conf/conf.php');
78
+    public static function tearDownAfterClass()
79
+    {
80
+        // Remove the generated configuration and restore the backed up file.
81
+        @unlink('htdocs/conf/conf.php');
82
+        @rename(sys_get_temp_dir() . '/conf.php', 'htdocs/conf/conf.php');
83 83
 
84
-		// Cleanup test database
85
-		self::dropTestDatabase();
86
-	}
84
+        // Cleanup test database
85
+        self::dropTestDatabase();
86
+    }
87 87
 
88 88
     /**
89 89
      * setUp
90 90
      *
91 91
      * @return  void
92 92
      */
93
-	public function setUp()
94
-	{
95
-		// Populating the database can take quite long.
96
-		$this->setSeleniumServerRequestsTimeout(120000);
97
-		$this->setBrowserUrl(self::$url);
98
-	}
93
+    public function setUp()
94
+    {
95
+        // Populating the database can take quite long.
96
+        $this->setSeleniumServerRequestsTimeout(120000);
97
+        $this->setBrowserUrl(self::$url);
98
+    }
99 99
 
100 100
     /**
101 101
      * testInstallRedirect
102 102
      *
103 103
      * @return  void
104 104
      */
105
-	public function testInstallRedirect()
106
-	{
107
-		$this->url('/');
108
-		$this->assertContains('/install/index.php', $this->url());
109
-	}
105
+    public function testInstallRedirect()
106
+    {
107
+        $this->url('/');
108
+        $this->assertContains('/install/index.php', $this->url());
109
+    }
110 110
 
111 111
     /**
112 112
      * testInstallPageTitle
113 113
      *
114 114
      * @return  void
115 115
      */
116
-	public function testInstallPageTitle()
117
-	{
118
-		$this->assertContains('Dolibarr', $this->title());
119
-	}
116
+    public function testInstallPageTitle()
117
+    {
118
+        $this->assertContains('Dolibarr', $this->title());
119
+    }
120 120
 
121 121
     /**
122 122
      * testInstallProcess
123 123
      *
124 124
      * @return  void
125 125
      */
126
-	public function testInstallProcess()
127
-	{
128
-		// FIXME: the button itself should have an ID
129
-		$this->byId('nextbutton')->byTag('input')->click();
130
-		$this->assertContains('/install/check.php', $this->url());
131
-	}
126
+    public function testInstallProcess()
127
+    {
128
+        // FIXME: the button itself should have an ID
129
+        $this->byId('nextbutton')->byTag('input')->click();
130
+        $this->assertContains('/install/check.php', $this->url());
131
+    }
132 132
 
133 133
     /**
134 134
      * testCheckPage
135 135
      *
136 136
      * @return  void
137 137
      */
138
-	public function testCheckPage()
139
-	{
140
-		$unavailable_choices = $this->byId('navail_choices');
141
-		$show_hide_choices = $this->byId('AShowChoices')->byTag('a');
142
-		$this->assertFalse($unavailable_choices->displayed());
143
-		// FIXME: the link itself should have an ID
144
-		$show_hide_choices->click();
145
-		$this->assertTrue($unavailable_choices->displayed());
146
-		$show_hide_choices->click();
147
-		$this->assertFalse($unavailable_choices->displayed());
148
-		$this->byClassName('button')->click();
149
-		$this->assertContains('/install/fileconf.php', $this->url());
150
-	}
138
+    public function testCheckPage()
139
+    {
140
+        $unavailable_choices = $this->byId('navail_choices');
141
+        $show_hide_choices = $this->byId('AShowChoices')->byTag('a');
142
+        $this->assertFalse($unavailable_choices->displayed());
143
+        // FIXME: the link itself should have an ID
144
+        $show_hide_choices->click();
145
+        $this->assertTrue($unavailable_choices->displayed());
146
+        $show_hide_choices->click();
147
+        $this->assertFalse($unavailable_choices->displayed());
148
+        $this->byClassName('button')->click();
149
+        $this->assertContains('/install/fileconf.php', $this->url());
150
+    }
151 151
 
152 152
     /**
153 153
      * testForm
154 154
      *
155 155
      * @return  void
156 156
      */
157
-	public function testForm()
158
-	{
159
-		$this->assertFalse($this->byClassName('hideroot')->displayed());
160
-		$this->assertTrue($this->byClassName('hidesqlite')->displayed());
157
+    public function testForm()
158
+    {
159
+        $this->assertFalse($this->byClassName('hideroot')->displayed());
160
+        $this->assertTrue($this->byClassName('hidesqlite')->displayed());
161 161
 
162
-		// FIXME: This element should have an ID
163
-		$this->assertFalse($this->byName('main_force_https')->selected());
164
-		$this->byName('main_force_https')->click();
162
+        // FIXME: This element should have an ID
163
+        $this->assertFalse($this->byName('main_force_https')->selected());
164
+        $this->byName('main_force_https')->click();
165 165
 
166
-		$this->assertEquals('dolibarr', $this->byId('db_name')->value());
167
-		$this->byId('db_name')->clear();
168
-		$this->byId('db_name')->value(self::$db_name);
166
+        $this->assertEquals('dolibarr', $this->byId('db_name')->value());
167
+        $this->byId('db_name')->clear();
168
+        $this->byId('db_name')->value(self::$db_name);
169 169
 
170
-		$this->assertEquals('mysqli', $this->byId('db_type')->value());
170
+        $this->assertEquals('mysqli', $this->byId('db_type')->value());
171 171
 
172
-		// FIXME: This element should have an ID
173
-		$this->assertEquals('localhost', $this->byName('db_host')->value());
172
+        // FIXME: This element should have an ID
173
+        $this->assertEquals('localhost', $this->byName('db_host')->value());
174 174
 
175
-		$this->assertEquals(3306, $this->byId('db_port')->value());
175
+        $this->assertEquals(3306, $this->byId('db_port')->value());
176 176
 
177
-		$this->assertEquals('llx_', $this->byId('db_prefix')->value());
177
+        $this->assertEquals('llx_', $this->byId('db_prefix')->value());
178 178
 
179
-		$this->byId('db_create_database')->click();
180
-		$this->assertTrue($this->byClassName('hideroot')->displayed());
181
-		$this->byId('db_create_database')->click();
182
-		$this->assertFalse($this->byClassName('hideroot')->displayed());
179
+        $this->byId('db_create_database')->click();
180
+        $this->assertTrue($this->byClassName('hideroot')->displayed());
181
+        $this->byId('db_create_database')->click();
182
+        $this->assertFalse($this->byClassName('hideroot')->displayed());
183 183
 
184
-		$this->byId('db_user')->value(self::$db_user);
184
+        $this->byId('db_user')->value(self::$db_user);
185 185
 
186
-		$this->byId('db_pass')->value(self::$db_pass);
186
+        $this->byId('db_pass')->value(self::$db_pass);
187 187
 
188
-		$this->byId('db_create_user')->click();
189
-		$this->assertTrue($this->byClassName('hideroot')->displayed());
190
-		$this->byId('db_create_user')->click();
191
-		$this->assertFalse($this->byClassName('hideroot')->displayed());
188
+        $this->byId('db_create_user')->click();
189
+        $this->assertTrue($this->byClassName('hideroot')->displayed());
190
+        $this->byId('db_create_user')->click();
191
+        $this->assertFalse($this->byClassName('hideroot')->displayed());
192 192
 
193
-		$this->byId('db_create_database')->click();
194
-		$this->byId('db_create_user')->click();
195
-		$this->assertTrue($this->byClassName('hideroot')->displayed());
193
+        $this->byId('db_create_database')->click();
194
+        $this->byId('db_create_user')->click();
195
+        $this->assertTrue($this->byClassName('hideroot')->displayed());
196 196
 
197
-		$this->byId('db_user_root')->value('root');
198
-		$this->byId('db_pass_root')->value('');
199
-	}
197
+        $this->byId('db_user_root')->value('root');
198
+        $this->byId('db_pass_root')->value('');
199
+    }
200 200
 
201 201
     /**
202 202
      * testFormSubmit
203 203
      *
204 204
      * @return  void
205 205
      */
206
-	public function testFormSubmit()
207
-	{
208
-		$this->byName('forminstall')->submit();
209
-		$this->assertContains('/install/step1.php', $this->url());
210
-	}
206
+    public function testFormSubmit()
207
+    {
208
+        $this->byName('forminstall')->submit();
209
+        $this->assertContains('/install/step1.php', $this->url());
210
+    }
211 211
 
212 212
     /**
213 213
      * testStep1
214 214
      *
215 215
      * @return  void
216 216
      */
217
-	public function testStep1()
218
-	{
219
-		$this->assertFalse($this->byId('pleasewait')->displayed());
220
-		$start = new DateTimeImmutable();
221
-		// FIXME: the button itself should have an ID
222
-		$this->byId('nextbutton')->byTag('input')->click();
223
-		$time = $start->diff(new DateTimeImmutable());
224
-		echo "\nPopulating the database took " . $time->format("%s seconds.\n");
225
-		$this->assertContains('/install/step2.php', $this->url());
226
-	}
217
+    public function testStep1()
218
+    {
219
+        $this->assertFalse($this->byId('pleasewait')->displayed());
220
+        $start = new DateTimeImmutable();
221
+        // FIXME: the button itself should have an ID
222
+        $this->byId('nextbutton')->byTag('input')->click();
223
+        $time = $start->diff(new DateTimeImmutable());
224
+        echo "\nPopulating the database took " . $time->format("%s seconds.\n");
225
+        $this->assertContains('/install/step2.php', $this->url());
226
+    }
227 227
 
228 228
     /**
229 229
      * testStep2
230 230
      *
231 231
      * @return  void
232 232
      */
233
-	public function testStep2()
234
-	{
235
-		$this->byName('forminstall')->submit();
236
-		$this->assertContains('/install/step4.php', $this->url());
237
-	}
233
+    public function testStep2()
234
+    {
235
+        $this->byName('forminstall')->submit();
236
+        $this->assertContains('/install/step4.php', $this->url());
237
+    }
238 238
 
239
-	// There is no step 3
239
+    // There is no step 3
240 240
 
241 241
     /**
242 242
      * testStep4
243 243
      *
244 244
      * @return  void
245 245
      */
246
-	public function testStep4()
247
-	{
248
-		// FIXME: should have an ID
249
-		$this->byName('login')->value(self::$dol_admin_user);
250
-		// FIXME: should have an ID
251
-		$this->byName('pass')->value('admin');
252
-		// FIXME: should have an ID
253
-		$this->byName('pass_verif')->value(self::$dol_admin_pass);
254
-		// FIXME: the button itself should have an ID
255
-		$this->byId('nextbutton')->byTag('input')->click();
256
-		$this->assertContains('/install/step5.php', $this->url());
257
-	}
246
+    public function testStep4()
247
+    {
248
+        // FIXME: should have an ID
249
+        $this->byName('login')->value(self::$dol_admin_user);
250
+        // FIXME: should have an ID
251
+        $this->byName('pass')->value('admin');
252
+        // FIXME: should have an ID
253
+        $this->byName('pass_verif')->value(self::$dol_admin_pass);
254
+        // FIXME: the button itself should have an ID
255
+        $this->byId('nextbutton')->byTag('input')->click();
256
+        $this->assertContains('/install/step5.php', $this->url());
257
+    }
258 258
 
259 259
     /**
260 260
      * testStep5
261 261
      *
262 262
      * @return  void
263 263
      */
264
-	public function testStep5()
265
-	{
266
-		// FIXME: this button should have an ID
267
-		$this->byTag('a')->click();
268
-		$this->assertContains('/admin/index.php', $this->url());
269
-	}
264
+    public function testStep5()
265
+    {
266
+        // FIXME: this button should have an ID
267
+        $this->byTag('a')->click();
268
+        $this->assertContains('/admin/index.php', $this->url());
269
+    }
270 270
 
271 271
     /**
272 272
      * testFirstLogin
273 273
      *
274 274
      * @return  void
275 275
      */
276
-	public function testFirstLogin()
277
-	{
278
-		$this->assertEquals('login', $this->byTag('form')->attribute('id'));
279
-		$this->assertEquals(self::$dol_admin_user, $this->byId('username')->value());
280
-		$this->byId('password')->value(self::$dol_admin_pass);
281
-		// FIXME: login button should have an ID
282
-		$this->byId('login')->submit();
283
-		$this->assertEquals('mainbody', $this->byTag('body')->attribute('id'));
284
-	}
276
+    public function testFirstLogin()
277
+    {
278
+        $this->assertEquals('login', $this->byTag('form')->attribute('id'));
279
+        $this->assertEquals(self::$dol_admin_user, $this->byId('username')->value());
280
+        $this->byId('password')->value(self::$dol_admin_pass);
281
+        // FIXME: login button should have an ID
282
+        $this->byId('login')->submit();
283
+        $this->assertEquals('mainbody', $this->byTag('body')->attribute('id'));
284
+    }
285 285
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/functional/TakePosFunctionalTest.php 1 patch
Indentation   +248 added lines, -248 removed lines patch added patch discarded remove patch
@@ -41,32 +41,32 @@  discard block
 block discarded – undo
41 41
  */
42 42
 class TakePosFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
43 43
 {
44
-	// TODO: move to a global configuration file?
45
-	/** @var string Base URL of the webserver under test */
46
-	protected static $base_url = 'http://dev.zenfusion.fr';
47
-	/**
48
-	 * @var string Dolibarr admin username
49
-	 * @see authenticate
50
-	 */
51
-	protected static $dol_admin_user = 'admin';
52
-	/**
53
-	 * @var string Dolibarr admin password
54
-	 * @see authenticate
55
-	 */
56
-	protected static $dol_admin_pass = 'admin';
57
-	/** @var int Dolibarr module ID */
58
-	private static $module_id = 500000; // TODO: autodetect?
44
+    // TODO: move to a global configuration file?
45
+    /** @var string Base URL of the webserver under test */
46
+    protected static $base_url = 'http://dev.zenfusion.fr';
47
+    /**
48
+     * @var string Dolibarr admin username
49
+     * @see authenticate
50
+     */
51
+    protected static $dol_admin_user = 'admin';
52
+    /**
53
+     * @var string Dolibarr admin password
54
+     * @see authenticate
55
+     */
56
+    protected static $dol_admin_pass = 'admin';
57
+    /** @var int Dolibarr module ID */
58
+    private static $module_id = 500000; // TODO: autodetect?
59 59
 
60
-	/** @var array Browsers to test with */
61
-	public static $browsers = array(
62
-		array(
63
-			'browser' => 'Google Chrome on Linux',
64
-			'browserName' => 'chrome',
65
-			'sessionStrategy' => 'shared',
66
-			'desiredCapabilities' => array()
67
-		),
68
-		// Geckodriver does not keep the session at the moment?!
69
-		// XPath selectors also don't seem to work
60
+    /** @var array Browsers to test with */
61
+    public static $browsers = array(
62
+        array(
63
+            'browser' => 'Google Chrome on Linux',
64
+            'browserName' => 'chrome',
65
+            'sessionStrategy' => 'shared',
66
+            'desiredCapabilities' => array()
67
+        ),
68
+        // Geckodriver does not keep the session at the moment?!
69
+        // XPath selectors also don't seem to work
70 70
 //        array(
71 71
 //            'browser' => 'Mozilla Firefox on Linux',
72 72
 //            'browserName' => 'firefox',
@@ -75,243 +75,243 @@  discard block
 block discarded – undo
75 75
 //                'marionette' => true
76 76
 //            )
77 77
 //        )
78
-	);
78
+    );
79 79
 
80
-	/**
81
-	 * Helper function to select links by href
82
-	 *
83
-	 * @param  string  $value      Href
84
-	 * @return mixed               Helper string
85
-	 */
86
-	protected function byHref($value)
87
-	{
88
-		$anchor = null;
89
-		$anchors = $this->elements($this->using('tag name')->value('a'));
90
-		foreach ($anchors as $anchor) {
91
-			if (strstr($anchor->attribute('href'), $value)) {
92
-				break;
93
-			}
94
-		}
95
-		return $anchor;
96
-	}
80
+    /**
81
+     * Helper function to select links by href
82
+     *
83
+     * @param  string  $value      Href
84
+     * @return mixed               Helper string
85
+     */
86
+    protected function byHref($value)
87
+    {
88
+        $anchor = null;
89
+        $anchors = $this->elements($this->using('tag name')->value('a'));
90
+        foreach ($anchors as $anchor) {
91
+            if (strstr($anchor->attribute('href'), $value)) {
92
+                break;
93
+            }
94
+        }
95
+        return $anchor;
96
+    }
97 97
 
98
-	/**
99
-	 * Global test setup
100
-	 *
101
-	 * @return	void
102
-	 */
103
-	public static function setUpBeforeClass()
104
-	{
105
-	}
98
+    /**
99
+     * Global test setup
100
+     *
101
+     * @return	void
102
+     */
103
+    public static function setUpBeforeClass()
104
+    {
105
+    }
106 106
 
107
-	/**
108
-	 * Unit test setup
109
-	 *
110
-	 * @return	void
111
-	 */
112
-	public function setUp()
113
-	{
114
-		$this->setSeleniumServerRequestsTimeout(3600);
115
-		$this->setBrowserUrl(self::$base_url);
116
-	}
107
+    /**
108
+     * Unit test setup
109
+     *
110
+     * @return	void
111
+     */
112
+    public function setUp()
113
+    {
114
+        $this->setSeleniumServerRequestsTimeout(3600);
115
+        $this->setBrowserUrl(self::$base_url);
116
+    }
117 117
 
118
-	/**
119
-	 * Verify pre conditions
120
-	 *
121
-	 * @return	void
122
-	 */
123
-	protected function assertPreConditions()
124
-	{
125
-	}
118
+    /**
119
+     * Verify pre conditions
120
+     *
121
+     * @return	void
122
+     */
123
+    protected function assertPreConditions()
124
+    {
125
+    }
126 126
 
127
-	/**
128
-	 * Handle Dolibarr authentication
129
-	 *
130
-	 * @return	void
131
-	 */
132
-	private function authenticate()
133
-	{
134
-		try {
135
-			if ($this->byId('login')) {
136
-				$login = $this->byId('username');
137
-				$login->clear();
138
-				$login->value('admin');
139
-				$password = $this->byId('password');
140
-				$password->clear();
141
-				$password->value('admin');
142
-				$this->byId('login')->submit();
143
-			}
144
-		} catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
145
-			// Login does not exist. Assume we are already authenticated
146
-		}
147
-	}
127
+    /**
128
+     * Handle Dolibarr authentication
129
+     *
130
+     * @return	void
131
+     */
132
+    private function authenticate()
133
+    {
134
+        try {
135
+            if ($this->byId('login')) {
136
+                $login = $this->byId('username');
137
+                $login->clear();
138
+                $login->value('admin');
139
+                $password = $this->byId('password');
140
+                $password->clear();
141
+                $password->value('admin');
142
+                $this->byId('login')->submit();
143
+            }
144
+        } catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
145
+            // Login does not exist. Assume we are already authenticated
146
+        }
147
+    }
148 148
 
149
-	/**
150
-	 * Test enabling developer mode
151
-	 *
152
-	 * @return	void
153
-	 */
154
-	public function testEnableDeveloperMode()
155
-	{
156
-		$this->url('/admin/const.php');
157
-		$this->authenticate();
158
-		$main_features_level_path='//input[@value="MAIN_FEATURES_LEVEL"]/following::input[@type="text"]';
159
-		$main_features_level = $this->byXPath($main_features_level_path);
160
-		$main_features_level->clear();
161
-		$main_features_level->value('2');
162
-		$this->byName('update')->click();
163
-		// Page reloaded, we need a new XPath
164
-		$main_features_level = $this->byXPath($main_features_level_path);
165
-		$this->assertEquals('2', $main_features_level->value(), "MAIN_FEATURES_LEVEL value is 2");
166
-	}
149
+    /**
150
+     * Test enabling developer mode
151
+     *
152
+     * @return	void
153
+     */
154
+    public function testEnableDeveloperMode()
155
+    {
156
+        $this->url('/admin/const.php');
157
+        $this->authenticate();
158
+        $main_features_level_path='//input[@value="MAIN_FEATURES_LEVEL"]/following::input[@type="text"]';
159
+        $main_features_level = $this->byXPath($main_features_level_path);
160
+        $main_features_level->clear();
161
+        $main_features_level->value('2');
162
+        $this->byName('update')->click();
163
+        // Page reloaded, we need a new XPath
164
+        $main_features_level = $this->byXPath($main_features_level_path);
165
+        $this->assertEquals('2', $main_features_level->value(), "MAIN_FEATURES_LEVEL value is 2");
166
+    }
167 167
 
168
-	/**
169
-	 * Test enabling the module
170
-	 *
171
-	 * @return	void
172
-	 *
173
-	 * @depends testEnableDeveloperMode
174
-	 */
175
-	public function testModuleEnabled()
176
-	{
177
-		$this->url('/admin/modules.php');
178
-		$this->authenticate();
179
-		$module_status_image_path='//a[contains(@href, "' . self::$module_id . '")]/img';
180
-		$module_status_image = $this->byXPath($module_status_image_path);
181
-		if (strstr($module_status_image->attribute('src'), 'switch_off.png')) {
182
-			// Enable the module
183
-			$this->byHref('modTakePos')->click();
184
-		} else {
185
-			// Disable the module
186
-			$this->byHref('modTakePos')->click();
187
-			// Reenable the module
188
-			$this->byHref('modTakePos')->click();
189
-		}
190
-		// Page reloaded, we need a new Xpath
191
-		$module_status_image = $this->byXPath($module_status_image_path);
192
-		$this->assertContains('switch_on.png', $module_status_image->attribute('src'), "Module enabled");
193
-	}
168
+    /**
169
+     * Test enabling the module
170
+     *
171
+     * @return	void
172
+     *
173
+     * @depends testEnableDeveloperMode
174
+     */
175
+    public function testModuleEnabled()
176
+    {
177
+        $this->url('/admin/modules.php');
178
+        $this->authenticate();
179
+        $module_status_image_path='//a[contains(@href, "' . self::$module_id . '")]/img';
180
+        $module_status_image = $this->byXPath($module_status_image_path);
181
+        if (strstr($module_status_image->attribute('src'), 'switch_off.png')) {
182
+            // Enable the module
183
+            $this->byHref('modTakePos')->click();
184
+        } else {
185
+            // Disable the module
186
+            $this->byHref('modTakePos')->click();
187
+            // Reenable the module
188
+            $this->byHref('modTakePos')->click();
189
+        }
190
+        // Page reloaded, we need a new Xpath
191
+        $module_status_image = $this->byXPath($module_status_image_path);
192
+        $this->assertContains('switch_on.png', $module_status_image->attribute('src'), "Module enabled");
193
+    }
194 194
 
195
-	/**
196
-	 * Test access to the configuration page
197
-	 *
198
-	 * @return	void
199
-	 *
200
-	 * @depends testModuleEnabled
201
-	 */
202
-	public function testConfigurationPage()
203
-	{
204
-		$this->url('/custom/takepos/admin/setup.php');
205
-		$this->authenticate();
206
-		$this->assertContains('takepos/admin/setup.php', $this->url(), 'Configuration page');
207
-	}
195
+    /**
196
+     * Test access to the configuration page
197
+     *
198
+     * @return	void
199
+     *
200
+     * @depends testModuleEnabled
201
+     */
202
+    public function testConfigurationPage()
203
+    {
204
+        $this->url('/custom/takepos/admin/setup.php');
205
+        $this->authenticate();
206
+        $this->assertContains('takepos/admin/setup.php', $this->url(), 'Configuration page');
207
+    }
208 208
 
209
-	/**
210
-	 * Test access to the about page
211
-	 *
212
-	 * @return	void
213
-	 *
214
-	 * @depends testConfigurationPage
215
-	 */
216
-	public function testAboutPage()
217
-	{
218
-		$this->url('/custom/takepos/admin/about.php');
219
-		$this->authenticate();
220
-		$this->assertContains('takepos/admin/about.php', $this->url(), 'About page');
221
-	}
209
+    /**
210
+     * Test access to the about page
211
+     *
212
+     * @return	void
213
+     *
214
+     * @depends testConfigurationPage
215
+     */
216
+    public function testAboutPage()
217
+    {
218
+        $this->url('/custom/takepos/admin/about.php');
219
+        $this->authenticate();
220
+        $this->assertContains('takepos/admin/about.php', $this->url(), 'About page');
221
+    }
222 222
 
223
-	/**
224
-	 * Test about page is rendering Markdown
225
-	 *
226
-	 * @return	void
227
-	 *
228
-	 * @depends testAboutPage
229
-	 */
230
-	public function testAboutPageRendersMarkdownReadme()
231
-	{
232
-		$this->url('/custom/takepos/admin/about.php');
233
-		$this->authenticate();
234
-		$this->assertEquals(
235
-			'Dolibarr Module Template (aka My Module)',
236
-			$this->byTag('h1')->text(),
237
-			"Readme title"
238
-		);
239
-	}
223
+    /**
224
+     * Test about page is rendering Markdown
225
+     *
226
+     * @return	void
227
+     *
228
+     * @depends testAboutPage
229
+     */
230
+    public function testAboutPageRendersMarkdownReadme()
231
+    {
232
+        $this->url('/custom/takepos/admin/about.php');
233
+        $this->authenticate();
234
+        $this->assertEquals(
235
+            'Dolibarr Module Template (aka My Module)',
236
+            $this->byTag('h1')->text(),
237
+            "Readme title"
238
+        );
239
+    }
240 240
 
241
-	/**
242
-	 * Test box is properly declared
243
-	 *
244
-	 * @return	void
245
-	 *
246
-	 * @depends testModuleEnabled
247
-	 */
248
-	public function testBoxDeclared()
249
-	{
250
-		$this->url('/admin/boxes.php');
251
-		$this->authenticate();
252
-		$this->assertContains('takeposwidget1', $this->source(), "Box enabled");
253
-	}
241
+    /**
242
+     * Test box is properly declared
243
+     *
244
+     * @return	void
245
+     *
246
+     * @depends testModuleEnabled
247
+     */
248
+    public function testBoxDeclared()
249
+    {
250
+        $this->url('/admin/boxes.php');
251
+        $this->authenticate();
252
+        $this->assertContains('takeposwidget1', $this->source(), "Box enabled");
253
+    }
254 254
 
255
-	/**
256
-	 * Test trigger is properly enabled
257
-	 *
258
-	 * @return	void
259
-	 *
260
-	 * @depends testModuleEnabled
261
-	 */
262
-	public function testTriggerDeclared()
263
-	{
264
-		$this->url('/admin/triggers.php');
265
-		$this->authenticate();
266
-		$this->assertContains(
267
-			'interface_99_modTakePos_TakePosTriggers.class.php',
268
-			$this->byTag('body')->text(),
269
-			"Trigger declared"
270
-		);
271
-	}
255
+    /**
256
+     * Test trigger is properly enabled
257
+     *
258
+     * @return	void
259
+     *
260
+     * @depends testModuleEnabled
261
+     */
262
+    public function testTriggerDeclared()
263
+    {
264
+        $this->url('/admin/triggers.php');
265
+        $this->authenticate();
266
+        $this->assertContains(
267
+            'interface_99_modTakePos_TakePosTriggers.class.php',
268
+            $this->byTag('body')->text(),
269
+            "Trigger declared"
270
+        );
271
+    }
272 272
 
273
-	/**
274
-	 * Test trigger is properly declared
275
-	 *
276
-	 * @return	void
277
-	 *
278
-	 * @depends testTriggerDeclared
279
-	 */
280
-	public function testTriggerEnabled()
281
-	{
282
-		$this->url('/admin/triggers.php');
283
-		$this->authenticate();
284
-		$this->assertContains(
285
-			'tick.png',
286
-			$this->byXPath('//td[text()="interface_99_modTakePos_MyTrigger.class.php"]/following::img')->attribute('src'),
287
-			"Trigger enabled"
288
-		);
289
-	}
273
+    /**
274
+     * Test trigger is properly declared
275
+     *
276
+     * @return	void
277
+     *
278
+     * @depends testTriggerDeclared
279
+     */
280
+    public function testTriggerEnabled()
281
+    {
282
+        $this->url('/admin/triggers.php');
283
+        $this->authenticate();
284
+        $this->assertContains(
285
+            'tick.png',
286
+            $this->byXPath('//td[text()="interface_99_modTakePos_MyTrigger.class.php"]/following::img')->attribute('src'),
287
+            "Trigger enabled"
288
+        );
289
+    }
290 290
 
291
-	/**
292
-	 * Verify post conditions
293
-	 *
294
-	 * @return	void
295
-	 */
296
-	protected function assertPostConditions()
297
-	{
298
-	}
291
+    /**
292
+     * Verify post conditions
293
+     *
294
+     * @return	void
295
+     */
296
+    protected function assertPostConditions()
297
+    {
298
+    }
299 299
 
300
-	/**
301
-	 * Unit test teardown
302
-	 *
303
-	 * @return	void
304
-	 */
305
-	public function tearDown()
306
-	{
307
-	}
300
+    /**
301
+     * Unit test teardown
302
+     *
303
+     * @return	void
304
+     */
305
+    public function tearDown()
306
+    {
307
+    }
308 308
 
309
-	/**
310
-	 * Global test teardown
311
-	 *
312
-	 * @return	void
313
-	 */
314
-	public static function tearDownAfterClass()
315
-	{
316
-	}
309
+    /**
310
+     * Global test teardown
311
+     *
312
+     * @return	void
313
+     */
314
+    public static function tearDownAfterClass()
315
+    {
316
+    }
317 317
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/CategorieTest.php 1 patch
Indentation   +2 added lines, -3 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;
@@ -238,7 +238,6 @@  discard block
 block discarded – undo
238 238
      *
239 239
      * @param   Category        $localobject        Category
240 240
      * @return  int
241
-
242 241
      * @depends testCategorieFetch
243 242
      * The depends says test is run only if previous is ok
244 243
      */
Please login to merge, or discard this patch.
dolibarr/test/phpunit/FormAdminTest.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
 if (empty($user->id))
33 33
 {
34
-	print "Load permissions for admin user nb 1\n";
35
-	$user->fetch(1);
36
-	$user->getrights();
34
+    print "Load permissions for admin user nb 1\n";
35
+    $user->fetch(1);
36
+    $user->getrights();
37 37
 }
38 38
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
39 39
 
@@ -47,75 +47,75 @@  discard block
 block discarded – undo
47 47
  */
48 48
 class FormAdminTest 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 FactureTest
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 FactureTest
60
+     */
61
+    function __construct()
62
+    {
63
+        parent::__construct();
64
+
65
+        //$this->sharedFixture
66
+        global $conf,$user,$langs,$db;
67
+        $this->savconf=$conf;
68
+        $this->savuser=$user;
69
+        $this->savlangs=$langs;
70
+        $this->savdb=$db;
71
+
72
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
+        //print " - db ".$db->db;
74
+        print "\n";
75
+    }
76
+
77
+    // Static methods
78
+        public static function setUpBeforeClass()
79 79
     {
80
-    	global $conf,$user,$langs,$db;
81
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
80
+        global $conf,$user,$langs,$db;
81
+        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
82 82
 
83
-    	print __METHOD__."\n";
83
+        print __METHOD__."\n";
84 84
     }
85 85
 
86 86
     // tear down after class
87 87
     public static function tearDownAfterClass()
88 88
     {
89
-    	global $conf,$user,$langs,$db;
90
-		$db->rollback();
89
+        global $conf,$user,$langs,$db;
90
+        $db->rollback();
91 91
 
92
-		print __METHOD__."\n";
92
+        print __METHOD__."\n";
93 93
     }
94 94
 
95
-	/**
96
-	 * Init phpunit tests
97
-	 *
98
-	 * @return	void
99
-	 */
95
+    /**
96
+     * Init phpunit tests
97
+     *
98
+     * @return	void
99
+     */
100 100
     protected function setUp()
101 101
     {
102
-    	global $conf,$user,$langs,$db;
103
-		$conf=$this->savconf;
104
-		$user=$this->savuser;
105
-		$langs=$this->savlangs;
106
-		$db=$this->savdb;
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 110
 
111
-	/**
112
-	 * End phpunit tests
113
-	 *
114
-	 * @return	void
115
-	 */
116
-	protected function tearDown()
111
+    /**
112
+     * End phpunit tests
113
+     *
114
+     * @return	void
115
+     */
116
+    protected function tearDown()
117 117
     {
118
-    	print __METHOD__."\n";
118
+        print __METHOD__."\n";
119 119
     }
120 120
 
121 121
     /**
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function testSelectPaperFormat()
127 127
     {
128
-    	global $conf,$user,$langs,$db;
129
-		$conf=$this->savconf;
130
-		$user=$this->savuser;
131
-		$langs=$this->savlangs;
132
-		$db=$this->savdb;
133
-
134
-		$localobject=new FormAdmin($this->savdb);
135
-    	$result=$localobject->select_paper_format('','paperformat_id','A4');
136
-
137
-    	$this->assertEquals($result, '<select class="flat" id="paperformat_id" name="paperformat_id"><option value="EUA4">Format A4 - 210x297 mm</option></select>');
138
-    	print __METHOD__." result=".$result."\n";
139
-    	return $result;
128
+        global $conf,$user,$langs,$db;
129
+        $conf=$this->savconf;
130
+        $user=$this->savuser;
131
+        $langs=$this->savlangs;
132
+        $db=$this->savdb;
133
+
134
+        $localobject=new FormAdmin($this->savdb);
135
+        $result=$localobject->select_paper_format('','paperformat_id','A4');
136
+
137
+        $this->assertEquals($result, '<select class="flat" id="paperformat_id" name="paperformat_id"><option value="EUA4">Format A4 - 210x297 mm</option></select>');
138
+        print __METHOD__." result=".$result."\n";
139
+        return $result;
140 140
     }
141 141
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/ProjectTest.php 1 patch
Indentation   +107 added lines, -107 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,75 +48,75 @@  discard block
 block discarded – undo
48 48
  */
49 49
 class ProjectTest 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 ProjectTest
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 ProjectTest
61
+     */
62
+    function __construct()
80 63
     {
81
-    	global $conf,$user,$langs,$db;
82
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
64
+        parent::__construct();
83 65
 
84
-    	print __METHOD__."\n";
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
+        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
83
+
84
+        print __METHOD__."\n";
85 85
     }
86 86
 
87 87
     // tear down after class
88 88
     public static function tearDownAfterClass()
89 89
     {
90
-    	global $conf,$user,$langs,$db;
91
-		$db->rollback();
90
+        global $conf,$user,$langs,$db;
91
+        $db->rollback();
92 92
 
93
-		print __METHOD__."\n";
93
+        print __METHOD__."\n";
94 94
     }
95 95
 
96
-	/**
97
-	 * Init phpunit tests
98
-	 *
99
-	 * @return	void
100
-	 */
96
+    /**
97
+     * Init phpunit tests
98
+     *
99
+     * @return	void
100
+     */
101 101
     protected function setUp()
102 102
     {
103
-    	global $conf,$user,$langs,$db;
104
-		$conf=$this->savconf;
105
-		$user=$this->savuser;
106
-		$langs=$this->savlangs;
107
-		$db=$this->savdb;
108
-
109
-		print __METHOD__."\n";
110
-		//print $db->getVersion()."\n";
103
+        global $conf,$user,$langs,$db;
104
+        $conf=$this->savconf;
105
+        $user=$this->savuser;
106
+        $langs=$this->savlangs;
107
+        $db=$this->savdb;
108
+
109
+        print __METHOD__."\n";
110
+        //print $db->getVersion()."\n";
111 111
     }
112
-	/**
113
-	 * End phpunit tests
114
-	 *
115
-	 * @return	void
116
-	 */
112
+    /**
113
+     * End phpunit tests
114
+     *
115
+     * @return	void
116
+     */
117 117
     protected function tearDown()
118 118
     {
119
-    	print __METHOD__."\n";
119
+        print __METHOD__."\n";
120 120
     }
121 121
 
122 122
     /**
@@ -126,19 +126,19 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function testProjectCreate()
128 128
     {
129
-    	global $conf,$user,$langs,$db;
130
-		$conf=$this->savconf;
131
-		$user=$this->savuser;
132
-		$langs=$this->savlangs;
133
-		$db=$this->savdb;
134
-
135
-		$localobject=new Project($this->savdb);
136
-    	$localobject->initAsSpecimen();
137
-    	$result=$localobject->create($user);
138
-
139
-    	$this->assertLessThan($result, 0);
140
-    	print __METHOD__." result=".$result."\n";
141
-    	return $result;
129
+        global $conf,$user,$langs,$db;
130
+        $conf=$this->savconf;
131
+        $user=$this->savuser;
132
+        $langs=$this->savlangs;
133
+        $db=$this->savdb;
134
+
135
+        $localobject=new Project($this->savdb);
136
+        $localobject->initAsSpecimen();
137
+        $result=$localobject->create($user);
138
+
139
+        $this->assertLessThan($result, 0);
140
+        print __METHOD__." result=".$result."\n";
141
+        return $result;
142 142
     }
143 143
 
144 144
     /**
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function testProjectFetch($id)
154 154
     {
155
-    	global $conf,$user,$langs,$db;
156
-		$conf=$this->savconf;
157
-		$user=$this->savuser;
158
-		$langs=$this->savlangs;
159
-		$db=$this->savdb;
160
-
161
-		$localobject=new Project($this->savdb);
162
-    	$result=$localobject->fetch($id);
163
-
164
-    	$this->assertLessThan($result, 0);
165
-    	print __METHOD__." id=".$id." result=".$result."\n";
166
-    	return $localobject;
155
+        global $conf,$user,$langs,$db;
156
+        $conf=$this->savconf;
157
+        $user=$this->savuser;
158
+        $langs=$this->savlangs;
159
+        $db=$this->savdb;
160
+
161
+        $localobject=new Project($this->savdb);
162
+        $result=$localobject->fetch($id);
163
+
164
+        $this->assertLessThan($result, 0);
165
+        print __METHOD__." id=".$id." result=".$result."\n";
166
+        return $localobject;
167 167
     }
168 168
 
169 169
     /**
@@ -177,20 +177,20 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function testProjectValid($localobject)
179 179
     {
180
-    	global $conf,$user,$langs,$db;
181
-		$conf=$this->savconf;
182
-		$user=$this->savuser;
183
-		$langs=$this->savlangs;
184
-		$db=$this->savdb;
180
+        global $conf,$user,$langs,$db;
181
+        $conf=$this->savconf;
182
+        $user=$this->savuser;
183
+        $langs=$this->savlangs;
184
+        $db=$this->savdb;
185 185
 
186
-    	$result=$localobject->setValid($user);
186
+        $result=$localobject->setValid($user);
187 187
 
188
-    	print __METHOD__." id=".$localobject->id." result=".$result."\n";
189
-    	$this->assertLessThan($result, 0);
190
-    	return $localobject;
188
+        print __METHOD__." id=".$localobject->id." result=".$result."\n";
189
+        $this->assertLessThan($result, 0);
190
+        return $localobject;
191 191
     }
192 192
 
193
-	/**
193
+    /**
194 194
      * testProjectClose
195 195
      *
196 196
      * @param	Project	$localobject	Project
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 
210 210
         $result=$localobject->setClose($user);
211 211
 
212
-    	print __METHOD__." id=".$localobject->id." result=".$result."\n";
213
-    	$this->assertLessThan($result, 0);
212
+        print __METHOD__." id=".$localobject->id." result=".$result."\n";
213
+        $this->assertLessThan($result, 0);
214 214
         return $localobject->id;
215 215
     }
216 216
 
@@ -225,18 +225,18 @@  discard block
 block discarded – undo
225 225
      */
226 226
     public function testProjectDelete($id)
227 227
     {
228
-    	global $conf,$user,$langs,$db;
229
-		$conf=$this->savconf;
230
-		$user=$this->savuser;
231
-		$langs=$this->savlangs;
232
-		$db=$this->savdb;
233
-
234
-		$localobject=new Project($this->savdb);
235
-    	$result=$localobject->fetch($id);
236
-		$result=$localobject->delete($user);
237
-
238
-		print __METHOD__." id=".$id." result=".$result."\n";
239
-    	$this->assertLessThan($result, 0);
240
-    	return $result;
228
+        global $conf,$user,$langs,$db;
229
+        $conf=$this->savconf;
230
+        $user=$this->savuser;
231
+        $langs=$this->savlangs;
232
+        $db=$this->savdb;
233
+
234
+        $localobject=new Project($this->savdb);
235
+        $result=$localobject->fetch($id);
236
+        $result=$localobject->delete($user);
237
+
238
+        print __METHOD__." id=".$id." result=".$result."\n";
239
+        $this->assertLessThan($result, 0);
240
+        return $result;
241 241
     }
242 242
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/Functions2LibTest.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
      */
64 64
     function __construct()
65 65
     {
66
-    	parent::__construct();
66
+        parent::__construct();
67 67
 
68
-    	//$this->sharedFixture
68
+        //$this->sharedFixture
69 69
         global $conf,$user,$langs,$db;
70 70
         $this->savconf=$conf;
71 71
         $this->savuser=$user;
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 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 105
         global $conf,$user,$langs,$db;
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 
111 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 120
         print __METHOD__."\n";
@@ -149,62 +149,62 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public function testIsValidUrl()
151 151
     {
152
-	    //Simple check
153
-	    $result = isValidUrl('http://google.com');
154
-	    $this->assertEquals(1, $result);
152
+        //Simple check
153
+        $result = isValidUrl('http://google.com');
154
+        $this->assertEquals(1, $result);
155 155
 
156
-	    $result = isValidUrl('goo=gle');	// This is good, it might be an alias of hostname
157
-	    $this->assertEquals(1, $result);
156
+        $result = isValidUrl('goo=gle');	// This is good, it might be an alias of hostname
157
+        $this->assertEquals(1, $result);
158 158
 
159
-	    //With scheme check
160
-    	$result = isValidUrl('http://www.google.com', 1);
161
-	    $this->assertEquals(1, $result);
159
+        //With scheme check
160
+        $result = isValidUrl('http://www.google.com', 1);
161
+        $this->assertEquals(1, $result);
162 162
 
163
-	    $result = isValidUrl('ftp://www.google.com', 1);
164
-	    $this->assertEquals(0, $result);
163
+        $result = isValidUrl('ftp://www.google.com', 1);
164
+        $this->assertEquals(0, $result);
165 165
 
166
-	    //With password check invalid. This test should be ko but currently it is not
167
-	    //$result = isValidUrl('http://user:password@http://www.google.com', 1, 1);
168
-	    //$this->assertEquals(0, $result);
166
+        //With password check invalid. This test should be ko but currently it is not
167
+        //$result = isValidUrl('http://user:password@http://www.google.com', 1, 1);
168
+        //$this->assertEquals(0, $result);
169 169
 
170
-	    //With password check valid
171
-	    $result = isValidUrl('http://user:[email protected]', 1, 1);
172
-	    $this->assertEquals(1, $result);
170
+        //With password check valid
171
+        $result = isValidUrl('http://user:[email protected]', 1, 1);
172
+        $this->assertEquals(1, $result);
173 173
 
174
-	    $result = isValidUrl('http://www.google.com', 1, 1);
175
-	    $this->assertEquals(0, $result);
174
+        $result = isValidUrl('http://www.google.com', 1, 1);
175
+        $this->assertEquals(0, $result);
176 176
 
177
-	    //With port check
178
-	    $result = isValidUrl('http://google.com:8080', 0, 0, 1);
179
-	    $this->assertEquals(1, $result);
177
+        //With port check
178
+        $result = isValidUrl('http://google.com:8080', 0, 0, 1);
179
+        $this->assertEquals(1, $result);
180 180
 
181
-	    $result = isValidUrl('http://google.com', 0, 0, 1);
182
-	    $this->assertEquals(0, $result);
181
+        $result = isValidUrl('http://google.com', 0, 0, 1);
182
+        $this->assertEquals(0, $result);
183 183
 
184
-	    //With path check
185
-	    $result = isValidUrl('http://google.com/search', 0, 0, 0, 1);
186
-	    $this->assertEquals(1, $result);
184
+        //With path check
185
+        $result = isValidUrl('http://google.com/search', 0, 0, 0, 1);
186
+        $this->assertEquals(1, $result);
187 187
 
188
-	    $result = isValidUrl('http://google.com', 0, 0, 0, 0);
189
-	    $this->assertEquals(1, $result);
188
+        $result = isValidUrl('http://google.com', 0, 0, 0, 0);
189
+        $this->assertEquals(1, $result);
190 190
 
191
-	    //With query check
192
-	    $result = isValidUrl('http://google.com/search?test=test', 0, 0, 0, 0, 1);
193
-	    $this->assertEquals(1, $result);
191
+        //With query check
192
+        $result = isValidUrl('http://google.com/search?test=test', 0, 0, 0, 0, 1);
193
+        $this->assertEquals(1, $result);
194 194
 
195
-	    //With query check
196
-	    $result = isValidUrl('http://google.com?test=test', 0, 0, 0, 0, 1);
197
-	    $this->assertEquals(1, $result);
195
+        //With query check
196
+        $result = isValidUrl('http://google.com?test=test', 0, 0, 0, 0, 1);
197
+        $this->assertEquals(1, $result);
198 198
 
199
-	    $result = isValidUrl('http://google.com', 0, 0, 0, 0, 1);
200
-	    $this->assertEquals(0, $result);
199
+        $result = isValidUrl('http://google.com', 0, 0, 0, 0, 1);
200
+        $this->assertEquals(0, $result);
201 201
 
202
-	    //With anchor check
203
-	    $result = isValidUrl('http://google.com/search#done', 0, 0, 0, 0, 0, 1);
204
-	    $this->assertEquals(1, $result);
202
+        //With anchor check
203
+        $result = isValidUrl('http://google.com/search#done', 0, 0, 0, 0, 0, 1);
204
+        $this->assertEquals(1, $result);
205 205
 
206
-	    $result = isValidUrl('http://google.com/search', 0, 0, 0, 0, 0, 1);
207
-	    $this->assertEquals(0, $result);
206
+        $result = isValidUrl('http://google.com/search', 0, 0, 0, 0, 0, 1);
207
+        $this->assertEquals(0, $result);
208 208
     }
209 209
 
210 210
     /**
@@ -214,33 +214,33 @@  discard block
 block discarded – undo
214 214
      */
215 215
     public function testIsIP()
216 216
     {
217
-    	// Not valid
218
-    	$ip='a299.299.299.299';
219
-    	$result=is_ip($ip);
217
+        // Not valid
218
+        $ip='a299.299.299.299';
219
+        $result=is_ip($ip);
220 220
         print __METHOD__." for ".$ip." result=".$result."\n";
221
-    	$this->assertEquals(0,$result,$ip);
221
+        $this->assertEquals(0,$result,$ip);
222 222
 
223
-    	// Reserved IP range (not checked by is_ip function)
224
-    	$ip='169.254.0.0';
225
-    	$result=is_ip($ip);
223
+        // Reserved IP range (not checked by is_ip function)
224
+        $ip='169.254.0.0';
225
+        $result=is_ip($ip);
226 226
         print __METHOD__." for ".$ip." result=".$result."\n";
227
-    	//$this->assertEquals(2,$result,$ip);      // Assertion disabled because returned value differs between PHP patch version
227
+        //$this->assertEquals(2,$result,$ip);      // Assertion disabled because returned value differs between PHP patch version
228 228
 
229
-    	$ip='1.2.3.4';
230
-    	$result=is_ip($ip);
229
+        $ip='1.2.3.4';
230
+        $result=is_ip($ip);
231 231
         print __METHOD__." for ".$ip." result=".$result."\n";
232
-    	$this->assertEquals(1,$result,$ip);
232
+        $this->assertEquals(1,$result,$ip);
233 233
 
234
-    	// Private IP ranges
235
-    	$ip='10.0.0.0';
236
-    	$result=is_ip($ip);
234
+        // Private IP ranges
235
+        $ip='10.0.0.0';
236
+        $result=is_ip($ip);
237 237
         print __METHOD__." for ".$ip." result=".$result."\n";
238
-    	$this->assertEquals(2,$result,$ip);
238
+        $this->assertEquals(2,$result,$ip);
239 239
 
240
-    	$ip='172.16.0.0';
241
-    	$result=is_ip($ip);
240
+        $ip='172.16.0.0';
241
+        $result=is_ip($ip);
242 242
         print __METHOD__." for ".$ip." result=".$result."\n";
243
-    	$this->assertEquals(2,$result,$ip);
243
+        $this->assertEquals(2,$result,$ip);
244 244
 
245 245
         $ip='192.168.0.0';
246 246
         $result=is_ip($ip);
Please login to merge, or discard this patch.
dolibarr/test/phpunit/SecurityTest.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -59,75 +59,75 @@  discard block
 block discarded – undo
59 59
  */
60 60
 class SecurityTest 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()
91 74
     {
92
-    	global $conf,$user,$langs,$db;
93
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
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
+    {
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,16 +137,16 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function testGETPOST()
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
         $_COOKIE["id"]=111;
147
-		$_GET["param1"]="222";
147
+        $_GET["param1"]="222";
148 148
         $_POST["param1"]="333";
149
-		$_GET["param2"]='a/b#e(pr)qq-rr\cc';
149
+        $_GET["param2"]='a/b#e(pr)qq-rr\cc';
150 150
         $_GET["param3"]='"a/b#e(pr)qq-rr\cc';    // Same than param2 + "
151 151
         $_GET["param4"]='../dir';
152 152
         $_GET["param5"]="a_1-b";
@@ -288,16 +288,16 @@  discard block
 block discarded – undo
288 288
      */
289 289
     public function testRestrictedArea()
290 290
     {
291
-    	global $conf,$user,$langs,$db;
292
-		$conf=$this->savconf;
293
-		$user=$this->savuser;
294
-		$langs=$this->savlangs;
295
-		$db=$this->savdb;
291
+        global $conf,$user,$langs,$db;
292
+        $conf=$this->savconf;
293
+        $user=$this->savuser;
294
+        $langs=$this->savlangs;
295
+        $db=$this->savdb;
296 296
 
297
-		//$dummyuser=new User($db);
298
-		//$result=restrictedArea($dummyuser,'societe');
297
+        //$dummyuser=new User($db);
298
+        //$result=restrictedArea($dummyuser,'societe');
299 299
 
300
-		$result=restrictedArea($user,'societe');
301
-		$this->assertEquals(1,$result);
300
+        $result=restrictedArea($user,'societe');
301
+        $this->assertEquals(1,$result);
302 302
     }
303 303
 }
Please login to merge, or discard this patch.
dolibarr/test/phpunit/ContratTest.php 1 patch
Indentation   +90 added lines, -90 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 ContratTest extends PHPUnit_Framework_TestCase
49 49
 {
50
-	protected $savconf;
51
-	protected $savuser;
52
-	protected $savlangs;
53
-	protected $savdb;
54
-
55
-	/**
56
-	 * Constructor
57
-	 * We save global variables into local variables
58
-	 *
59
-	 * @return ContratTest
60
-	 */
61
-	function __construct()
62
-	{
63
-		parent::__construct();
64
-
65
-		//$this->sharedFixture
66
-		global $conf,$user,$langs,$db;
67
-		$this->savconf=$conf;
68
-		$this->savuser=$user;
69
-		$this->savlangs=$langs;
70
-		$this->savdb=$db;
71
-
72
-		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
-		//print " - db ".$db->db;
74
-		print "\n";
75
-	}
76
-
77
-	// Static methods
78
-  	public static function setUpBeforeClass()
50
+    protected $savconf;
51
+    protected $savuser;
52
+    protected $savlangs;
53
+    protected $savdb;
54
+
55
+    /**
56
+     * Constructor
57
+     * We save global variables into local variables
58
+     *
59
+     * @return ContratTest
60
+     */
61
+    function __construct()
79 62
     {
80
-    	global $conf,$user,$langs,$db;
81
-		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
63
+        parent::__construct();
82 64
 
83
-    	print __METHOD__."\n";
65
+        //$this->sharedFixture
66
+        global $conf,$user,$langs,$db;
67
+        $this->savconf=$conf;
68
+        $this->savuser=$user;
69
+        $this->savlangs=$langs;
70
+        $this->savdb=$db;
71
+
72
+        print __METHOD__." db->type=".$db->type." user->id=".$user->id;
73
+        //print " - db ".$db->db;
74
+        print "\n";
75
+    }
76
+
77
+    // Static methods
78
+        public static function setUpBeforeClass()
79
+    {
80
+        global $conf,$user,$langs,$db;
81
+        $db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
82
+
83
+        print __METHOD__."\n";
84 84
     }
85 85
 
86 86
     // tear down after class
87 87
     public static function tearDownAfterClass()
88 88
     {
89
-    	global $conf,$user,$langs,$db;
90
-		$db->rollback();
89
+        global $conf,$user,$langs,$db;
90
+        $db->rollback();
91 91
 
92
-		print __METHOD__."\n";
92
+        print __METHOD__."\n";
93 93
     }
94 94
 
95
-	/**
96
-	 * Init phpunit tests
97
-	 *
98
-	 * @return	void
99
-	 */
95
+    /**
96
+     * Init phpunit tests
97
+     *
98
+     * @return	void
99
+     */
100 100
     protected function setUp()
101 101
     {
102
-    	global $conf,$user,$langs,$db;
103
-		$conf=$this->savconf;
104
-		$user=$this->savuser;
105
-		$langs=$this->savlangs;
106
-		$db=$this->savdb;
102
+        global $conf,$user,$langs,$db;
103
+        $conf=$this->savconf;
104
+        $user=$this->savuser;
105
+        $langs=$this->savlangs;
106
+        $db=$this->savdb;
107 107
 
108
-		print __METHOD__."\n";
108
+        print __METHOD__."\n";
109 109
     }
110
-	/**
111
-	 * End phpunit tests
112
-	 *
113
-	 * @return	void
114
-	 */
110
+    /**
111
+     * End phpunit tests
112
+     *
113
+     * @return	void
114
+     */
115 115
     protected function tearDown()
116 116
     {
117
-    	print __METHOD__."\n";
117
+        print __METHOD__."\n";
118 118
     }
119 119
 
120 120
     /**
@@ -124,20 +124,20 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function testContratCreate()
126 126
     {
127
-    	global $conf,$user,$langs,$db;
128
-		$conf=$this->savconf;
129
-		$user=$this->savuser;
130
-		$langs=$this->savlangs;
131
-		$db=$this->savdb;
127
+        global $conf,$user,$langs,$db;
128
+        $conf=$this->savconf;
129
+        $user=$this->savuser;
130
+        $langs=$this->savlangs;
131
+        $db=$this->savdb;
132 132
 
133
-		$localobject=new Contrat($this->savdb);
134
-    	$localobject->initAsSpecimen();
135
-    	$result=$localobject->create($user);
133
+        $localobject=new Contrat($this->savdb);
134
+        $localobject->initAsSpecimen();
135
+        $result=$localobject->create($user);
136 136
 
137
-    	print __METHOD__." result=".$result."\n";
138
-    	$this->assertLessThan($result, 0);
137
+        print __METHOD__." result=".$result."\n";
138
+        $this->assertLessThan($result, 0);
139 139
 
140
-    	return $result;
140
+        return $result;
141 141
     }
142 142
 
143 143
     /**
@@ -151,22 +151,22 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function testContratFetch($id)
153 153
     {
154
-    	global $conf,$user,$langs,$db;
155
-		$conf=$this->savconf;
156
-		$user=$this->savuser;
157
-		$langs=$this->savlangs;
158
-		$db=$this->savdb;
154
+        global $conf,$user,$langs,$db;
155
+        $conf=$this->savconf;
156
+        $user=$this->savuser;
157
+        $langs=$this->savlangs;
158
+        $db=$this->savdb;
159 159
 
160
-		$localobject=new Contrat($this->savdb);
161
-    	$result=$localobject->fetch($id);
160
+        $localobject=new Contrat($this->savdb);
161
+        $result=$localobject->fetch($id);
162 162
 
163
-    	print __METHOD__." id=".$id." result=".$result."\n";
164
-    	$this->assertLessThan($result, 0);
163
+        print __METHOD__." id=".$id." result=".$result."\n";
164
+        $this->assertLessThan($result, 0);
165 165
 
166
-    	return $localobject;
166
+        return $localobject;
167 167
     }
168 168
 
169
-   /**
169
+    /**
170 170
      * testContratOther
171 171
      *
172 172
      * @param	Object	$localobject	Object contract
@@ -206,18 +206,18 @@  discard block
 block discarded – undo
206 206
      */
207 207
     public function testContratDelete($id)
208 208
     {
209
-    	global $conf,$user,$langs,$db;
210
-		$conf=$this->savconf;
211
-		$user=$this->savuser;
212
-		$langs=$this->savlangs;
213
-		$db=$this->savdb;
214
-
215
-		$localobject=new Contrat($this->savdb);
216
-    	$result=$localobject->fetch($id);
217
-		$result=$localobject->delete($user);
218
-
219
-		print __METHOD__." id=".$id." result=".$result."\n";
220
-    	$this->assertLessThan($result, 0);
221
-    	return $result;
209
+        global $conf,$user,$langs,$db;
210
+        $conf=$this->savconf;
211
+        $user=$this->savuser;
212
+        $langs=$this->savlangs;
213
+        $db=$this->savdb;
214
+
215
+        $localobject=new Contrat($this->savdb);
216
+        $result=$localobject->fetch($id);
217
+        $result=$localobject->delete($user);
218
+
219
+        print __METHOD__." id=".$id." result=".$result."\n";
220
+        $this->assertLessThan($result, 0);
221
+        return $result;
222 222
     }
223 223
 }
Please login to merge, or discard this patch.