Skip to content

Commit

Permalink
Sort schema field for test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
klimart committed Nov 4, 2018
1 parent b8d2663 commit f06056a
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,16 @@ enumValues(includeDeprecated: true) {
$mergedSchemaResponseFields = array_merge($schemaResponseFieldsFirstHalf, $schemaResponseFieldsSecondHalf);

foreach ($expectedOutput as $searchTerm) {
$sortFields = ['inputFields', 'fields'];
foreach ($sortFields as $sortField) {
isset($searchTerm[$sortField]) && is_array($searchTerm[$sortField])
? usort($searchTerm[$sortField], function($a, $b) {
$cmpField = 'name';
return isset($a[$cmpField]) && isset($b[$cmpField])
? strcmp($a[$cmpField], $b[$cmpField]) : 0;
}) : null;
}

$this->assertTrue(
(in_array($searchTerm, $mergedSchemaResponseFields)),
'Missing type in the response'
Expand Down

0 comments on commit f06056a

Please sign in to comment.