Completed
Branch develop (b3a2d1)
by
unknown
18:27
created
test/phpunit/CodingPhpTest.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *      \remarks    To run this script as CLI:  phpunit filename.php
26 26
  */
27 27
 
28
-global $conf,$user,$langs,$db;
28
+global $conf, $user, $langs, $db;
29 29
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
30 30
 //require_once 'PHPUnit/Autoload.php';
31 31
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -33,35 +33,35 @@  discard block
 block discarded – undo
33 33
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php';
34 34
 require_once dirname(__FILE__).'/CommonClassTest.class.php';
35 35
 
36
-if (! defined('NOREQUIREUSER')) {
36
+if (!defined('NOREQUIREUSER')) {
37 37
 	define('NOREQUIREUSER', '1');
38 38
 }
39
-if (! defined('NOREQUIREDB')) {
39
+if (!defined('NOREQUIREDB')) {
40 40
 	define('NOREQUIREDB', '1');
41 41
 }
42
-if (! defined('NOREQUIRESOC')) {
42
+if (!defined('NOREQUIRESOC')) {
43 43
 	define('NOREQUIRESOC', '1');
44 44
 }
45
-if (! defined('NOREQUIRETRAN')) {
45
+if (!defined('NOREQUIRETRAN')) {
46 46
 	define('NOREQUIRETRAN', '1');
47 47
 }
48
-if (! defined('NOCSRFCHECK')) {
48
+if (!defined('NOCSRFCHECK')) {
49 49
 	define('NOCSRFCHECK', '1');
50 50
 }
51
-if (! defined('NOTOKENRENEWAL')) {
51
+if (!defined('NOTOKENRENEWAL')) {
52 52
 	define('NOTOKENRENEWAL', '1');
53 53
 }
54
-if (! defined('NOREQUIREMENU')) {
54
+if (!defined('NOREQUIREMENU')) {
55 55
 	define('NOREQUIREMENU', '1'); // If there is no menu to show
56 56
 }
57
-if (! defined('NOREQUIREHTML')) {
57
+if (!defined('NOREQUIREHTML')) {
58 58
 	define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
59 59
 }
60
-if (! defined('NOREQUIREAJAX')) {
60
+if (!defined('NOREQUIREAJAX')) {
61 61
 	define('NOREQUIREAJAX', '1');
62 62
 }
63
-if (! defined("NOLOGIN")) {
64
-	define("NOLOGIN", '1');       // If this page is public (can be called outside logged session)
63
+if (!defined("NOLOGIN")) {
64
+	define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
65 65
 }
66 66
 
67 67
 if (empty($user->id)) {
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 			}
113 113
 		));
114 114
 		*/
115
-		return array_map(function ($value) {
115
+		return array_map(function($value) {
116 116
 			return array($value);
117 117
 		}, $filesarray);
118 118
 	}
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			|| preg_match('/modules\/(import|mailings|printing)\//', $file['relativename'])
146 146
 			|| in_array($file['name'], array('modules_boxes.php', 'TraceableDB.php'))) {
147 147
 			// Check Class files
148
-			if (! in_array($file['name'], array(
148
+			if (!in_array($file['name'], array(
149 149
 				'api.class.php',
150 150
 				'commonobject.class.php',
151 151
 				'conf.class.php',
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 				//exit;
170 170
 			}
171 171
 
172
-			if (preg_match('/\.class\.php$/', $file['relativename']) && ! in_array($file['relativename'], array(
172
+			if (preg_match('/\.class\.php$/', $file['relativename']) && !in_array($file['relativename'], array(
173 173
 				'adherents/canvas/actions_adherentcard_common.class.php',
174 174
 				'contact/canvas/actions_contactcard_common.class.php',
175 175
 				'compta/facture/class/facture.class.php',
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			}
212 212
 		} else {
213 213
 			// Check Include files
214
-			if (! in_array($file['name'], array(
214
+			if (!in_array($file['name'], array(
215 215
 				'objectline_view.tpl.php',
216 216
 				'extrafieldsinexport.inc.php',
217 217
 				'extrafieldsinimport.inc.php',
@@ -372,9 +372,9 @@  discard block
 block discarded – undo
372 372
 		$found = "";
373 373
 		preg_match_all('/(sql|SET|WHERE|INSERT|VALUES|LIKE).+\s*\'"\s*\.\s*\$(.......)/', $filecontent, $matches, PREG_SET_ORDER);
374 374
 		foreach ($matches as $key => $val) {
375
-			if (! in_array($val[2], array('this->d', 'this->e', 'db->esc', 'dbs->es', 'dbs->id', 'mydb->e', 'dbsessi', 'db->ida', 'escaped', 'exclude', 'include'))) {
375
+			if (!in_array($val[2], array('this->d', 'this->e', 'db->esc', 'dbs->es', 'dbs->id', 'mydb->e', 'dbsessi', 'db->ida', 'escaped', 'exclude', 'include'))) {
376 376
 				$found = $val[0];
377
-				$ok = false;	// This will generate error
377
+				$ok = false; // This will generate error
378 378
 				break;
379 379
 			}
380 380
 			//if ($reg[0] != 'db') $ok=false;
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 		$found = "";
390 390
 		preg_match_all('/(\$sql|SET\s|WHERE\s|INSERT\s|VALUES\s|VALUES\().+\s*\'\s*\.\s*\$(.........)/', $filecontent, $matches, PREG_SET_ORDER);
391 391
 		foreach ($matches as $key => $val) {
392
-			if (! in_array($val[2], array('this->db-', 'db->prefi', 'db->sanit', 'dbs->pref', 'dbs->sani', 'conf->ent', 'key : \'\')', 'key])."\')', 'excludefi', 'regexstri', ''))) {
392
+			if (!in_array($val[2], array('this->db-', 'db->prefi', 'db->sanit', 'dbs->pref', 'dbs->sani', 'conf->ent', 'key : \'\')', 'key])."\')', 'excludefi', 'regexstri', ''))) {
393 393
 				$found = $val[0];
394 394
 				$ok = false;
395 395
 				var_dump($matches);
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 	{
722 722
 		return preg_replace_callback(
723 723
 			'{(//.*?$)|(/\*.*?\*/)}ms',
724
-			static function ($match) {
724
+			static function($match) {
725 725
 				if (isset($match[2])) {
726 726
 					// Count the number of newline characters in the comment
727 727
 					$num_newlines = substr_count($match[0], "\n");
Please login to merge, or discard this patch.