refactor given/then step to remove setting response (#7244)

removing setting response in the given steps

use response interface

use the returned response

check success response

changed to inline variable

changed variable response_xml to responseXml
This commit is contained in:
Karun Atreya
2023-09-07 12:47:24 +05:45
committed by GitHub
parent 620b44c90a
commit 5c1e7e69a4
3 changed files with 70 additions and 72 deletions
@@ -2297,9 +2297,11 @@ class FeatureContext extends BehatVariablesContext {
$jsonExpectedDecoded = \json_decode($jsonExpected->getRaw(), true);
$jsonRespondedDecoded = $this->getJsonDecodedResponse();
$this->appConfigurationContext->theAdministratorGetsCapabilitiesCheckResponse();
$response = $this->appConfigurationContext->userGetsCapabilities($this->appConfigurationContext->getAdminUsernameForCapabilitiesCheck());
$this->theHTTPStatusCodeShouldBe(200, '', $response);
$responseXml = $this->getResponseXml($response)->data->capabilities;
$edition = $this->appConfigurationContext->getParameterValueFromXml(
$this->appConfigurationContext->getCapabilitiesXml(__METHOD__),
$responseXml,
'core',
'status@@@edition'
);
@@ -2311,7 +2313,7 @@ class FeatureContext extends BehatVariablesContext {
}
$product = $this->appConfigurationContext->getParameterValueFromXml(
$this->appConfigurationContext->getCapabilitiesXml(__METHOD__),
$responseXml,
'core',
'status@@@product'
);
@@ -2322,7 +2324,7 @@ class FeatureContext extends BehatVariablesContext {
}
$productName = $this->appConfigurationContext->getParameterValueFromXml(
$this->appConfigurationContext->getCapabilitiesXml(__METHOD__),
$responseXml,
'core',
'status@@@productname'
);
@@ -2340,7 +2342,7 @@ class FeatureContext extends BehatVariablesContext {
// We are on oCIS or reva or some other implementation. We cannot do "occ status".
// So get the expected version values by looking in the capabilities response.
$version = $this->appConfigurationContext->getParameterValueFromXml(
$this->appConfigurationContext->getCapabilitiesXml(__METHOD__),
$responseXml,
'core',
'status@@@version'
);
@@ -2352,7 +2354,7 @@ class FeatureContext extends BehatVariablesContext {
}
$versionString = $this->appConfigurationContext->getParameterValueFromXml(
$this->appConfigurationContext->getCapabilitiesXml(__METHOD__),
$responseXml,
'core',
'status@@@versionstring'
);