Merge branch 'support/2.7' into develop

# Conflicts:
#	README.md
#	composer.json
#	composer.lock
#	core/cmdbsource.class.inc.php
#	core/dbobject.class.php
#	datamodels/2.x/combodo-db-tools/db_analyzer.class.inc.php
#	datamodels/2.x/combodo-db-tools/dbtools.php
#	datamodels/2.x/combodo-db-tools/dictionaries/zh_cn.dict.combodo-db-tools.php
#	datamodels/2.x/itop-attachments/dictionaries/zh_cn.dict.itop-attachments.php
#	datamodels/2.x/itop-core-update/dictionaries/zh_cn.dict.itop-core-update.php
#	dictionaries/zh_cn.dictionary.itop.core.php
#	dictionaries/zh_cn.dictionary.itop.ui.php
#	lib/composer/InstalledVersions.php
#	lib/composer/autoload_classmap.php
#	lib/composer/autoload_static.php
#	lib/composer/installed.php
#	lib/composer/platform_check.php
#	pages/ajax.render.php
#	pages/csvimport.php
#	setup/ajax.dataloader.php
#	setup/index.php
#	setup/setuputils.class.inc.php
#	test/application/UtilsTest.php
This commit is contained in:
Pierre Goiffon
2021-06-14 16:19:56 +02:00
65 changed files with 3743 additions and 3485 deletions

View File

@@ -96,6 +96,9 @@ class ItopTestCase extends TestCase
return $sId;
}
/**
* @since 2.7.4 3.0.0
*/
public function InvokeNonPublicStaticMethod($sObjectClass, $sMethodName, $aArgs)
{
return $this->InvokeNonPublicMethod($sObjectClass, $sMethodName, null, $aArgs);
@@ -110,6 +113,8 @@ class ItopTestCase extends TestCase
* @return mixed method result
*
* @throws \ReflectionException
*
* @since 2.7.4 3.0.0
*/
public function InvokeNonPublicMethod($sObjectClass, $sMethodName, $oObject, $aArgs)
{

View File

@@ -54,11 +54,10 @@ class UtilsTest extends \Combodo\iTop\Test\UnitTest\ItopTestCase
public function memoryLimitDataProvider()
{
return [
[true, '-1', 1024],
[true, -1, 1024],
[true, 1024, 1024],
[true, 2048, 1024],
[false, 1024, 2048],
'current -1, required 1024' => [true, -1, 1024],
'current 1024, required 1024' => [true, 1024, 1024],
'current 2048, required 1024' => [true, 2048, 1024],
'current 1024, required 2048' => [false, 1024, 2048],
];
}
@@ -552,4 +551,26 @@ class UtilsTest extends \Combodo\iTop\Test\UnitTest\ItopTestCase
],
];
}
/**
* @param string $sExpressionToConvert
* @param int $iExpectedConvertedValue
*
* @dataProvider ConvertToBytesProvider
*/
public function testConvertToBytes($sExpressionToConvert, $iExpectedConvertedValue)
{
$iCurrentConvertedValue = utils::ConvertToBytes($sExpressionToConvert);
self::assertEquals($iExpectedConvertedValue, $iCurrentConvertedValue, 'Converted value wasn\'t the one expected !');
}
public function ConvertToBytesProvider()
{
return [
'123' => ['123', 123],
'56k' => ['56k', 56 * 1024],
'512M' => ['512M', 512 * 1024 * 1024],
'2G' => ['2G', 2 * 1024 * 1024 * 1024],
];
}
}

View File

@@ -620,7 +620,7 @@ class DBSearchTest extends ItopDataTestCase
$sExceptionClass = get_class($e);
}
static::assertEquals('OQLParserException', $sExceptionClass);
static::assertEquals('OQLParserSyntaxErrorException', $sExceptionClass);
}
public function testSanity_GroupFunction_In_GroupByPart()
@@ -636,7 +636,7 @@ class DBSearchTest extends ItopDataTestCase
$sExceptionClass = get_class($e);
}
static::assertEquals('OQLParserException', $sExceptionClass);
static::assertEquals('OQLParserSyntaxErrorException', $sExceptionClass);
}
public function testSanity_UnknownGroupFunction_In_SelectPart()
@@ -730,4 +730,19 @@ class DBSearchTest extends ItopDataTestCase
/** @var \DBObjectSearch $oNestedSearchInExpression */
self::assertEquals($bAllowAllData, $oNestedSearchInExpression->IsAllDataAllowed(), 'Nested DBSearch AllowData value');
}
/**
* BUG N°4031 check AttributeObjectKey used in JOIN condition
* @throws \ConfigException
* @throws \CoreException
* @throws \MissingQueryArgument
* @throws \OQLException
*/
public function testAttributeObjectKey()
{
$sQuery = "SELECT II FROM InlineImage AS II JOIN UserRequest AS UR ON II.item_id = UR.id WHERE II.item_class = 'UserRequest'";
$oSearch = \DBObjectSearch::FromOQL($sQuery);
$oSearch->MakeSelectQuery();
self::assertTrue(true);
}
}

File diff suppressed because one or more lines are too long

View File

@@ -208,16 +208,16 @@ class OQLTest extends ItopDataTestCase
public function BadQueryProvider()
{
return array(
array('SELECT toto WHERE toto.a = (3++1)', 'OQLParserException'),
array('SELECT toto WHHHERE toto.a = "1"', 'OQLParserException'),
array('SELECT toto WHERE toto.a == "1"', 'OQLParserException'),
array('SELECT toto WHERE toto.a = (3++1)', 'OQLParserSyntaxErrorException'),
array('SELECT toto WHHHERE toto.a = "1"', 'OQLParserSyntaxErrorException'),
array('SELECT toto WHERE toto.a == "1"', 'OQLParserSyntaxErrorException'),
array('SELECT toto WHERE toto.a % 1', 'Exception'),
array('SELECT toto WHERE toto.a like \'arg\'', 'OQLParserException'),
array('SELECT toto WHERE toto.a NOT LIKE "That\'s "it""', 'OQLParserException'),
array('SELECT toto WHERE toto.a NOT LIKE \'That\'s it\'', 'OQLParserException'),
array('SELECT toto WHERE toto.a like \'arg\'', 'OQLParserSyntaxErrorException'),
array('SELECT toto WHERE toto.a NOT LIKE "That\'s "it""', 'OQLParserSyntaxErrorException'),
array('SELECT toto WHERE toto.a NOT LIKE \'That\'s it\'', 'OQLParserSyntaxErrorException'),
array('SELECT toto WHERE toto.a NOT LIKE "blah \\ truc"', 'Exception'),
array('SELECT toto WHERE toto.a NOT LIKE \'blah \\ truc\'', 'Exception'),
array('SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id = B.id WHERE A.col1 BELOW 2 AND B.id = 3', 'OQLParserException'),
array('SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id = B.id WHERE A.col1 BELOW 2 AND B.id = 3', 'OQLParserSyntaxErrorException'),
);
}