NOHHANGYEOL's avatar

If the test fails because the comments generated in the post and the comments in the test are different during the test.

If the test fails because the comments generated in the post and the comments in the test are different during the test.

How do I match the data in the test case?

<?php

    namespace Tests\Feature;

    use Tests\TestCase;

    class ParticipateInForumTest extends TestCase
    {
  
        /** @test */
        public function an_authenticated_user_may_participate_in_forum_threads()
        {
            $this->be(factory('App\User')->create());

            $thread = factory('App\Thread')->create();

            $reply = factory('App\Reply')->create();

            $this->post($thread->path() . '/replies', $reply->toArray());
            $this->get($thread->path())->assertSee($reply->body);
        }

    }

$reply->body Error in

html respon = Qui necessitatibus dolor voluptatem maiores illum. Id ex eligendi enim animi

testcase reply->body = Aspernatur ad deserunt quidem expedita est. Quisquam aut non enim quod. Qui dolore eaque officia saepe illo est.

0 likes
4 replies
NOHHANGYEOL's avatar

wow.. I checked with sql data and passed the test without error.

Thank you for your help!

1 like
NOHHANGYEOL's avatar

/** @test */ public function an_authenticated_user_may_participate_in_forum_threads() { $this->be(factory('App\User')->create());

        $thread = Thread::find(118);    //factory('App\Thread')->create();

        $reply = Reply::find(118,'thread_id');    //factory('App\Reply')->create(); //create, make

        $this->post($thread->path() . '/replies', $reply->toArray());
        $this->get($thread->path())->assertSee($reply->body);
    }

Please or to participate in this conversation.