-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Bug: [4.4] Failed tests on Windows. #7474
Comments
This is a bug and should be fixed. However, I don't think this directory separator issue can be solved that easily. |
I'm curious, is there a specific reason for the CI team not to check code with multiple platforms via GitHub Actions? https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs |
It seems to me that we can replace |
The use of |
Using It seems we need to normalize the directory separator. |
By the way, can we make workflow for windows? |
I'm on it. |
Is there a case in which the routes need to be reloaded while the application is running? But here the problem is because of the Services that predefine the classes. That is, during the tests it is impossible to replace services. |
|
@lonnieezell that is, we can replace |
Possibly, though I don't know how big the refactor would be to make that happen. That also doesn't solve the issue with them running on Windows. The I'm surprised we are running into these issues on Windows, though. I thought PHP solved that years ago so we didn't need to use that anymore. Guess not in all situations. Too bad. |
But shouldn't this problem be solved with handling normalize the route path?
|
Seems like the appropriate fix to me. |
I have implemented the normalize work in #7487, review please. |
PHP Version
7.4
CodeIgniter4 Version
4.4
CodeIgniter4 Installation Method
Git
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
No response
What happened?
After PR #7380 in Windows CodeIgniter\CodeIgniterTest::testRun404Override() and similar tests fail.
Instead of the expected response from the 404 error handler, a welcome_page is returned (from App\Controller\Home::index)
This is happening in this code snippet due to the difference in paths (directory separators) between Windows and UNIX.
CodeIgniter4/system/Router/RouteCollection.php
Lines 323 to 332 in d9fd9d5
Due to the difference in paths, the comparison fails and the file with routes from the application is loaded, thereby adding the route that is accessed in the tests.
Expected Output
Since the framework can be used not only on UNIX, the tests must also pass on Windows. This issue is just a special case and fixing by changing the requested resource in the tests will not solve the problem. That is, the behavior should be like in UNIX, that is, the route from the application should not be loaded.
Anything else?
In other tests related to file/directory paths, there are also errors on Windows due to the directory separator.
The text was updated successfully, but these errors were encountered: