Browse Source

Add project comments relation test

pull/15/head
Nafies Luthfi 7 years ago
parent
commit
43407698fd
  1. 14
      tests/Unit/Models/ProjectTest.php

14
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());
}
}
Loading…
Cancel
Save