-
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: using resetServices()
in tests cause named routes to fail
#8018
Comments
In the constructor of
|
That would solve the problem, but I've never done anything related to routes, so I don't know how such a change would affect the rest of the code. |
In normal use cases, there is no change because loadRoutes() should be called (and is called now) right after the instantiation of RouteCollection. But the existing tests for the framework would fail, because some tests expect the RouteCollection does not have any route right after the instantiation. |
I found a bug #8024 in a test and the framework code. |
How about adding |
Oh, that might be better. |
Oh, it doesn't work. |
As you probably already know, the workaround is to call |
Yeah... maybe we should just promote this as a permanent solution. Not sure what others think about it. |
This is not a bug, and you need to call |
I can live with that, thanks! |
PHP Version
8.2
CodeIgniter4 Version
4.4.1 and develop
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
macOS
Which server did you use?
cli
Database
irrelevant
What happened?
Using
resetServices()
in tests causes named routes to fail.Steps to Reproduce
Routes.php
Sample.php - sample library
SampleTest.php - sample test
Expected Output
Passing tests.
Anything else?
If we comment out the line with
$this->resetServices();
, then all tests will pass.The text was updated successfully, but these errors were encountered: