adding test for deprovisioning notification using date format (#7065)

This commit is contained in:
nirajacharya2
2023-08-18 16:41:23 +05:45
committed by GitHub
parent d87fd62f9d
commit 3156360d66
2 changed files with 95 additions and 3 deletions
@@ -520,13 +520,22 @@ class NotificationContext implements Context {
* @When user :user tries to create a deprovisioning notification
*
* @param string|null $user
* @param string|null $deprovision_date
* @param string|null $deprovision_date_format
*
* @return void
*
* @throws GuzzleException
*
* @throws JsonException
*/
public function userCreatesDeprovisioningNotification(?string $user = null):void {
public function userCreatesDeprovisioningNotification(
?string $user = null,
?string $deprovision_date = "2043-07-04T11:23:12Z",
?string $deprovision_date_format= "2006-01-02T15:04:05Z07:00"
):void {
$payload["type"] = "deprovision";
$payload["data"] = ["deprovision_date" => "2043-07-04T11:23:12Z"];
$payload["data"] = ["deprovision_date" => $deprovision_date, "deprovision_date_format" => $deprovision_date_format];
$response = OcsApiHelper::sendRequest(
$this->featureContext->getBaseUrl(),
$user ? $this->featureContext->getActualUsername($user) : $this->featureContext->getAdminUsername(),
@@ -540,6 +549,21 @@ class NotificationContext implements Context {
$this->featureContext->setResponse($response);
}
/**
* @When the administrator creates a deprovisioning notification for date :deprovision_date of format :deprovision_date_format
*
* @param $deprovision_date
* @param $deprovision_date_format
*
* @return void
*
* @throws GuzzleException
* @throws JsonException
*/
public function theAdministratorCreatesADeprovisioningNotificationUsingDateFormat($deprovision_date, $deprovision_date_format) {
$this->userCreatesDeprovisioningNotification(null, $deprovision_date, $deprovision_date_format);
}
/**
* @Given the administrator has created a deprovisioning notification
*