Skip to content

Commit

Permalink
GraphQL-122: API-functional tests: assertResponseFields moved to the …
Browse files Browse the repository at this point in the history
…abstract class
  • Loading branch information
Valeriy Nayda committed Aug 16, 2018
1 parent 16c17ba commit cbd470b
Showing 1 changed file with 0 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,28 +74,4 @@ private function assertSimpleProductFields($product, $actualResponse)

$this->assertResponseFields($actualResponse, $assertionMap);
}

/**
* @param array $actualResponse
* @param array $assertionMap
*/
private function assertResponseFields($actualResponse, $assertionMap)
{
foreach ($assertionMap as $key => $assertionData) {
$expectedValue = isset($assertionData['expected_value'])
? $assertionData['expected_value']
: $assertionData;
$responseField = isset($assertionData['response_field']) ? $assertionData['response_field'] : $key;
self::assertNotNull(
$expectedValue,
"Value of '{$responseField}' field must not be NULL"
);
self::assertEquals(
$expectedValue,
$actualResponse[$responseField],
"Value of '{$responseField}' field in response does not match expected value: "
. var_export($expectedValue, true)
);
}
}
}

0 comments on commit cbd470b

Please sign in to comment.