InterNations / http-mock

Mock HTTP requests on the server side in your PHP unit tests
http://www.internations.org
MIT License
390 stars 62 forks source link

Provide an absolute path to the router for the PHP CLI server to fix "No such file or directory" error #40

Closed EricTendian closed 6 years ago

EricTendian commented 6 years ago

In PHP source commit: https://github.com/php/php-src/commit/816758eda2bcdd69ba505fb6bbb79124a7bf2254 made to fix #75287, there is a change to how the router argument is passed in. Previously, the CLI accepted relative paths (to the current working directory) for the router argument. After this change, it either uses an absolute path, or concatenates the server docroot and the router if an absolute path is not provided. This causes the error seen in #39.

While normally this would be fixed by just changing the router argument to index.php, it breaks compatibility with PHP version 7.1.11 and below as those versions expect an absolute path. Thus, this fix involves getting the absolute path to the router file and passing that in instead.

I have tested this on both 7.1.11 and 7.1.12 and it works.

ademarco commented 6 years ago

I can reproduce this as well, @lstrojny any chance we can merge this once we fix coding standards?

darrynten commented 6 years ago

👍 we're also affected by this

ademarco commented 6 years ago

Maybe we should fix tests to in order to increase chances of seeing this merged in.

ademarco commented 6 years ago

Ok I fixed tests and CS on #41 @lstrojny could we merge this one in if tests are OK?

ademarco commented 6 years ago

@lstrojny thank you for merging #41 ! We can close this one as #41 contains it.