Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test-suite - Show warning when ".fixed" file not found #336

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/Standards/AbstractSniffUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ final public function testSniff()
$fixedFilename = basename($fixedFile);
$failureMessages[] = "Fixed version of $filename does not match expected version in $fixedFilename; the diff is\n$diff";
}
} else {
$this->addWarning("Unable to verify auto-fixer results. File not found: $fixedFile");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this message could be made more specific as it could now give the impression that all test case files for sniffs containing fixers are expected to have a .fixed file, even when the fixers should/will not run for the test case file.

What about something like:
"Missing fixed version of $filename to verify the accuracy of fixes, while the sniff is making fixes against the test case file"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the scenario that you're referring to. When would the test suite not need a ".fixed" file for a fixer?
I can understand when a test file only contains errors which cannot be fixed automatically, but that code path does not reach here.

I've updated the text as suggested.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the scenario that you're referring to. When would the test suite not need a ".fixed" file for a fixer?
I can understand when a test file only contains errors which cannot be fixed automatically, but that code path does not reach here.

I agree that the code path without fixable errors would not throw the notification, but the person running the test suite will not necessarily know that, which is why I suggested the slightly different text.

}
}
}//end if

// Restore the config.
$config->setSettings($oldConfig);
Expand Down