@nohhangyeol The best way to do this is to use a sqlite database specifically for testing and seed your data to that.
https://laracasts.com/series/phpunit-testing-in-laravel/episodes/5
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.
@nohhangyeol The best way to do this is to use a sqlite database specifically for testing and seed your data to that.
https://laracasts.com/series/phpunit-testing-in-laravel/episodes/5
Please or to participate in this conversation.