For anyone who may run into this problem in the future...
This was caused by problems with my routes.php
file. In particular, I organized by routes into a set of files:
accounts.php
- contains routes related to "account" functions
admin.php
- contains routes related to "admin" functions
etc...
These files were then included in my routes.php
file with require_once
. This works fine for my application, but for some reason, the routes were not loaded properly during testing. The solution is to move my routes back to the routes.php
file until I can find a better way to organize them.
Kryten0807 said:
For anyone who may run into this problem in the future...
This was caused by problems with my
routes.php
file. In particular, I organized by routes into a set of files:
accounts.php
- contains routes related to "account" functions
admin.php
- contains routes related to "admin" functionsetc...
These files were then included in my
routes.php
file withrequire_once
. This works fine for my application, but for some reason, the routes were not loaded properly during testing. The solution is to move my routes back to theroutes.php
file until I can find a better way to organize them.
I think I know what this occurred. Whenever you run multiple tests using Laravel's test case, you essentially "reboot" for every test you run. However, you're still running them within the same PHP process, meaning that PHP interprets your additional routes files as having already been loaded (which is technically true) and skips them. If you change your require_once to just require it should fix the issue.
well spent 1 day for this to debug that stupid error.
Thank you very much :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community