Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SaeedPrez's avatar

Testing Single Method Works, but MULTIPLE Methods Fail?

Hey guys,

I did a fresh install of Laravel and trying to write some simple tests for built in Auth. The thing is, each of these test methods work great if I run them with --filter method_name but if I run them together, only the first method works and the second method fails giving me ..

A request to [http://app] failed. Received status code [404].

Anyone got any clue why it's giving me error 404?

0 likes
1 reply
SaeedPrez's avatar
SaeedPrez
OP
Best Answer
Level 50

Finally after 1.5 hours of losing hair I found what was causing it..

Seems like PHPUnit doesn't like that I'm using separate files to organize my routes. I put all the routes in the routes.php file and now it's working as expected.

// routes.php
// This was causing the issue
include_once 'Routes\CommonRoutes.php';
include_once 'Routes\AuthRoutes.php';

Please or to participate in this conversation.