Mutualize code

This commit is contained in:
Laurent Destailleur
2024-02-17 15:34:19 +01:00
parent 671257e8e3
commit eccff949d6
40 changed files with 3 additions and 3143 deletions

View File

@@ -50,87 +50,6 @@ $langs->load("main");
*/
class AssetModelTest extends CommonClassTest
{
protected $savconf;
protected $savuser;
protected $savlangs;
protected $savdb;
/**
* Constructor
* We save global variables into local variables
*
* @param string $name Name
* @return AssetModelTest
*/
public function __construct($name = '')
{
parent::__construct($name);
//$this->sharedFixture
global $conf, $user, $langs, $db;
$this->savconf = $conf;
$this->savuser = $user;
$this->savlangs = $langs;
$this->savdb = $db;
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
//print " - db ".$db->db;
print "\n";
}
/**
* Global test setup
*
* @return 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.
print __METHOD__."\n";
}
/**
* Unit test setup
*
* @return void
*/
protected function setUp(): void
{
global $conf, $user, $langs, $db;
$conf = $this->savconf;
$user = $this->savuser;
$langs = $this->savlangs;
$db = $this->savdb;
print __METHOD__."\n";
}
/**
* Unit test teardown
*
* @return void
*/
protected function tearDown(): void
{
print __METHOD__."\n";
}
/**
* Global test teardown
*
* @return void
*/
public static function tearDownAfterClass(): void
{
global $conf, $user, $langs, $db;
$db->rollback();
print __METHOD__."\n";
}
/**
* testAssetModelCreate
*