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

Unit test: fix tests failing #108

Merged
merged 1 commit into from
Jan 18, 2020

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Jan 15, 2020

I'm not completely sure why, but when I tried to run the unit tests locally, most were failing.

This minor tweak in how PHPCS is instantiated fixes it. It also removes the need for the getSniffFiles() method as there is only one sniff in this standard anyway.

@sirbrillig
Copy link
Owner

Hm. While this passes in php7, it seems to fail in php 5 (see the CI tests which I finally got to work on contributor PRs).

@jrfnl
Copy link
Collaborator Author

jrfnl commented Jan 17, 2020

@sirbrillig Hmm... I'll have little play with that. The failure you are seeing on PHP 5 are what I was seeing on PHP 7 leading to this PR.

@jrfnl
Copy link
Collaborator Author

jrfnl commented Jan 17, 2020

@sirbrillig This is weird, I've just tried to reproduce the errors you are seeing on circleCI locally and cannot with this branch.

image

@jrfnl
Copy link
Collaborator Author

jrfnl commented Jan 17, 2020

Also working perfectly fine with PHP 7 and PHPUnit 7.x locally:

image

@jrfnl jrfnl force-pushed the feature/fix-failing-tests branch 2 times, most recently from 5e3ebb3 to c9d6df1 Compare January 17, 2020 20:13
@sirbrillig
Copy link
Owner

🤔 This is really weird. I suppose there must be something different about the CI environment. I'm trying to reproduce this myself but I'm having trouble getting php 5 installed again. I used to have a way to do this but I've forgotten and/or homebrew has changed how it manages php. Do you use homebrew? If so, how do you switch?

@jrfnl
Copy link
Collaborator Author

jrfnl commented Jan 17, 2020

@sirbrillig No, I'm on Windows, so no homebrew here. I've got a ridiculous amount of PHP versions installed so I can switch between them with ease and used the same PHP + PHPUnit version as CircleCI does when I tested locally on PHP 5.

@jrfnl
Copy link
Collaborator Author

jrfnl commented Jan 17, 2020

@sirbrillig I'm going to run some tests to see which particular bit of the change is causing the CircleCI failure, so I'll be force pushing to this branch over and over till I find it. I'll report back when I know more.

Please ignore all the push notifications you'll be getting ;-)

@jrfnl jrfnl force-pushed the feature/fix-failing-tests branch 3 times, most recently from 5f0d172 to 4475ce5 Compare January 17, 2020 22:26
@jrfnl
Copy link
Collaborator Author

jrfnl commented Jan 17, 2020

Ha! I've found why the tests were failing when I ran them locally. It had to do with the mixed forward/backward slashes in the $sniffFiles path.

Now off to see if I can find a simple solution which works cross-platfom.

@jrfnl
Copy link
Collaborator Author

jrfnl commented Jan 17, 2020

@sirbrillig Ok, so I can now change this to the most minimal change to get it working cross-platform or I can still try to simplify the tests a little more and keep the PR a little more comprehensive than just the minimum. Got a preference ?

@sirbrillig
Copy link
Owner

sirbrillig commented Jan 17, 2020

Nice sleuthing. Let's start with the minimum to make things work and then make the simplification its own PR. I really like that simplification, BTW.

That said, is this ready?

The tests would fail on Windows due to the mix of forward and backward slashes in the sniff file name.

This simple change should allow the tests to work cross-platform.
@jrfnl
Copy link
Collaborator Author

jrfnl commented Jan 18, 2020

@sirbrillig It is now ;-)

I've force pushed just the commit with the simplest fix to this branch now (ee263e8). If CircleCI passes, it's ready to be merged.

@sirbrillig sirbrillig merged commit 1ff7831 into sirbrillig:master Jan 18, 2020
@jrfnl jrfnl deleted the feature/fix-failing-tests branch January 19, 2020 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants