Merge remote-tracking branch 'origin/develop' into feature/backoffice-full-moon-design

# Conflicts:
#	application/ajaxwebpage.class.inc.php
#	application/csvpage.class.inc.php
#	application/displayblock.class.inc.php
#	application/itopwebpage.class.inc.php
#	application/utils.inc.php
#	application/webpage.class.inc.php
#	application/xmlpage.class.inc.php
#	datamodels/2.x/itop-config-mgmt/datamodel.itop-config-mgmt.xml
#	datamodels/2.x/itop-knownerror-light/datamodel.itop-knownerror-light.xml
#	datamodels/2.x/itop-service-mgmt/datamodel.itop-service-mgmt.xml
#	datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml
#	js/components/breadcrumbs.js
#	pages/navigator.php
#	test/core/DBSearchTest.php
This commit is contained in:
Molkobain
2020-10-07 11:25:47 +02:00
274 changed files with 22153 additions and 19640 deletions

View File

@@ -694,4 +694,36 @@ class DBSearchTest extends ItopDataTestCase
// Previously we were using a output() call but this is time consuming and could cause "risky test" error !
ob_get_clean();
}
/**
* @since 2.7.2 2.8.0 N°3324
*/
public function testAllowAllData() {
$oSimpleSearch = \DBObjectSearch::FromOQL('SELECT FunctionalCI');
$oSimpleSearch->AllowAllData(false);
self::assertFalse($oSimpleSearch->IsAllDataAllowed(), 'DBSearch AllowData value');
$oSimpleSearch->AllowAllData(true);
self::assertTrue($oSimpleSearch->IsAllDataAllowed(), 'DBSearch AllowData value');
$sNestedQuery = 'SELECT FunctionalCI WHERE id IN (SELECT Server)';
$this->CheckNestedSearch($sNestedQuery, true);
$this->CheckNestedSearch($sNestedQuery, false);
}
private function CheckNestedSearch($sQuery, $bAllowAllData) {
$oNestedQuerySearch = \DBObjectSearch::FromOQL($sQuery);
$oNestedQuerySearch->AllowAllData($bAllowAllData);
self::assertEquals($bAllowAllData, $oNestedQuerySearch->IsAllDataAllowed(), 'root DBSearch AllowData value');
$oNestedSearchInExpression = null;
$oNestedQuerySearch->GetCriteria()->Browse(function ($oExpression) use (&$oNestedSearchInExpression) {
if ($oExpression instanceof \NestedQueryExpression) {
$oNestedSearchInExpression = $oExpression->GetNestedQuery();
return;
}
});
self::assertNotNull($oNestedSearchInExpression, 'We must have a DBSearch inside a NestedQueryExpression inside the root DBSearch');
/** @var \DBObjectSearch $oNestedSearchInExpression */
self::assertEquals($bAllowAllData, $oNestedSearchInExpression->IsAllDataAllowed(), 'Nested DBSearch AllowData value');
}
}