Commit 4340f4a9 authored by Simon Welsh's avatar Simon Welsh

Only return unique errors

Turn the shape into json for set checking.

Fixes #4
parent 357991d3
Pipeline #144 passed with stages
in 3 minutes and 6 seconds
......@@ -110,16 +110,23 @@ abstract class HHITest extends \PHPUnit_Framework_TestCase {
'code' => int,
)> {
$errs = Vector {};
$compressed = Set {};
foreach ($errors as $error) {
$message = '';
foreach ($error['message'] as $m) {
$message .= $m['descr'].'. ';
}
$errs[] = shape(
$error = shape(
'error' => trim($message),
'line' => $error['message'][0]['line'],
'code' => $error['message'][0]['code'],
);
$comp = json_encode($error);
if (!$compressed->contains($comp)) {
$compressed[] = $comp;
$errs[] = $error;
}
}
return $errs->toImmVector();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment