mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix with php-cs-fixer
This commit is contained in:
parent
881e32f03a
commit
de7d3c2bf8
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.');
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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<br>string 1"; $text2="A string 2"; // text 1 is html, concat need <br>\n
|
||||
$text1="A<br>string 1";
|
||||
$text2="A string 2"; // text 1 is html, concat need <br>\n
|
||||
$after=dol_concatdesc($text1, $text2);
|
||||
$this->assertEquals("A<br>string 1<br>\nA string 2", $after);
|
||||
|
||||
$text1="A string 1"; $text2="A <b>string</b> 2"; // text 2 is html, concat need <br>\n
|
||||
$text1="A string 1";
|
||||
$text2="A <b>string</b> 2"; // text 2 is html, concat need <br>\n
|
||||
$after=dol_concatdesc($text1, $text2);
|
||||
$this->assertEquals("A string 1<br>\nA <b>string</b> 2", $after);
|
||||
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ class WebservicesThirdpartyTest extends PHPUnit\Framework\TestCase
|
|||
'password'=>'admin',
|
||||
'entity'=>'');
|
||||
|
||||
$body = array (
|
||||
$body = array(
|
||||
"id" => null,
|
||||
"ref" => "name",
|
||||
"ref_ext" => "12",
|
||||
|
|
|
|||
|
|
@ -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='';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user