2
0
forked from Wavyzz/dolibarr

Mutualise code

This commit is contained in:
Laurent Destailleur
2024-02-16 23:26:32 +01:00
parent a32831bc6f
commit 56b0c29d1f
90 changed files with 349 additions and 168 deletions

View File

@@ -56,7 +56,7 @@ if (! defined("NOSESSION")) {
require_once dirname(__FILE__).'/../../htdocs/main.inc.php';
require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php';
require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php';
require_once dirname(__FILE__).'/CommonClassTest.class.php';
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
@@ -73,7 +73,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1;
* @backupStaticAttributes enabled
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
*/
class SecurityTest extends PHPUnit\Framework\TestCase
class SecurityTest extends CommonClassTest
{
protected $savconf;
protected $savuser;
@@ -133,34 +133,6 @@ class SecurityTest extends PHPUnit\Framework\TestCase
}
/**
* This method is called when a test fails
*
* @param Throwable $t Throwable object
* @return void
*/
protected function onNotSuccessfulTest(Throwable $t): void
{
$logfile = DOL_DATA_ROOT.'/dolibarr.log';
$lines = file($logfile);
$nbLinesToShow = 100;
$totalLines = count($lines);
$premiereLigne = max(0, $totalLines - $nbLinesToShow);
// Obtient les dernières lignes du tableau
$dernieresLignes = array_slice($lines, $premiereLigne, $nbLinesToShow);
// Show log file
print "\n----- Test fails. Show last ".$nbLinesToShow." lines of dolibarr.log file -----\n";
foreach ($dernieresLignes as $ligne) {
print $ligne . "<br>";
}
parent::onNotSuccessfulTest($t);
}
/**
* Init phpunit tests
*