Merge remote-tracking branch 'origin/support/3.0' into support/3.1

# Conflicts:
#	tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php
This commit is contained in:
Romain Quetiez
2023-08-17 17:45:40 +02:00
85 changed files with 1128 additions and 903 deletions

View File

@@ -10,9 +10,6 @@ use Combodo\iTop\Application\Helper\WebResourcesHelper;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
/**
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
* @backupGlobals disabled
* @covers \WebPage
*/
class WebResourcesHelperTest extends ItopTestCase

View File

@@ -14,10 +14,6 @@ use SecurityException;
/**
* We need the metamodel started as this is a dependency of {@link RuntimeDashboard}
*
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
* @backupGlobals disabled
*
* @since 2.7.8 3.0.3 3.1.0 N°4449 Test Full Path Disclosure in Dashboard
*/
class RuntimeDashboardTest extends ItopDataTestCase

View File

@@ -44,14 +44,11 @@ use Dict;
/**
* @group itopRequestMgmt
* @group itopServiceMgmt
*
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
* @backupGlobals disabled
*/
class CriterionConversionTest extends ItopDataTestCase
{
const CREATE_TEST_ORG = true;
const CREATE_TEST_ORG = false;
const USE_TRANSACTION = false;
/**
* @dataProvider ToOqlProvider
@@ -409,9 +406,7 @@ class CriterionConversionTest extends ItopDataTestCase
* @dataProvider OqlProvider
*
* @param $sOQL
*
* @param $sExpectedOQL
*
* @param $aExpectedCriterion
*
* @throws \DictExceptionUnknownLanguage
@@ -425,7 +420,7 @@ class CriterionConversionTest extends ItopDataTestCase
$this->CreateTagData(TAG_CLASS, TAG_ATTCODE, 'tag1', 'First');
$this->CreateTagData(TAG_CLASS, TAG_ATTCODE, 'tag2', 'Second');
$this->OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion, "EN US");
$this->OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion);
}
function OqlProvider()
@@ -589,9 +584,7 @@ class CriterionConversionTest extends ItopDataTestCase
* @dataProvider OqlProviderDates
*
* @param $sOQL
*
* @param $sExpectedOQL
*
* @param $aExpectedCriterion
*
* @throws \DictExceptionUnknownLanguage
@@ -599,33 +592,11 @@ class CriterionConversionTest extends ItopDataTestCase
* @throws \OQLException
* @throws \CoreException
*/
function testOqlToForSearchToOqlAltLanguageFR($sOQL, $sExpectedOQL, $aExpectedCriterion)
function testOqlToForSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion)
{
\MetaModel::GetConfig()->Set('date_and_time_format', array('default' => array('date' => 'Y-m-d', 'time' => 'H:i:s', 'date_time' => '$date $time')));
$this->OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion, "FR FR");
$this->OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion);
}
/**
* @dataProvider OqlProviderDates
*
* @param $sOQL
*
* @param $sExpectedOQL
*
* @param $aExpectedCriterion
*
* @throws \DictExceptionUnknownLanguage
* @throws \MissingQueryArgument
* @throws \OQLException
* @throws \CoreException
*/
function testOqlToForSearchToOqlAltLanguageEN($sOQL, $sExpectedOQL, $aExpectedCriterion)
{
\MetaModel::GetConfig()->Set('date_and_time_format', array('default' => array('date' => 'Y-m-d', 'time' => 'H:i:s', 'date_time' => '$date $time')));
$this->OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion, "EN US");
}
function OqlProviderDates()
{
return array(
@@ -706,26 +677,18 @@ class CriterionConversionTest extends ItopDataTestCase
/**
*
* @param $sOQL
*
* @param $sExpectedOQL
*
* @param $aExpectedCriterion
*
* @param $sLanguageCode
*
* @throws \CoreException
* @throws \DictExceptionUnknownLanguage
* @throws \MissingQueryArgument
* @throws \OQLException
*/
function OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion, $sLanguageCode )
function OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion)
{
$this->debug($sOQL);
Dict::SetUserLanguage($sLanguageCode);
$oSearchForm = new SearchForm();
$oSearch = DBSearch::FromOQL($sOQL);
$aFields = $oSearchForm->GetFields(new DBObjectSet($oSearch));

View File

@@ -33,9 +33,6 @@ use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
/**
* @group itopRequestMgmt
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
* @backupGlobals disabled
*/
class CriterionParserTest extends ItopDataTestCase
{

View File

@@ -29,14 +29,10 @@ use Exception;
/**
* @group itopRequestMgmt
*
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
* @backupGlobals disabled
*/
class SearchFormTest extends ItopDataTestCase
{
const CREATE_TEST_ORG = true;
const CREATE_TEST_ORG = false;
/**
* @dataProvider GetFieldsProvider

View File

@@ -16,11 +16,6 @@ if (!defined('DEBUG_UNIT_TEST')) {
define('DEBUG_UNIT_TEST', true);
}
/**
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
* @backupGlobals disabled
*/
class StatusIncTest extends ItopTestCase {
/**
@@ -67,7 +62,10 @@ class StatusIncTest extends ItopTestCase {
$this->assertTrue(true);
}
public function testStatusStartupWrongDbPwd()
/**
* @runInSeparateProcess
*/
public function testStatusStartupWrongDbPwd()
{
$this->RequireOnceItopFile('core/cmdbobject.class.inc.php');
$this->RequireOnceItopFile('application/utils.inc.php');

View File

@@ -8,6 +8,7 @@
namespace Combodo\iTop\Test\UnitTest\Status;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
use Config;
class StatusTest extends ItopTestCase
{
@@ -25,10 +26,18 @@ class StatusTest extends ItopTestCase
}
protected function GetPHPCommand()
{
$this->RequireOnceItopFile('application/utils.inc.php');
$oConfig = new Config(ITOP_DEFAULT_CONFIG_FILE);
return $oConfig->Get('php_path');
}
public function testStatusGood() {
$sPath = APPROOT.'/webservices/status.php';
exec("php $sPath", $aOutput, $iRet);
$sPHP = $this->GetPHPCommand();
exec("$sPHP $sPath", $aOutput, $iRet);
$this->assertEquals(0, $iRet, "Problem executing status page: $sPath, $iRet, aOutput:\n".var_export($aOutput, true));
}
@@ -39,7 +48,8 @@ class StatusTest extends ItopTestCase
{
$sPath = APPROOT.'/webservices/status.php';
exec("php $sPath", $aOutput, $iRet);
$sPHP = $this->GetPHPCommand();
exec("$sPHP $sPath", $aOutput, $iRet);
$sAdditionalInfo = "aOutput:\n".var_export($aOutput, true).'.';
//Check response

View File

@@ -8,11 +8,6 @@ namespace Combodo\iTop\Test\UnitTest\Application;
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
/**
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
* @backupGlobals disabled
*/
class TestAutoload extends ItopDataTestCase
{

View File

@@ -2,16 +2,11 @@
namespace Combodo\iTop\Test\UnitTest\Application\TwigBase;
use Combodo\iTop\Portal\Twig\AppExtension;
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
use Combodo\iTop\Portal\Twig\AppExtension;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
/**
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
* @backupGlobals disabled
*/
class TwigTest extends ItopDataTestCase
{
protected function setUp(): void