diff --git a/tests/php-unit-tests/unitary-tests/core/DBUnionSearchTest.php b/tests/php-unit-tests/unitary-tests/core/DBUnionSearchTest.php new file mode 100644 index 000000000..ba2e6c565 --- /dev/null +++ b/tests/php-unit-tests/unitary-tests/core/DBUnionSearchTest.php @@ -0,0 +1,66 @@ +AllowAllData(); + $oSearch = $oSearch->Filter($sClassAlias, $oVisibleObjects); + $this->InvokeNonPublicMethod(get_class($oSearch), 'SetDataFiltered', $oSearch, []); + + $this->debug($oSearch->ToOQL()); + + $oSet = new DBObjectSet($oSearch); + $oSet->Count(); + + $this->assertTrue(true); + } + + /** + * Ignored test (provokes PHP Error) + * + * @return void + * @throws \CoreException + * @throws \MissingQueryArgument + * @throws \MySQLException + * @throws \MySQLHasGoneAwayException + * @throws \OQLException + */ + public function FilterOnSecondSelectedClass() + { + $sSourceOQL = 'SELECT `Person`, `Location` FROM Person JOIN Location ON `Person`.location_id = `Location`.id'; + $oSearch = DBSearch::FromOQL($sSourceOQL); + + $sFilterOQL = 'SELECT Location UNION SELECT Location'; + $oVisibleObjects = DBSearch::FromOQL($sFilterOQL); + $sClassAlias = 'Location'; + $oVisibleObjects->AllowAllData(); + $oSearch = $oSearch->Filter($sClassAlias, $oVisibleObjects); + + // $oSearch->ToOQL(); + + $oSet = new DBObjectSet($oSearch); + $oSet->CountWithLimit(1); + + $this->assertTrue(true); + } +}