From 43407698fd4bcf6003d3d642b1d61aac5d326a35 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sat, 4 Aug 2018 13:09:10 +0800 Subject: [PATCH] Add project comments relation test --- tests/Unit/Models/ProjectTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Unit/Models/ProjectTest.php b/tests/Unit/Models/ProjectTest.php index d8e756f..5811409 100644 --- a/tests/Unit/Models/ProjectTest.php +++ b/tests/Unit/Models/ProjectTest.php @@ -6,6 +6,7 @@ use Tests\TestCase; use App\Entities\Projects\Job; use App\Entities\Projects\Task; use App\Entities\Payments\Payment; +use App\Entities\Projects\Comment; use App\Entities\Projects\Project; use Illuminate\Support\Collection; use App\Entities\Partners\Customer; @@ -195,4 +196,17 @@ class ProjectTest extends TestCase $this->assertEquals($collectibeEarnings, $project->getCollectibeEarnings()); } + + /** @test */ + public function a_project_has_many_comments_relation() + { + $project = factory(Project::class)->create(); + $comment = factory(Comment::class)->create([ + 'commentable_type' => 'projects', + 'commentable_id' => $project->id, + ]); + + $this->assertInstanceOf(Collection::class, $project->comments); + $this->assertInstanceOf(Comment::class, $project->comments->first()); + } }