refactor given when then steps in settings and tus contexts (#7357)

set resource location from response

addressed the reviews

reset  spaceidfromocis

reset after scenario using after hook
This commit is contained in:
Karun Atreya
2023-09-27 12:29:56 +05:45
committed by GitHub
parent 5ca6a98087
commit cc794abb38
4 changed files with 104 additions and 66 deletions
@@ -349,12 +349,12 @@ class SettingsContext implements Context {
* @param string $user
* @param string $language
*
* @return void
* @return ResponseInterface
*
* @throws GuzzleException
* @throws Exception
*/
public function sendRequestToSwitchSystemLanguage(string $user, string $language): void {
public function sendRequestToSwitchSystemLanguage(string $user, string $language): ResponseInterface {
$profileBundlesList = $this->getBundlesList($user, "Profile");
Assert::assertNotEmpty($profileBundlesList, "bundles list is empty");
@@ -390,9 +390,12 @@ class SettingsContext implements Context {
],
JSON_THROW_ON_ERROR
);
$this->featureContext->setResponse(
$this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), $body, $this->featureContext->getStepLineRef())
return $this->spacesContext->sendPostRequestToUrl(
$fullUrl,
$user,
$this->featureContext->getPasswordForUser($user),
$body,
$this->featureContext->getStepLineRef()
);
}
@@ -405,12 +408,14 @@ class SettingsContext implements Context {
* @return void
*
* @throws Exception
* @throws GuzzleException
*/
public function theUserHasSwitchedSysemLanguage(string $user, string $language): void {
$this->sendRequestToSwitchSystemLanguage($user, $language);
public function theUserHasSwitchedSystemLanguage(string $user, string $language): void {
$response = $this->sendRequestToSwitchSystemLanguage($user, $language);
$this->featureContext->theHTTPStatusCodeShouldBe(
201,
"Expected response status code should be 201"
"Expected response status code should be 201",
$response
);
}
}