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

shaungbhone's avatar

1) Tests\Feature\ParticipateForumTest::a_reply_requires_a_body Session is missing expected key [errors]. Failed asserting that false is true.

Hi Guys, I got an error. a_thread_requires_a_body() is worked. a_reply_requires_a_body() is not worked. All are the same conditions.

/** @test */
    function a_reply_requires_a_body()
    {
        $this->signIn();

        $thread = create(Thread::class);
        $reply = make(Reply::class, ['body' => null]);

        $this->post($thread->path().'/repiles', $reply->toArray())
            ->assertSessionHasErrors('body');
    }

repliescontroller.php

public function store($locale, $channelId, Thread $thread)
    {
        $this->validate(request(), [
            'body' => 'required',
        ]);
}
0 likes
4 replies
automica's avatar
automica
Best Answer
Level 54

@shaungbhone are you sure your route is correct?

shouldn't

'/repiles'

be:

'/replies'

what does

$thread->path().'/repiles'

resolve to? do you have enough arguments for your store method?

Sinnbeck's avatar

Please mark a best answer if the issue was solved.

Please or to participate in this conversation.