mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-06 04:09:40 -06:00
Drive infor assertion
This commit is contained in:
committed by
Phil Davis
parent
265db41819
commit
46575abe11
@@ -1364,23 +1364,43 @@ class GraphContext implements Context {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @Then the response should contain the following drive information:
|
||||
* @param array $expectedDriveInformation
|
||||
* @param array $actualValueDriveInformation
|
||||
*
|
||||
* @throws GuzzleException
|
||||
* @return void
|
||||
*/
|
||||
public function theResponseShouldContainTheFollowingDriveInformation(TableNode $table)
|
||||
{
|
||||
$rows = $table->getRowsHash();
|
||||
$responseAPI = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse())['drive'];
|
||||
foreach (array_keys($rows) as $keyName) {
|
||||
Assert::assertEquals(
|
||||
$rows[$keyName],
|
||||
$responseAPI[$keyName],
|
||||
__METHOD__ .
|
||||
' Expected ' . $keyName . 'to have value' . $responseAPI[$keyName]
|
||||
. ' but got ' . $rows[$keyName]
|
||||
public function checkUserDriveInformation(array $expectedDriveInformation, array $actualValueDriveInformation):void {
|
||||
foreach (array_keys($expectedDriveInformation) as $keyName) {
|
||||
// break the segment with @@@ here
|
||||
$separatedKey = explode("@@@",$keyName);
|
||||
$actualKeyAvalue = null;
|
||||
$actualKeyAvalue = $actualValueDriveInformation['owner'];
|
||||
var_dump(
|
||||
$actualKeyAvalue
|
||||
);
|
||||
foreach ($separatedKey as $key) {
|
||||
// this loop sets and get the actual keyvalue from the actual API response
|
||||
$actualKeyAvalue = $actualValueDriveInformation[$key];
|
||||
}
|
||||
var_dump(
|
||||
$actualKeyAvalue
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @Then the user retrieve API response should contain the following drive information:
|
||||
*/
|
||||
public function theResponseShouldContainTheFollowingDriveInformation(TableNode $table)
|
||||
{
|
||||
$expectedDriveInformation = $table->getRowsHash();
|
||||
// array of user drive information (Personal Drive Information Only)
|
||||
$actualDriveInformation = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse())['drive'];
|
||||
$this->checkUserDriveInformation($expectedDriveInformation, $actualDriveInformation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user