add test to check api activities with sort filter

Signed-off-by: prashant-gurung899 <prasantgrg777@gmail.com>
This commit is contained in:
prashant-gurung899
2024-10-04 12:07:40 +05:45
parent f1f22c72ad
commit 8f858dad9d
2 changed files with 41 additions and 1 deletions
+21 -1
View File
@@ -2935,7 +2935,7 @@ class GraphContext implements Context {
}
/**
* @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from space "([^"]*)" with (depth|limit) "([^"]*)" using the Graph API/
* @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from space "([^"]*)" with (depth|limit|sort) "([^"]*)" using the Graph API/
*
* @param string $user
* @param string $resource
@@ -2958,6 +2958,26 @@ class GraphContext implements Context {
$this->featureContext->setResponse($response);
}
/**
* @Then the activities should be in the following order:
*
* @param TableNode $table
*
* @return void
* @throws Exception
*/
public function theActivitiesShouldBeInTheFollowingOrder(TableNode $table): void {
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent();
$activities = $responseBody->value;
foreach ($table->getHash() as $index => $expectedValue) {
$actualActivity = $activities[$index];
$expectedActivity = $expectedValue['resource'] . ":" . $expectedValue['message'];
$actualActivity = $actualActivity->template->variables->resource->name . ":" . $actualActivity->template->message;
Assert::assertEquals($expectedActivity, $actualActivity, "Activity didn't match");
}
}
/**
* @When the administrator gets federated users using the Graph API
* @When user :user tries to get federated users using the Graph API