From 2a4cdad5cf08463c06aee8783386d608ae2a41ca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Jun 2023 20:05:54 +0200 Subject: [PATCH 1/3] Fix phpunit --- test/phpunit/CodingPhpTest.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 924191ffb59..836c59fde49 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -268,20 +268,22 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase // Check if a var_dump has been forgotten if (!preg_match('/test\/phpunit/', $file['fullname'])) { - $ok=true; - $matches=array(); - preg_match_all('/(.)\s*var_dump\(/', $filecontent, $matches, PREG_SET_ORDER); - //var_dump($matches); - foreach ($matches as $key => $val) { - if ($val[1] != '/' && $val[1] != '*') { - $ok=false; + if (! in_array($file['name'], array('class.nusoap_base.php'))) { + $ok=true; + $matches=array(); + preg_match_all('/(.)\s*var_dump\(/', $filecontent, $matches, PREG_SET_ORDER); + //var_dump($matches); + foreach ($matches as $key => $val) { + if ($val[1] != '/' && $val[1] != '*') { + $ok=false; + break; + } break; } - break; + //print __METHOD__." Result for checking we don't have non escaped string in sql requests for file ".$file."\n"; + $this->assertTrue($ok, 'Found string var_dump that is not just after /* or // in '.$file['relativename']); + //exit; } - //print __METHOD__." Result for checking we don't have non escaped string in sql requests for file ".$file."\n"; - $this->assertTrue($ok, 'Found string var_dump that is not just after /* or // in '.$file['relativename']); - //exit; } // Check get_class followed by __METHOD__ From 74fa309b80fb58b9b38d1fe8e3959eebae0ad15a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Jun 2023 20:07:46 +0200 Subject: [PATCH 2/3] Fix CI --- test/phpunit/CodingPhpTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 836c59fde49..a3873b2614d 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -176,22 +176,22 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase $filesarray = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, '\.php', null, 'fullname', SORT_ASC, 0, 1, '', 1); foreach ($filesarray as $key => $file) { - if (preg_match('/\/htdocs\/includes\//', $file['fullname'])) { + if (preg_match('/\/(htdocs|html)\/includes\//', $file['fullname'])) { continue; } - if (preg_match('/\/htdocs\/install\/doctemplates\/websites\//', $file['fullname'])) { + if (preg_match('/\/(htdocs|html)\/install\/doctemplates\/websites\//', $file['fullname'])) { continue; } - if (preg_match('/\/htdocs\/custom\//', $file['fullname'])) { + if (preg_match('/\/(htdocs|html)\/custom\//', $file['fullname'])) { continue; } - if (preg_match('/\/htdocs\/dolimed/', $file['fullname'])) { + if (preg_match('/\/(htdocs|html)\/dolimed/', $file['fullname'])) { continue; } - if (preg_match('/\/htdocs\/nltechno/', $file['fullname'])) { + if (preg_match('/\/(htdocs|html)\/nltechno/', $file['fullname'])) { continue; } - if (preg_match('/\/htdocs\/teclib/', $file['fullname'])) { + if (preg_match('/\/(htdocs|html)\/teclib/', $file['fullname'])) { continue; } From 833c798bf59cb6015bf783e74ba8ca99b6223652 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Jun 2023 20:23:09 +0200 Subject: [PATCH 3/3] Test CI --- test/phpunit/AllTests.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index 2d321752fe9..076389ece38 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -54,7 +54,7 @@ if (empty($user->id)) { $user->getrights(); } $conf->global->MAIN_DISABLE_ALL_MAILS=1; - +$conf->global->MAIN_UMASK='666'; /**