diff --git a/core/dbunionsearch.class.php b/core/dbunionsearch.class.php index 8d8d73684d..a9c4beba87 100644 --- a/core/dbunionsearch.class.php +++ b/core/dbunionsearch.class.php @@ -59,7 +59,7 @@ public function __construct($aSearches) public function AllowAllData($bAllowAllData = true) { foreach ($this->aSearches as $oSearch) { - $oSearch->AllowAllData(); + $oSearch->AllowAllData($bAllowAllData); } } diff --git a/tests/php-unit-tests/unitary-tests/core/DBUnionSearchTest.php b/tests/php-unit-tests/unitary-tests/core/DBUnionSearchTest.php index e6501c7c18..cf310971ef 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBUnionSearchTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBUnionSearchTest.php @@ -183,4 +183,14 @@ public function SetSelectedClassesProvider() ], ]; } + + public function testAllowAllDataOnUnions() + { + $oSearch = \DBObjectSearch::FromOQL('SELECT Server UNION SELECT VirtualMachine'); + $oSearch->AllowAllData(false); + self::assertFalse($oSearch->IsAllDataAllowed(), 'DBUnionSearch AllowData value'); + $oSearch->AllowAllData(true); + self::assertTrue($oSearch->IsAllDataAllowed(), 'DBUnionSearch AllowData value'); + } + }