N°7726 - Fatal error if a newsroom is sent without any message

This commit is contained in:
XavierGR
2024-11-14 09:06:41 +01:00
committed by XGUI
parent 5d8db176f4
commit 6cb1cf7b7e
19 changed files with 241 additions and 8 deletions

View File

@@ -18,6 +18,8 @@ use CMDBObject;
use CMDBSource;
use Combodo\iTop\Service\Events\EventService;
use Contact;
use CoreException;
use CoreUnexpectedValue;
use DBObject;
use DBObjectSet;
use DBSearch;
@@ -29,6 +31,9 @@ use lnkContactToFunctionalCI;
use lnkContactToTicket;
use lnkFunctionalCIToTicket;
use MetaModel;
use MissingQueryArgument;
use MySQLException;
use MySQLHasGoneAwayException;
use Person;
use PluginManager;
use Server;
@@ -1439,4 +1444,24 @@ abstract class ItopDataTestCase extends ItopTestCase
self::markTestSkipped("Test skipped: module '$sModule' is not present");
}
}
/**
* @throws CoreException
* @throws CoreUnexpectedValue
* @throws ArchivedObjectException
* @throws MissingQueryArgument
* @throws MySQLException
* @throws MySQLHasGoneAwayException
* @throws Exception
*/
protected function AssertUniqueObjectInDB(string $sClass, array $aCriteria, string $sMessage = ''): void
{
$oSearch = new \DBObjectSearch($sClass);
foreach($aCriteria as $sAttCode => $value)
{
$oSearch->AddCondition($sAttCode, $value);
}
$oSet = new DBObjectSet($oSearch);
$this->assertEquals(1, $oSet->Count(), $sMessage);
}
}