-
Notifications
You must be signed in to change notification settings - Fork 430
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
fix windows tests #74
Closed
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b4c65be
fix windows tests
orklah c3ce8fe
ensure that git will not modify the line endings on windows and break…
orklah 2d3e907
revert wrong change. This has to be fixed somewhere else
orklah e60f9f4
misplaced config
orklah 6816386
misplaced config again
orklah dfacac3
travis has a special place for git configs
orklah File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a doubt on this one. While the PHPStan\Levels\StubValidatorIntegrationTest Test pass multiple times in a row, I think another test is deleting the "stubValidator-0.json" file.
If I'm not mistaken, the tests pass on the first try, but on the second, it complains about the file missing. However, I couldn't fix the issue without that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests extending LevelsTestCase are self-updating - if the expected contents of JSON files do not match, they are updated and the test fails. When running the 2nd time on the updated JSON files, the test will pass. So this change is breaking something if the JSON files are getting updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I don't think this change should be here, only test asserts should be updated.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I noticed that, when the test failed on first try, they passed on the second. What's weird this time is that the test pass on first try but fail after. I will investigate more on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, only the tests should change. I'll revert this line.
But to fix the actual issue, I'm kinda stuck. On LevelsTestCase::testLevels we use exec() to launch phpstan. This will always return Windows style path on Windows. And later, we compare this to a file generated on linux.
So we have to translate a path from one style to another somehow. Unfortunately, the FileHelper class use the DIRECTORY_SEPARATOR and will always normalize path on the same style.
This means we have to create a function to normalize a path with the opposite style. (To summarize, transform a Windows path to a Linux path) and then convert all the path in the phpstan output. Do you agree with that?