diff --git a/htdocs/version.inc.php b/htdocs/version.inc.php index 9a2c407811a..26696443f2c 100644 --- a/htdocs/version.inc.php +++ b/htdocs/version.inc.php @@ -42,6 +42,7 @@ define('DOL_MAJOR_VERSION', '24'); define('DOL_VERSION', constant('DOL_MAJOR_VERSION').'.'.constant('DOL_MINOR_VERSION')); // DOL_VERSION is now a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c -// Set to 1 if the beta version is a just a candidate for certification or if the stable version has been certified. -// Use 2 to force LNE features for debug purposes -define('CERTIF_LNE', '0'); +// Set to 1 if the beta version is the candidate for certification or if the stable version has been certified. +// Use 2 to force LNE features for debug purposes. +// Unset for standard version. +//define('CERTIF_LNE', '2'); diff --git a/test/phpunit/BlockedLogAndLNETest.php b/test/phpunit/BlockedLogAndLNETest.php index 9f159213d01..1266741c2e7 100644 --- a/test/phpunit/BlockedLogAndLNETest.php +++ b/test/phpunit/BlockedLogAndLNETest.php @@ -30,6 +30,7 @@ global $conf,$user,$langs,$db; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php'; require_once dirname(__FILE__).'/../../htdocs/blockedlog/class/blockedlog.class.php'; +require_once dirname(__FILE__).'/../../htdocs/core/modules/modBlockedLog.class.php'; require_once dirname(__FILE__).'/CommonClassTest.class.php'; if (empty($user->id)) { @@ -51,6 +52,23 @@ $langs->load("main"); */ class BlockedLogAndLNETest extends CommonClassTest { + /** + * setUpBeforeClass + * + * @return void + */ + public static function setUpBeforeClass(): void + { + self::assertTrue(isModEnabled('invoice'), " module customer invoice must be enabled"); + self::assertFalse(isModEnabled('ecotaxdeee'), " module ecotaxdeee must not be enabled"); + parent::setUpBeforeClass(); + + // We disable module blocked log to avoid interference with tests + global $db; + $blockedlogmodule = new modBlockedLog($db); + $blockedlogmodule->init(); + } + /** * testBlockedLogAndLNETest * diff --git a/test/phpunit/CommonClassTest.class.php b/test/phpunit/CommonClassTest.class.php index dce4b971539..8fabb9b80ea 100644 --- a/test/phpunit/CommonClassTest.class.php +++ b/test/phpunit/CommonClassTest.class.php @@ -320,7 +320,9 @@ abstract class CommonClassTest extends TestCase } else { $oVarsA = get_object_vars($oA); $oVarsB = get_object_vars($oB); + $aKeys = array_keys($oVarsA); + if (method_exists($oA, 'deprecatedProperties')) { // Update exclusions foreach (self::callMethod($oA, 'deprecatedProperties') as $deprecated => $new) { @@ -333,6 +335,7 @@ abstract class CommonClassTest extends TestCase if (in_array($sKey, $fieldstoignorearray)) { continue; } + if (! $ignoretype && ($oVarsA[$sKey] !== $oVarsB[$sKey])) { $retAr[] = get_class($oA).'::'.$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : json_encode($oVarsA[$sKey])).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : json_encode($oVarsB[$sKey])); } @@ -341,6 +344,7 @@ abstract class CommonClassTest extends TestCase } } } + return $retAr; } diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index 3e20420c4b5..6c8ed113892 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -31,6 +31,7 @@ global $conf,$user,$langs,$db; //require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php'; +require_once dirname(__FILE__).'/../../htdocs/core/modules/modBlockedLog.class.php'; require_once dirname(__FILE__).'/CommonClassTest.class.php'; if (empty($user->id)) { @@ -60,6 +61,11 @@ class FactureTest extends CommonClassTest self::assertTrue(isModEnabled('invoice'), " module customer invoice must be enabled"); self::assertFalse(isModEnabled('ecotaxdeee'), " module ecotaxdeee must not be enabled"); parent::setUpBeforeClass(); + + // We disable module blocked log to avoid interference with tests + global $db; + $blockedlogmodule = new modBlockedLog($db); + $blockedlogmodule->remove(); } @@ -151,6 +157,10 @@ class FactureTest extends CommonClassTest $langs = $this->savlangs; $db = $this->savdb; + // Force to default setup + $conf->global->FAC_FORCE_DATE_VALIDATION = 0; + $conf->global->INVOICE_CHECK_POSTERIOR_DATE = 0; + $result = $localobject->validate($user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; @@ -161,9 +171,10 @@ class FactureTest extends CommonClassTest $newlocalobject->initAsSpecimen(); $this->changeProperties($newlocalobject); - // Hack to avoid test to be wrong when module sellyoursaas is on - unset($localobject->array_options['options_commission']); - unset($localobject->array_options['options_reseller']); + // Hack to avoid test to be wrong when some modules are one + unset($localobject->array_options); + //unset($localobject->array_options['options_reseller']); + //unset($localobject->array_options['options_reseller']); $arraywithdiff = $this->objCompare( $localobject, @@ -179,7 +190,8 @@ class FactureTest extends CommonClassTest 'trackid','user_creat','user_valid', 'note' ) ); - $this->assertEquals($arraywithdiff, array()); // Actual, Expected + + $this->assertEquals($arraywithdiff, array(), 'Found differences '.var_export($arraywithdiff, true)); // Actual, Expected. If it differs, do a var_dump($arraywithdiff) to see what differs return $localobject; } @@ -261,6 +273,8 @@ class FactureTest extends CommonClassTest print __METHOD__." id=".$localobject->id." ref=".$localobject->ref." result=".$result."\n"; $this->assertEquals(0, $result, 'Deletion should fail, it is not last invoice'); + var_dump($localobject2->is_erasable()); + $result = $localobject2->delete($user); // Deletion is OK, it is last invoice print __METHOD__." id=".$localobject2->id." ref=".$localobject2->ref." result=".$result."\n"; $this->assertGreaterThan(0, $result, 'Deletion should work, it is last invoice');