diff --git a/VariableAnalysis/Tests/BaseTestCase.php b/VariableAnalysis/Tests/BaseTestCase.php index 072d2177..20759d97 100644 --- a/VariableAnalysis/Tests/BaseTestCase.php +++ b/VariableAnalysis/Tests/BaseTestCase.php @@ -19,7 +19,9 @@ public function prepareLocalFileForSniffs($sniffFiles, string $fixtureFile): Loc } public function getLineNumbersFromMessages(array $messages): array { - return array_keys($messages); + $lines = array_keys($messages); + sort($lines); + return $lines; } public function getWarningLineNumbersFromFile(LocalFile $phpcsFile): array { diff --git a/VariableAnalysis/Tests/CodeAnalysis/VariableAnalysisTest.php b/VariableAnalysis/Tests/CodeAnalysis/VariableAnalysisTest.php index 5bea562d..0dd95cc1 100644 --- a/VariableAnalysis/Tests/CodeAnalysis/VariableAnalysisTest.php +++ b/VariableAnalysis/Tests/CodeAnalysis/VariableAnalysisTest.php @@ -73,8 +73,8 @@ public function testFunctionWithGlobalVarWarnings() { $phpcsFile->process(); $lines = $this->getWarningLineNumbersFromFile($phpcsFile); $expectedWarnings = [ - 7, 4, + 7, 22, ]; $this->assertEquals($expectedWarnings, $lines); @@ -214,8 +214,8 @@ public function testFunctionWithReferenceWarnings() { $phpcsFile->process(); $lines = $this->getWarningLineNumbersFromFile($phpcsFile); $expectedWarnings = [ - 20, 8, + 20, 32, 33, 34, @@ -363,13 +363,13 @@ public function testCompactWarnings() { $phpcsFile->process(); $lines = $this->getWarningLineNumbersFromFile($phpcsFile); $expectedWarnings = [ + 2, 7, 10, - 2, - 23, - 26, 14, 19, + 23, + 26, ]; $this->assertEquals($expectedWarnings, $lines); }