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

Finalization of tests
This commit is contained in:
XGUI
2024-11-29 16:24:01 +01:00
parent 4a12414bea
commit e03da55132

View File

@@ -58,12 +58,44 @@ class ActionNewsroomTest extends ItopDataTestCase
]; ];
} }
/**
* @throws CoreException
* @throws MissingQueryArgument
* @throws CoreUnexpectedValue
* @throws ArchivedObjectException
* @throws MySQLException
* @throws MySQLHasGoneAwayException
* @throws Exception
*/
public function testActionNewsroomRecordsEvent()
{
$iActionNewsroomId = $this->GivenActionNewsroomInDB(false, 'Body of the notification');
$this->CreateUserRequest(1,
[
'title' => '[TEST] ActionNewsroom',
'org_id' => $this->getTestOrgId(),
'caller_id' => $this->iRecipientId,
'description' => 'PHPUnit Test',
]
);
$this->AssertUniqueObjectInDB(
'EventNotificationNewsroom',
[
'action_id' => $iActionNewsroomId,
'message' => 'Body of the notification',
'title' => 'Title'
]
);
}
/** /**
* @dataProvider ActionNewsroomProvider * @dataProvider ActionNewsroomProvider
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
public function testActionNewsroomRecordsEventIfAMandatoryFieldIsEmpty(bool $bIsAsynchronous) public function testActionNewsroomRecordsSpecificEventIfAMandatoryFieldIsEmpty(bool $bIsAsynchronous)
{ {
$iActionNewsroomId = $this->GivenActionNewsroomInDB($bIsAsynchronous, '$this->service_name$'); $iActionNewsroomId = $this->GivenActionNewsroomInDB($bIsAsynchronous, '$this->service_name$');
@@ -87,43 +119,6 @@ class ActionNewsroomTest extends ItopDataTestCase
); );
} }
/**
* @throws CoreException
* @throws MissingQueryArgument
* @throws CoreUnexpectedValue
* @throws ArchivedObjectException
* @throws MySQLException
* @throws MySQLHasGoneAwayException
* @throws Exception
*/
public function testActionNewsroomRecordsEvent()
{
$iActionNewsroomId = $this->GivenActionNewsroomInDB(false, 'Body of the notification');
$iServiceId = $this->GivenService('Test service');
$this->CreateUserRequest(1,
[
'title' => '[TEST] ActionNewsroom',
'org_id' => $this->getTestOrgId(),
'caller_id' => $this->iRecipientId,
'description' => 'PHPUnit Test',
'service_id' => 0
]
);
$this->AssertUniqueObjectInDB(
'EventNotificationNewsroom',
[
'action_id' => $iActionNewsroomId,
'message' => 'Body of the notification'
]
);
}
/** /**
* @throws Exception * @throws Exception
*/ */