tests: add api tests for changing system language using graph api (#7817)

This commit is contained in:
Swikriti Tripathi
2023-11-28 15:33:17 +05:45
committed by GitHub
parent 2811a018cf
commit 580e8aeb46
8 changed files with 85 additions and 14 deletions
@@ -2466,4 +2466,51 @@ class GraphContext implements Context {
)
);
}
/**
* @Given user :user has switched the system language to :language using the Graph API
*
* @param string $user
* @param string $language
*
* @return void
* @throws GuzzleException
*/
public function userHasSwitchedTheSystemLanguageUsingGraphApi(string $user, string $language): void {
$credentials = $this->getAdminOrUserCredentials($user);
$response = GraphHelper::switchSystemLanguage(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$credentials['username'],
$credentials['password'],
$language
);
$this->featureContext->theHTTPStatusCodeShouldBe(
200,
"Expected response status code should be 200",
$response
);
}
/**
* @When user :user switches the system language to :language using the Graph API
*
* @param string $user
* @param string $language
*
* @return void
* @throws GuzzleException
*/
public function userSwitchesTheSystemLanguageUsingGraphApi(string $user, string $language): void {
$credentials = $this->getAdminOrUserCredentials($user);
$this->featureContext->setResponse(
GraphHelper::switchSystemLanguage(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$credentials['username'],
$credentials['password'],
$language
)
);
}
}