removing usage of a stepdefination inside another stepdefination in NotificationContext.php (#9022)

This commit is contained in:
nirajacharya2
2024-05-06 15:22:20 +05:45
committed by GitHub
parent b5e9d5e131
commit 3e88b2cc25
@@ -51,7 +51,17 @@ class NotificationContext implements Context {
* @return void * @return void
*/ */
public function deleteDeprovisioningNotification(): void { public function deleteDeprovisioningNotification(): void {
$this->userDeletesDeprovisioningNotification(); $payload["ids"] = ["deprovision"];
OcsApiHelper::sendRequest(
$this->featureContext->getBaseUrl(),
$this->featureContext->getAdminUsername(),
$this->featureContext->getAdminPassword(),
'DELETE',
$this->globalNotificationEndpointPath,
$this->featureContext->getStepLineRef(),
json_encode($payload)
);
} }
/** /**
@@ -242,8 +252,9 @@ class NotificationContext implements Context {
* @throws Exception * @throws Exception
*/ */
public function userShouldNotHaveAnyNotification($user): void { public function userShouldNotHaveAnyNotification($user): void {
$this->userListAllNotifications($user); $response = $this->listAllNotifications($user);
$this->theNotificationsShouldBeEmpty(); $notifications = $this->featureContext->getJsonDecodedResponseBodyContent($response)->ocs->data;
Assert::assertNull($notifications, "response should not contain any notification");
} }
/** /**
@@ -414,8 +425,8 @@ class NotificationContext implements Context {
$actualMessage, $actualMessage,
__METHOD__ . "expected message to be '$expectedMessage' but found'$actualMessage'" __METHOD__ . "expected message to be '$expectedMessage' but found'$actualMessage'"
); );
$this->userDeletesNotificationOfResourceAndSubject($user, $resource, $subject); $response = $this->userDeletesNotification($user);
$this->featureContext->theHTTPStatusCodeShouldBe(200); $this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
} elseif (\count($notification) === 0) { } elseif (\count($notification) === 0) {
throw new \Exception("Response doesn't contain any notification with resource '$resource' and subject '$subject'.\n" . print_r($notification, true)); throw new \Exception("Response doesn't contain any notification with resource '$resource' and subject '$subject'.\n" . print_r($notification, true));
} else { } else {