Level 1
Found any solution? I am getting same issue.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hey guyz,
I'm running into an issue while unit testing a controller, at some point during the unit testing run, the content of my requests are removed.
use Illuminate\Support\Facades\DB;
class AccountControllerTest extends TestCase
{
public function testInsertAchievedCAs()
{
$response = $this->call(
'POST', '/account', [], [], [], [], 'AAAAA'
);
$this->assertResponseOk();
}
}
class AccountController extends Controller
{
/**
* @param Request $request
*
* @return string
*/
public function insertAccount(Request $request)
{
$content = $request->getContent();
// While running unit tests $content === ""
// While running normally through postman for example $content === "AAAAA"
}
}
So basically the app is working as intended when using the browser, but the unit tests are not working as intended, did any of you run into this issue ? Or am I missing something ?
Please or to participate in this conversation.