Skip to content

Commit

Permalink
RuleTestCase: fix order of errors for long testcases (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
janedbal authored Jun 11, 2024
1 parent d8584cc commit 7088eff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/RuleTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected function processActualErrors(array $actualErrors): array

foreach ($actualErrors as $error) {
$usedLine = $error->getLine() ?? -1;
$key = $usedLine . '-' . uniqid();
$key = sprintf('%04d', $usedLine) . '-' . uniqid();
$resultToAssert[$key] = $this->formatErrorForAssert($error->getMessage(), $usedLine);

self::assertNotNull($error->getIdentifier(), "Missing error identifier for error: {$error->getMessage()}");
Expand Down Expand Up @@ -88,7 +88,7 @@ private function parseExpectedErrors(string $file): array

foreach ($matches[1] as $error) {
$actualLine = $line + 1;
$key = $actualLine . '-' . uniqid();
$key = sprintf('%04d', $actualLine) . '-' . uniqid();
$expectedErrors[$key] = $this->formatErrorForAssert(trim($error), $actualLine);
}
}
Expand Down

0 comments on commit 7088eff

Please sign in to comment.