N°6097 - Tests: Optimize performances by creating custom env. only once and re-using it across test classes

This commit is contained in:
Molkobain
2023-07-20 19:47:25 +02:00
parent 1ad28312ec
commit ed6df77cbb
9 changed files with 155 additions and 135 deletions

View File

@@ -15,6 +15,7 @@ namespace Combodo\iTop\Test\UnitTest;
use ArchivedObjectException;
use CMDBSource;
use Config;
use Contact;
use DBObject;
use DBObjectSet;
@@ -63,6 +64,10 @@ abstract class ItopDataTestCase extends ItopTestCase
// For cleanup
private $aCreatedObjects = array();
/**
* @var string Default environment to use for test cases
*/
const DEFAULT_TEST_ENVIRONMENT = 'production';
const USE_TRANSACTION = true;
const CREATE_TEST_ORG = false;
@@ -126,12 +131,12 @@ abstract class ItopDataTestCase extends ItopTestCase
}
/**
* @return string Environment in the test will run
* @return string Environment the test will run in
* @since 2.7.9 3.0.4 3.1.0
*/
protected function GetTestEnvironment(): string
{
return 'production';
return self::DEFAULT_TEST_ENVIRONMENT;
}
/**