mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
💚 Refactor unit tests
This commit is contained in:
@@ -65,7 +65,7 @@ class ItopDataTestCase extends ItopTestCase
|
||||
private $aCreatedObjects = array();
|
||||
|
||||
const USE_TRANSACTION = true;
|
||||
const CREATE_TEST_ORG = true;
|
||||
const CREATE_TEST_ORG = false;
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
|
||||
@@ -37,7 +37,9 @@ use Combodo\iTop\Application\Search\CriterionParser;
|
||||
use Combodo\iTop\Application\Search\SearchForm;
|
||||
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
use DBObjectSearch;
|
||||
use DBObjectSet;
|
||||
use DBSearch;
|
||||
use Dict;
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
@@ -46,6 +48,8 @@ use DBSearch;
|
||||
*/
|
||||
class CriterionConversionTest extends ItopDataTestCase
|
||||
{
|
||||
const CREATE_TEST_ORG = true;
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
@@ -186,7 +190,7 @@ class CriterionConversionTest extends ItopDataTestCase
|
||||
$oSearchForm = new SearchForm();
|
||||
/** @var \DBObjectSearch $oSearch */
|
||||
$oSearch = DBSearch::FromOQL("SELECT Contact");
|
||||
$aFields = $oSearchForm->GetFields(new \DBObjectSet($oSearch));
|
||||
$aFields = $oSearchForm->GetFields(new DBObjectSet($oSearch));
|
||||
$aRes = CriterionToSearchForm::Convert($aCriterion, $aFields, $oSearch->GetJoinedClasses());
|
||||
$this->debug($aRes);
|
||||
$this->assertEquals($sExpectedOperator, $aRes[0]['operator']);
|
||||
@@ -634,12 +638,12 @@ class CriterionConversionTest extends ItopDataTestCase
|
||||
$this->debug($sOQL);
|
||||
|
||||
|
||||
\Dict::SetUserLanguage($sLanguageCode);
|
||||
Dict::SetUserLanguage($sLanguageCode);
|
||||
|
||||
|
||||
$oSearchForm = new SearchForm();
|
||||
$oSearch = \DBSearch::FromOQL($sOQL);
|
||||
$aFields = $oSearchForm->GetFields(new \DBObjectSet($oSearch));
|
||||
$oSearch = DBSearch::FromOQL($sOQL);
|
||||
$aFields = $oSearchForm->GetFields(new DBObjectSet($oSearch));
|
||||
/** @var \DBObjectSearch $oSearch */
|
||||
$aCriterion = $oSearchForm->GetCriterion($oSearch, $aFields);
|
||||
|
||||
@@ -648,7 +652,7 @@ class CriterionConversionTest extends ItopDataTestCase
|
||||
$aNewCriterion = array();
|
||||
foreach($aAndCriterion as $aCriteria)
|
||||
{
|
||||
if ($aCriteria['widget'] != \AttributeDefinition::SEARCH_WIDGET_TYPE_RAW)
|
||||
if ($aCriteria['widget'] != AttributeDefinition::SEARCH_WIDGET_TYPE_RAW)
|
||||
{
|
||||
unset($aCriteria['oql']);
|
||||
foreach($aFields as $aCatFields)
|
||||
|
||||
@@ -29,19 +29,20 @@
|
||||
namespace Combodo\iTop\Test\UnitTest\Application\Search;
|
||||
|
||||
use Combodo\iTop\Application\Search\CriterionParser;
|
||||
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
use Combodo\iTop\Test\UnitTest\ItopTestCase;
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
* @backupGlobals disabled
|
||||
*/
|
||||
class CriterionParserTest extends ItopDataTestCase
|
||||
class CriterionParserTest extends ItopTestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
require_once(APPROOT."application/startup.inc.php");
|
||||
require_once(APPROOT."sources/application/search/criterionparser.class.inc.php");
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ use Exception;
|
||||
*/
|
||||
class SearchFormTest extends ItopDataTestCase
|
||||
{
|
||||
const CREATE_TEST_ORG = true;
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
|
||||
@@ -37,6 +37,8 @@ use DBObject;
|
||||
*/
|
||||
class DBObjectTest extends ItopDataTestCase
|
||||
{
|
||||
const CREATE_TEST_ORG = true;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@@ -17,8 +17,6 @@ use DBSearch;
|
||||
*/
|
||||
class DBSearchIntersectTest extends ItopDataTestCase
|
||||
{
|
||||
const CREATE_TEST_ORG = false;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@@ -47,6 +47,7 @@ use FunctionExpression;
|
||||
*/
|
||||
class DBSearchTest extends ItopDataTestCase
|
||||
{
|
||||
const CREATE_TEST_ORG = true;
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
|
||||
@@ -83,4 +83,4 @@ class MetaModelTest extends ItopDataTestCase
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ use utils;
|
||||
class OQLToSQLAllCLassesTest extends ItopDataTestCase
|
||||
{
|
||||
const USE_TRANSACTION = false;
|
||||
const CREATE_TEST_ORG = false;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
|
||||
@@ -15,7 +15,6 @@ use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
class OQLToSQLTest extends ItopDataTestCase
|
||||
{
|
||||
const USE_TRANSACTION = false;
|
||||
const CREATE_TEST_ORG = false;
|
||||
const TEST_CSV_RESULT = 'OQLToSQLTest.csv';
|
||||
|
||||
public function setUp()
|
||||
|
||||
@@ -20,7 +20,6 @@ use utils;
|
||||
class OQLToSQLTest extends ItopDataTestCase
|
||||
{
|
||||
const USE_TRANSACTION = false;
|
||||
const CREATE_TEST_ORG = false;
|
||||
const TEST_CSV_RESULT = 'OQLToSQLTest.csv';
|
||||
|
||||
public function setUp()
|
||||
|
||||
@@ -42,8 +42,9 @@ use ormLinkSet;
|
||||
*/
|
||||
class ormLinkSetTest extends ItopDataTestCase
|
||||
{
|
||||
const CREATE_TEST_ORG = true;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function setUp()
|
||||
|
||||
@@ -44,6 +44,7 @@ define('MAX_TAGS', 12);
|
||||
*/
|
||||
class ormTagSetTest extends ItopDataTestCase
|
||||
{
|
||||
const CREATE_TEST_ORG = true;
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
|
||||
@@ -37,7 +37,9 @@ use Exception;
|
||||
*/
|
||||
class ItopTicketTest extends ItopDataTestCase
|
||||
{
|
||||
/**
|
||||
const CREATE_TEST_ORG = true;
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function setUp()
|
||||
|
||||
Reference in New Issue
Block a user