Support the ongoing development of Laravel.io →
Requests Testing
Last updated 2 years ago.
0

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:

  1. accounts.php - contains routes related to "account" functions

  2. admin.php - contains routes related to "admin" functions

  3. 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.

Last updated 2 years ago.
0

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:

  1. accounts.php - contains routes related to "account" functions

  2. admin.php - contains routes related to "admin" functions

  3. 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.

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.

Last updated 2 years ago.
0

@thepsion5 you just made (saved) my day! Cheers

0

well spent 1 day for this to debug that stupid error.

Thank you very much :)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.