Merge branch 'support/3.2' into develop

This commit is contained in:
jf-cbd
2024-12-02 17:47:10 +01:00
17 changed files with 70 additions and 44 deletions

View File

@@ -12,13 +12,17 @@ namespace Combodo\iTop\Test\UnitTest\Core;
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
use DBObjectSearch;
use DBSearch;
use OQLException;
use OqlInterpreter;
use OQLParserException;
use UnknownClassOqlException;
use UserRights;
class OQLParserTest extends ItopDataTestCase
{
const USE_TRANSACTION = false;
const CREATE_TEST_ORG = true;
/**
* @group iTopChangeMgt
@@ -40,6 +44,20 @@ class OQLParserTest extends ItopDataTestCase
self::assertEquals($sQuery,$sOql);
}
public function testUnknownClassOqlException()
{
$sLogin = $this->GivenUserRestrictedToAnOrganizationInDB($this->getTestOrgId(), self::$aURP_Profiles['Portal user']);
UserRights::Login($sLogin);
try {
DBSearch::FromOQL('SELECT UnknownClass');
$this->fail('An UnknownClassOqlException should have been thrown');
}
catch (UnknownClassOqlException $e) {
$this->assertNotContains('DBProperty', $e->GetSuggestions(), 'user should not be recommanded to perform queries on classes his not allowed to see');
}
}
public function NestedQueryProvider()
{
return array(