mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-27 06:04:12 +01:00
N°7726 - Fatal error if a newsroom is sent without any message
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user