diff --git a/scripts/doc/regenerate_docs.php b/scripts/doc/regenerate_docs.php
index e76cc615298..e4aa60b1e4a 100755
--- a/scripts/doc/regenerate_docs.php
+++ b/scripts/doc/regenerate_docs.php
@@ -140,7 +140,8 @@ if ($tmpobject) {
}
if ($result < 0) {
$nbko++;
- } if ($result == 0) {
+ }
+ if ($result == 0) {
print 'File for ref '.$tmpobject->ref.' returned 0 during regeneration with template '.$tmpobject->model_pdf."\n";
$nbok++;
} else {
diff --git a/test/other/test_dol_escape_htmltag.php b/test/other/test_dol_escape_htmltag.php
index 1b73f885a98..ab0c913d882 100755
--- a/test/other/test_dol_escape_htmltag.php
+++ b/test/other/test_dol_escape_htmltag.php
@@ -6,9 +6,15 @@ $path = __DIR__ . '/';
$res=@include_once $path.'/../htdocs/master.inc.php';
$res=@include_once $path.'/../../htdocs/master.inc.php';
-if (! $res) @include_once '../../master.inc.php';
-if (! $res) @include_once '../master.inc.php';
-if (! $res) @include_once './master.inc.php';
+if (! $res) {
+ @include_once '../../master.inc.php';
+}
+if (! $res) {
+ @include_once '../master.inc.php';
+}
+if (! $res) {
+ @include_once './master.inc.php';
+}
// Show information
diff --git a/test/other/test_serialize.php b/test/other/test_serialize.php
index 74d1d40e025..3fede8fd2a9 100644
--- a/test/other/test_serialize.php
+++ b/test/other/test_serialize.php
@@ -6,9 +6,15 @@ $path = __DIR__ . '/';
$res=@include_once $path.'/../htdocs/master.inc.php';
$res=@include_once $path.'/../../htdocs/master.inc.php';
-if (! $res) @include_once '../../master.inc.php';
-if (! $res) @include_once '../master.inc.php';
-if (! $res) @include_once './master.inc.php';
+if (! $res) {
+ @include_once '../../master.inc.php';
+}
+if (! $res) {
+ @include_once '../master.inc.php';
+}
+if (! $res) {
+ @include_once './master.inc.php';
+}
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
@@ -25,7 +31,9 @@ foreach ($tmp as $key => $value) {
))) {
continue; // Discard if not into a dedicated list
}
- if (!is_object($value)) $object->thirdparty->{$key} = $value;
+ if (!is_object($value)) {
+ $object->thirdparty->{$key} = $value;
+ }
}
diff --git a/test/other/test_uncrypt.php b/test/other/test_uncrypt.php
index f57815aa2a2..339ab9bde69 100755
--- a/test/other/test_uncrypt.php
+++ b/test/other/test_uncrypt.php
@@ -6,9 +6,15 @@ $path = __DIR__ . '/';
$res=@include_once $path.'/../htdocs/master.inc.php';
$res=@include_once $path.'/../../htdocs/master.inc.php';
-if (! $res) @include_once '../../master.inc.php';
-if (! $res) @include_once '../master.inc.php';
-if (! $res) @include_once './master.inc.php';
+if (! $res) {
+ @include_once '../../master.inc.php';
+}
+if (! $res) {
+ @include_once '../master.inc.php';
+}
+if (! $res) {
+ @include_once './master.inc.php';
+}
print "Decode a value crypted with crypted:.... in conf.php file\n";
diff --git a/test/phpunit/AccountingAccountTest.php b/test/phpunit/AccountingAccountTest.php
index 80a793f4d19..8bd7653970b 100644
--- a/test/phpunit/AccountingAccountTest.php
+++ b/test/phpunit/AccountingAccountTest.php
@@ -86,7 +86,8 @@ class AccountingAccountTest extends PHPUnit\Framework\TestCase
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (!isModEnabled('accounting')) {
- print __METHOD__." module accouting must be enabled.\n"; exit(-1);
+ print __METHOD__." module accouting must be enabled.\n";
+ exit(-1);
}
print __METHOD__."\n";
diff --git a/test/phpunit/ActionCommTest.php b/test/phpunit/ActionCommTest.php
index 8f86c13d067..c7ce60fad07 100644
--- a/test/phpunit/ActionCommTest.php
+++ b/test/phpunit/ActionCommTest.php
@@ -86,7 +86,8 @@ class ActionCommTest extends PHPUnit\Framework\TestCase
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (!isModEnabled('agenda')) {
- print __METHOD__." module agenda must be enabled.\n"; die(1);
+ print __METHOD__." module agenda must be enabled.\n";
+ die(1);
}
print __METHOD__."\n";
diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php
index 6bd72c297dd..8ced6f41f90 100644
--- a/test/phpunit/AdherentTest.php
+++ b/test/phpunit/AdherentTest.php
@@ -92,10 +92,12 @@ class AdherentTest extends PHPUnit\Framework\TestCase
die(1);
}
if (getDolGlobalString('MAIN_MODULE_LDAP')) {
- print "\n".__METHOD__." module LDAP must be disabled.\n"; die(1);
+ print "\n".__METHOD__." module LDAP must be disabled.\n";
+ die(1);
}
if (getDolGlobalString('MAIN_MODULE_MAILMANSPIP')) {
- print "\n".__METHOD__." module MailmanSpip must be disabled.\n"; die(1);
+ print "\n".__METHOD__." module MailmanSpip must be disabled.\n";
+ die(1);
}
print __METHOD__."\n";
@@ -358,15 +360,15 @@ class AdherentTest extends PHPUnit\Framework\TestCase
return $localobject;
}
- /**
- * testAdherentSetUserId
- *
- * @param Adherent $localobject Member instance
- * @return Adherent
- *
- * @depends testAdherentMakeSubstitution
- * The depends says test is run only if previous is ok
- */
+ /**
+ * testAdherentSetUserId
+ *
+ * @param Adherent $localobject Member instance
+ * @return Adherent
+ *
+ * @depends testAdherentMakeSubstitution
+ * The depends says test is run only if previous is ok
+ */
public function testAdherentSetUserId(Adherent $localobject)
{
global $conf,$user,$langs,$db;
diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php
index 6deaafd7707..5a5c2f48b02 100644
--- a/test/phpunit/AllTests.php
+++ b/test/phpunit/AllTests.php
@@ -237,18 +237,18 @@ class AllTests
// Test only with php7.2 or less
//if ((float) phpversion() < 7.3)
//{
- require_once dirname(__FILE__).'/WebservicesProductsTest.php';
- $suite->addTestSuite('WebservicesProductsTest');
- require_once dirname(__FILE__).'/WebservicesInvoicesTest.php';
- $suite->addTestSuite('WebservicesInvoicesTest');
- require_once dirname(__FILE__).'/WebservicesOrdersTest.php';
- $suite->addTestSuite('WebservicesOrdersTest');
- require_once dirname(__FILE__).'/WebservicesOtherTest.php';
- $suite->addTestSuite('WebservicesOtherTest');
- require_once dirname(__FILE__).'/WebservicesThirdpartyTest.php';
- $suite->addTestSuite('WebservicesThirdpartyTest');
- require_once dirname(__FILE__).'/WebservicesUserTest.php';
- $suite->addTestSuite('WebservicesUserTest');
+ require_once dirname(__FILE__).'/WebservicesProductsTest.php';
+ $suite->addTestSuite('WebservicesProductsTest');
+ require_once dirname(__FILE__).'/WebservicesInvoicesTest.php';
+ $suite->addTestSuite('WebservicesInvoicesTest');
+ require_once dirname(__FILE__).'/WebservicesOrdersTest.php';
+ $suite->addTestSuite('WebservicesOrdersTest');
+ require_once dirname(__FILE__).'/WebservicesOtherTest.php';
+ $suite->addTestSuite('WebservicesOtherTest');
+ require_once dirname(__FILE__).'/WebservicesThirdpartyTest.php';
+ $suite->addTestSuite('WebservicesThirdpartyTest');
+ require_once dirname(__FILE__).'/WebservicesUserTest.php';
+ $suite->addTestSuite('WebservicesUserTest');
//}
require_once dirname(__FILE__).'/ExportTest.php';
diff --git a/test/phpunit/AssetModelTest.php b/test/phpunit/AssetModelTest.php
index 6572459a5fc..b8a14c144a5 100644
--- a/test/phpunit/AssetModelTest.php
+++ b/test/phpunit/AssetModelTest.php
@@ -82,7 +82,7 @@ class AssetModelTest extends PHPUnit\Framework\TestCase
*
* @return void
*/
- public static function setUpBeforeClass() : void
+ public static function setUpBeforeClass(): void
{
global $conf, $user, $langs, $db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
@@ -95,7 +95,7 @@ class AssetModelTest extends PHPUnit\Framework\TestCase
*
* @return void
*/
- protected function setUp() : void
+ protected function setUp(): void
{
global $conf, $user, $langs, $db;
$conf = $this->savconf;
@@ -111,7 +111,7 @@ class AssetModelTest extends PHPUnit\Framework\TestCase
*
* @return void
*/
- protected function tearDown() : void
+ protected function tearDown(): void
{
print __METHOD__."\n";
}
@@ -121,7 +121,7 @@ class AssetModelTest extends PHPUnit\Framework\TestCase
*
* @return void
*/
- public static function tearDownAfterClass() : void
+ public static function tearDownAfterClass(): void
{
global $conf, $user, $langs, $db;
$db->rollback();
diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php
index 71a5daa35f9..fd2459de0b3 100644
--- a/test/phpunit/BuildDocTest.php
+++ b/test/phpunit/BuildDocTest.php
@@ -115,25 +115,32 @@ class BuildDocTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (!isModEnabled('facture')) {
- print __METHOD__." invoice module not enabled\n"; die(1);
+ print __METHOD__." invoice module not enabled\n";
+ die(1);
}
if (!isModEnabled('commande')) {
- print __METHOD__." order module not enabled\n"; die(1);
+ print __METHOD__." order module not enabled\n";
+ die(1);
}
if (!isModEnabled('propal')) {
- print __METHOD__." propal module not enabled\n"; die(1);
+ print __METHOD__." propal module not enabled\n";
+ die(1);
}
if (!isModEnabled('projet')) {
- print __METHOD__." project module not enabled\n"; die(1);
+ print __METHOD__." project module not enabled\n";
+ die(1);
}
if (!isModEnabled('expedition')) {
- print __METHOD__." shipment module not enabled\n"; die(1);
+ print __METHOD__." shipment module not enabled\n";
+ die(1);
}
if (!isModEnabled('ficheinter')) {
- print __METHOD__." intervention module not enabled\n"; die(1);
+ print __METHOD__." intervention module not enabled\n";
+ die(1);
}
if (!isModEnabled('expensereport')) {
- print __METHOD__." expensereport module not enabled\n"; die(1);
+ print __METHOD__." expensereport module not enabled\n";
+ die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php
index 0be380a15ba..5e19e42eed0 100644
--- a/test/phpunit/CodingPhpTest.php
+++ b/test/phpunit/CodingPhpTest.php
@@ -343,9 +343,9 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
preg_match_all('/\$sql \.= \'\s*VALUES.*\$/', $filecontent, $matches, PREG_SET_ORDER);
foreach ($matches as $key => $val) {
//if ($val[1] != '\'"' && $val[1] != '\'\'') {
- var_dump($matches);
- $ok=false;
- break;
+ var_dump($matches);
+ $ok=false;
+ break;
//}
//if ($reg[0] != 'db') $ok=false;
}
@@ -504,8 +504,8 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
// Check string ='print_liste_field_titre\(\$langs'.
preg_match_all('/print_liste_field_titre\(\$langs/', $filecontent, $matches, PREG_SET_ORDER);
foreach ($matches as $key => $val) {
- $ok=false;
- break;
+ $ok=false;
+ break;
}
$this->assertTrue($ok, 'Found a use of print_liste_field_titre with first parameter that is a translated value instead of just the translation key in file '.$file['relativename'].'. Bad.');
diff --git a/test/phpunit/CommandeFournisseurTest.php b/test/phpunit/CommandeFournisseurTest.php
index 4aba4486244..f378694bb45 100644
--- a/test/phpunit/CommandeFournisseurTest.php
+++ b/test/phpunit/CommandeFournisseurTest.php
@@ -149,7 +149,8 @@ class CommandeFournisseurTest extends PHPUnit\Framework\TestCase
$product=new ProductFournisseur($db);
$product->fetch(0, 'PINKDRESS');
if ($product->id <= 0) {
- print "\n".__METHOD__." A product with ref PINKDRESS must exists into database"; die(1);
+ print "\n".__METHOD__." A product with ref PINKDRESS must exists into database";
+ die(1);
}
$quantity=10;
diff --git a/test/phpunit/CommandeTest.php b/test/phpunit/CommandeTest.php
index 7e7804610ed..e855775a130 100644
--- a/test/phpunit/CommandeTest.php
+++ b/test/phpunit/CommandeTest.php
@@ -86,7 +86,8 @@ class CommandeTest extends PHPUnit\Framework\TestCase
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (!isModEnabled('commande')) {
- print __METHOD__." module customer order must be enabled.\n"; die(1);
+ print __METHOD__." module customer order must be enabled.\n";
+ die(1);
}
print __METHOD__."\n";
diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php
index 428b55de164..c9be8ac347a 100644
--- a/test/phpunit/DateLibTest.php
+++ b/test/phpunit/DateLibTest.php
@@ -517,12 +517,16 @@ class DateLibTest extends PHPUnit\Framework\TestCase
{
global $conf;
- $day=3; $month=2; $year=2015;
+ $day=3;
+ $month=2;
+ $year=2015;
$conf->global->MAIN_START_WEEK = 1; // start on monday
$prev = dol_get_first_day_week($day, $month, $year);
$this->assertEquals(2, (int) $prev['first_day']); // monday for month 2, year 2014 is the 2
- $day=3; $month=2; $year=2015;
+ $day=3;
+ $month=2;
+ $year=2015;
$conf->global->MAIN_START_WEEK = 0; // start on sunday
$prev = dol_get_first_day_week($day, $month, $year);
$this->assertEquals(1, (int) $prev['first_day']); // sunday for month 2, year 2015 is the 1st
diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php
index 5ef30cc07e9..4bdec4b1534 100644
--- a/test/phpunit/EntrepotTest.php
+++ b/test/phpunit/EntrepotTest.php
@@ -85,7 +85,8 @@ class EntrepotTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (!isModEnabled('stock')) {
- print __METHOD__." Module Stock must be enabled.\n"; die(1);
+ print __METHOD__." Module Stock must be enabled.\n";
+ die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/FactureRecTest.php b/test/phpunit/FactureRecTest.php
index 14d2a329aa9..abda040b6eb 100644
--- a/test/phpunit/FactureRecTest.php
+++ b/test/phpunit/FactureRecTest.php
@@ -221,10 +221,10 @@ class FactureRecTest extends PHPUnit\Framework\TestCase
continue;
}
if (! $ignoretype && ($oVarsA[$sKey] !== $oVarsB[$sKey])) {
- $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
+ $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]);
}
if ($ignoretype && ($oVarsA[$sKey] != $oVarsB[$sKey])) {
- $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
+ $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]);
}
}
}
diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php
index 6437c69e1ab..a6806179236 100644
--- a/test/phpunit/FactureTest.php
+++ b/test/phpunit/FactureTest.php
@@ -86,10 +86,12 @@ class FactureTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (!isModEnabled('facture')) {
- print __METHOD__." module customer invoice must be enabled.\n"; die(1);
+ print __METHOD__." module customer invoice must be enabled.\n";
+ die(1);
}
if (isModEnabled('ecotaxdeee')) {
- print __METHOD__." ecotaxdeee module must not be enabled.\n"; die(1);
+ print __METHOD__." ecotaxdeee module must not be enabled.\n";
+ die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
@@ -380,10 +382,10 @@ class FactureTest extends PHPUnit\Framework\TestCase
continue;
}
if (! $ignoretype && ($oVarsA[$sKey] !== $oVarsB[$sKey])) {
- $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
+ $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]);
}
if ($ignoretype && ($oVarsA[$sKey] != $oVarsB[$sKey])) {
- $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
+ $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]);
}
}
}
diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php
index 8f235f3e868..be1365e79c7 100644
--- a/test/phpunit/FilesLibTest.php
+++ b/test/phpunit/FilesLibTest.php
@@ -469,7 +469,9 @@ class FilesLibTest extends PHPUnit\Framework\TestCase
// Test compression of a directory
// $dirout is $conf->admin->dir_temp.'/testdirgz'
$excludefiles = '/(\.back|\.old|\.log|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i';
- if (preg_match($excludefiles, 'a/temp/b')) { echo '----- Regex OK -----'."\n"; }
+ if (preg_match($excludefiles, 'a/temp/b')) {
+ echo '----- Regex OK -----'."\n";
+ }
$result=dol_compress_dir($dirout, $conf->admin->dir_temp.'/testcompressdirzip.zip', 'zip', $excludefiles);
print __METHOD__." dol_compress_dir result=".$result."\n";
print join(', ', $conf->logbuffer);
diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php
index 6509b6e9b72..596dee81378 100644
--- a/test/phpunit/FunctionsLibTest.php
+++ b/test/phpunit/FunctionsLibTest.php
@@ -118,15 +118,18 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
//$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (! function_exists('mb_substr')) {
- print "\n".__METHOD__." function mb_substr must be enabled.\n"; die(1);
+ print "\n".__METHOD__." function mb_substr must be enabled.\n";
+ die(1);
}
if ($conf->global->MAIN_MAX_DECIMALS_UNIT != 5) {
- print "\n".__METHOD__." bad setup for number of digits for unit amount. Must be 5 for this test.\n"; die(1);
+ print "\n".__METHOD__." bad setup for number of digits for unit amount. Must be 5 for this test.\n";
+ die(1);
}
if ($conf->global->MAIN_MAX_DECIMALS_TOT != 2) {
- print "\n".__METHOD__." bad setup for number of digits for unit amount. Must be 2 for this test.\n"; die(1);
+ print "\n".__METHOD__." bad setup for number of digits for unit amount. Must be 2 for this test.\n";
+ die(1);
}
print __METHOD__."\n";
@@ -661,15 +664,18 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
*/
public function testDolConcat()
{
- $text1="A string 1"; $text2="A string 2"; // text 1 and 2 are text, concat need only \n
+ $text1="A string 1";
+ $text2="A string 2"; // text 1 and 2 are text, concat need only \n
$after=dol_concatdesc($text1, $text2);
$this->assertEquals("A string 1\nA string 2", $after);
- $text1="A
string 1"; $text2="A string 2"; // text 1 is html, concat need
\n
+ $text1="A
string 1";
+ $text2="A string 2"; // text 1 is html, concat need
\n
$after=dol_concatdesc($text1, $text2);
$this->assertEquals("A
string 1
\nA string 2", $after);
- $text1="A string 1"; $text2="A string 2"; // text 2 is html, concat need
\n
+ $text1="A string 1";
+ $text2="A string 2"; // text 2 is html, concat need
\n
$after=dol_concatdesc($text1, $text2);
$this->assertEquals("A string 1
\nA string 2", $after);
diff --git a/test/phpunit/InventoryTest.php b/test/phpunit/InventoryTest.php
index ced18910790..baf26893448 100644
--- a/test/phpunit/InventoryTest.php
+++ b/test/phpunit/InventoryTest.php
@@ -372,10 +372,10 @@ class InventoryTest extends PHPUnit\Framework\TestCase
continue;
}
if (! $ignoretype && ($oVarsA[$sKey] !== $oVarsB[$sKey])) {
- $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
+ $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]);
}
if ($ignoretype && ($oVarsA[$sKey] != $oVarsB[$sKey])) {
- $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
+ $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]);
}
}
}
diff --git a/test/phpunit/KnowledgeRecordTest.php b/test/phpunit/KnowledgeRecordTest.php
index 7103345a096..13c86e66449 100644
--- a/test/phpunit/KnowledgeRecordTest.php
+++ b/test/phpunit/KnowledgeRecordTest.php
@@ -89,7 +89,8 @@ class KnowledgeRecordTest extends PHPUnit\Framework\TestCase
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (!isModEnabled('knowledgemanagement')) {
- print __METHOD__." module knowledgemanagement must be enabled.\n"; die(1);
+ print __METHOD__." module knowledgemanagement must be enabled.\n";
+ die(1);
}
}
diff --git a/test/phpunit/MouvementStockTest.php b/test/phpunit/MouvementStockTest.php
index c2bf052751e..9bfa21918f5 100644
--- a/test/phpunit/MouvementStockTest.php
+++ b/test/phpunit/MouvementStockTest.php
@@ -117,7 +117,8 @@ class MouvementStockTest extends PHPUnit\Framework\TestCase
$db=$this->savdb;
if (!isModEnabled('productbatch')) {
- print "\n".__METHOD__." module Lot/Serial must be enabled.\n"; die(1);
+ print "\n".__METHOD__." module Lot/Serial must be enabled.\n";
+ die(1);
}
print __METHOD__."\n";
diff --git a/test/phpunit/ODFTest.php b/test/phpunit/ODFTest.php
index a7d972bf345..87d062a3412 100644
--- a/test/phpunit/ODFTest.php
+++ b/test/phpunit/ODFTest.php
@@ -363,7 +363,9 @@ class ODFTest extends PHPUnit\Framework\TestCase
];
$odf=new Odf($filename, array());
- if (is_object($odf)) $result = 1; // Just to test
+ if (is_object($odf)) {
+ $result = 1;
+ } // Just to test
foreach ($to_test as $case) {
if ($case['charset'] !== null) {
diff --git a/test/phpunit/PaypalTest.php b/test/phpunit/PaypalTest.php
index 086e62dc9af..04b546ef34e 100644
--- a/test/phpunit/PaypalTest.php
+++ b/test/phpunit/PaypalTest.php
@@ -86,7 +86,8 @@ class PaypalTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (!isModEnabled('paypal')) {
- print __METHOD__." Module Paypal must be enabled.\n"; die(1);
+ print __METHOD__." Module Paypal must be enabled.\n";
+ die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/PdfDocTest.php b/test/phpunit/PdfDocTest.php
index d468af76ebd..d58f1db8985 100644
--- a/test/phpunit/PdfDocTest.php
+++ b/test/phpunit/PdfDocTest.php
@@ -145,11 +145,13 @@ class PdfDocTest extends PHPUnit\Framework\TestCase
$localproduct=new Product($db);
$result = $localproduct->fetch(0, 'PINKDRESS');
if ($result < 0) {
- print "\n".__METHOD__." Failed to make the fetch of product PINKDRESS. ".$localproduct->error; die(1);
+ print "\n".__METHOD__." Failed to make the fetch of product PINKDRESS. ".$localproduct->error;
+ die(1);
}
$product_id = $localproduct->id;
if ($product_id <= 0) {
- print "\n".__METHOD__." A product with ref PINKDRESS must exists into database. Create it manually before running the test"; die(1);
+ print "\n".__METHOD__." A product with ref PINKDRESS must exists into database. Create it manually before running the test";
+ die(1);
}
$localobject=new Facture($db);
diff --git a/test/phpunit/ProductTest.php b/test/phpunit/ProductTest.php
index 2c4dfd6a829..40c98ab29d6 100644
--- a/test/phpunit/ProductTest.php
+++ b/test/phpunit/ProductTest.php
@@ -85,7 +85,8 @@ class ProductTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (!isModEnabled('product')) {
- print __METHOD__." Module Product must be enabled.\n"; die(1);
+ print __METHOD__." Module Product must be enabled.\n";
+ die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/ReceptionTest.php b/test/phpunit/ReceptionTest.php
index be69b957967..fb1767a3cb1 100644
--- a/test/phpunit/ReceptionTest.php
+++ b/test/phpunit/ReceptionTest.php
@@ -143,7 +143,9 @@ class ReceptionTest extends PHPUnit\Framework\TestCase
$soc = new Societe($db);
$soc->name = "ReceptionTest Unittest";
$soc_id = $soc->create($user);
- $this->assertLessThanOrEqual($soc_id, 0,
+ $this->assertLessThanOrEqual(
+ $soc_id,
+ 0,
"Cannot create Societe object: ".
$soc->errorsToString()
);
@@ -217,7 +219,7 @@ class ReceptionTest extends PHPUnit\Framework\TestCase
global $db, $user, $conf;
$conf->global->MAIN_USE_ADVANCED_PERMS = '';
- $user->rights->reception = new stdClass;
+ $user->rights->reception = new stdClass();
$user->rights->reception->creer = 1;
$result = $user->fetch($user->id);
@@ -265,19 +267,31 @@ class ReceptionTest extends PHPUnit\Framework\TestCase
$result = $localobject->setClosed($user);
$this->assertLessThanOrEqual($result, 0, "Cannot close Reception object:\n".
$localobject->errorsToString());
- $this->assertEquals(Reception::STATUS_CLOSED, $localobject->status,
- "Checking that \$localobject->status is STATUS_CLOSED");
- $this->assertEquals(Reception::STATUS_CLOSED, $localobject->statut,
- "Checking that \$localobject->statut is STATUS_CLOSED");
+ $this->assertEquals(
+ Reception::STATUS_CLOSED,
+ $localobject->status,
+ "Checking that \$localobject->status is STATUS_CLOSED"
+ );
+ $this->assertEquals(
+ Reception::STATUS_CLOSED,
+ $localobject->statut,
+ "Checking that \$localobject->statut is STATUS_CLOSED"
+ );
$obj = new Reception($db);
$result = $obj->fetch($localobject->id);
$this->assertLessThanOrEqual($result, 0, "Cannot fetch Reception object:\n".
$obj->errorsToString());
- $this->assertEquals(Reception::STATUS_CLOSED, $obj->status,
- "Checking that \$obj->status is STATUS_CLOSED");
- $this->assertEquals(Reception::STATUS_CLOSED, $obj->statut,
- "Checking that \$obj->statut is STATUS_CLOSED");
+ $this->assertEquals(
+ Reception::STATUS_CLOSED,
+ $obj->status,
+ "Checking that \$obj->status is STATUS_CLOSED"
+ );
+ $this->assertEquals(
+ Reception::STATUS_CLOSED,
+ $obj->statut,
+ "Checking that \$obj->statut is STATUS_CLOSED"
+ );
return $obj;
}
diff --git a/test/phpunit/RestAPIContactTest.php b/test/phpunit/RestAPIContactTest.php
index ccc3aad1ebb..9dfab608dfb 100644
--- a/test/phpunit/RestAPIContactTest.php
+++ b/test/phpunit/RestAPIContactTest.php
@@ -76,7 +76,8 @@ class RestAPIContactTest extends PHPUnit\Framework\TestCase
$this->savdb=$db;
if (!isModEnabled('api')) {
- print __METHOD__." module api must be enabled.\n"; die(1);
+ print __METHOD__." module api must be enabled.\n";
+ die(1);
}
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php
index f9de4f95c9c..8ef6ca5a65e 100644
--- a/test/phpunit/RestAPIUserTest.php
+++ b/test/phpunit/RestAPIUserTest.php
@@ -76,7 +76,8 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase
$this->savdb=$db;
if (!isModEnabled('api')) {
- print __METHOD__." module api must be enabled.\n"; die(1);
+ print __METHOD__." module api must be enabled.\n";
+ die(1);
}
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php
index 193e84ca86b..44d306c4f22 100644
--- a/test/phpunit/SocieteTest.php
+++ b/test/phpunit/SocieteTest.php
@@ -86,15 +86,18 @@ class SocieteTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
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 '" . getDolGlobalString('SOCIETE_CODECLIENT_ADDON')."'.\n"; die(1);
+ print "\n".__METHOD__." third party ref checker must be setup to 'mod_codeclient_monkey' not to '" . getDolGlobalString('SOCIETE_CODECLIENT_ADDON')."'.\n";
+ die(1);
}
if (getDolGlobalString('MAIN_DISABLEPROFIDRULES')) {
- print "\n".__METHOD__." constant MAIN_DISABLEPROFIDRULES must be empty (if a module set it, disable module).\n"; die(1);
+ print "\n".__METHOD__." constant MAIN_DISABLEPROFIDRULES must be empty (if a module set it, disable module).\n";
+ die(1);
}
if ($langs->defaultlang != 'en_US') {
- print "\n".__METHOD__." default language of company must be set to autodetect.\n"; die(1);
+ print "\n".__METHOD__." default language of company must be set to autodetect.\n";
+ die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/StripeTest.php b/test/phpunit/StripeTest.php
index f44b598270a..6884993cda8 100644
--- a/test/phpunit/StripeTest.php
+++ b/test/phpunit/StripeTest.php
@@ -86,7 +86,8 @@ class StripeTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (!isModEnabled('stripe')) {
- print __METHOD__." Module Stripe must be enabled.\n"; die(1);
+ print __METHOD__." Module Stripe must be enabled.\n";
+ die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/SupplierProposalTest.php b/test/phpunit/SupplierProposalTest.php
index 01eca9be0ff..0afef774103 100644
--- a/test/phpunit/SupplierProposalTest.php
+++ b/test/phpunit/SupplierProposalTest.php
@@ -89,7 +89,8 @@ class SupplierProposalTest extends PHPUnit\Framework\TestCase
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (!getDolGlobalString('MAIN_MODULE_SUPPLIERPROPOSAL')) {
- print "\n".__METHOD__." module Supplier proposal must be enabled.\n"; die(1);
+ print "\n".__METHOD__." module Supplier proposal must be enabled.\n";
+ die(1);
}
print __METHOD__."\n";
diff --git a/test/phpunit/TargetTest.php b/test/phpunit/TargetTest.php
index 3cf8fce21ab..fa18d159951 100644
--- a/test/phpunit/TargetTest.php
+++ b/test/phpunit/TargetTest.php
@@ -82,7 +82,7 @@ class TargetTest extends PHPUnit\Framework\TestCase
*
* @return void
*/
- public static function setUpBeforeClass() : void
+ public static function setUpBeforeClass(): void
{
global $conf, $user, $langs, $db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
@@ -95,7 +95,7 @@ class TargetTest extends PHPUnit\Framework\TestCase
*
* @return void
*/
- protected function setUp() : void
+ protected function setUp(): void
{
global $conf, $user, $langs, $db;
$conf = $this->savconf;
@@ -111,7 +111,7 @@ class TargetTest extends PHPUnit\Framework\TestCase
*
* @return void
*/
- protected function tearDown() : void
+ protected function tearDown(): void
{
print __METHOD__."\n";
}
@@ -121,7 +121,7 @@ class TargetTest extends PHPUnit\Framework\TestCase
*
* @return void
*/
- public static function tearDownAfterClass() : void
+ public static function tearDownAfterClass(): void
{
global $conf, $user, $langs, $db;
$db->rollback();
diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php
index 9ce42e8ee99..b6c752d0688 100644
--- a/test/phpunit/UserTest.php
+++ b/test/phpunit/UserTest.php
@@ -85,7 +85,8 @@ class UserTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (getDolGlobalString('MAIN_MODULE_LDAP')) {
- print "\n".__METHOD__." module LDAP must be disabled.\n"; die(1);
+ print "\n".__METHOD__." module LDAP must be disabled.\n";
+ die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
@@ -285,8 +286,10 @@ class UserTest extends PHPUnit\Framework\TestCase
//$this->assertNotEquals($user->date_creation, '');
$localobject->addrights(0, 'supplier_proposal');
$this->assertEquals($localobject->hasRight('member', ''), 0);
- $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('product', 'member', 'read'), 0);
- $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('produit', 'member', 'read'), 0);
+ $this->assertEquals($localobject->hasRight('member', 'member'), 0);
+ $this->assertEquals($localobject->hasRight('product', 'member', 'read'), 0);
+ $this->assertEquals($localobject->hasRight('member', 'member'), 0);
+ $this->assertEquals($localobject->hasRight('produit', 'member', 'read'), 0);
return $localobject;
}
@@ -491,10 +494,10 @@ class UserTest extends PHPUnit\Framework\TestCase
continue;
}
if (! $ignoretype && ($oVarsA[$sKey] !== $oVarsB[$sKey])) {
- $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
+ $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]);
}
if ($ignoretype && ($oVarsA[$sKey] != $oVarsB[$sKey])) {
- $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
+ $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]);
}
}
}
diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php
index 7ca227a0f84..8ef049ce9d9 100644
--- a/test/phpunit/WebservicesInvoicesTest.php
+++ b/test/phpunit/WebservicesInvoicesTest.php
@@ -203,7 +203,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
$WS_METHOD = 'createInvoice';
- $body = array (
+ $body = array(
"id" => null,
"ref" => null,
"ref_ext" => "ref-phpunit-2",
@@ -354,7 +354,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
$WS_METHOD = 'updateInvoice';
// update status to 2
- $body = array (
+ $body = array(
"id" => null,
"ref" => null,
"ref_ext" => "ref-phpunit-2",
diff --git a/test/phpunit/WebservicesThirdpartyTest.php b/test/phpunit/WebservicesThirdpartyTest.php
index 632728b998e..1e4734c9c3a 100644
--- a/test/phpunit/WebservicesThirdpartyTest.php
+++ b/test/phpunit/WebservicesThirdpartyTest.php
@@ -171,7 +171,7 @@ class WebservicesThirdpartyTest extends PHPUnit\Framework\TestCase
'password'=>'admin',
'entity'=>'');
- $body = array (
+ $body = array(
"id" => null,
"ref" => "name",
"ref_ext" => "12",
diff --git a/test/phpunit/WebservicesUserTest.php b/test/phpunit/WebservicesUserTest.php
index 2ed16c238bb..b3126df7c02 100644
--- a/test/phpunit/WebservicesUserTest.php
+++ b/test/phpunit/WebservicesUserTest.php
@@ -193,7 +193,7 @@ class WebservicesUserTest extends PHPUnit\Framework\TestCase
}
print __METHOD__." count(result)=".count($result)."\n";
- $this->assertEquals('OK', empty($result['result']['result_code'])?'':$result['result']['result_code'], 'Test on ref admin');
+ $this->assertEquals('OK', empty($result['result']['result_code']) ? '' : $result['result']['result_code'], 'Test on ref admin');
// Test URL
$result='';