You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

42 lines
1.1 KiB

<?php
namespace Tests\Unit\Models;
use Tests\TestCase;
use App\Entities\Users\User;
use App\Entities\Projects\Issue;
use App\Entities\Projects\Project;
use Illuminate\Foundation\Testing\RefreshDatabase;
class IssueTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function an_issue_has_belongs_to_project_relation()
{
$issue = factory(Issue::class)->make();
$this->assertInstanceOf(Project::class, $issue->project);
$this->assertEquals($issue->project_id, $issue->project->id);
}
/** @test */
public function an_issue_has_belongs_to_pic_relation()
{
$pic = $this->createUser('worker');
$issue = factory(Issue::class)->make(['pic_id' => $pic->id]);
$this->assertInstanceOf(User::class, $issue->pic);
$this->assertEquals($issue->pic_id, $issue->pic->id);
}
/** @test */
public function an_issue_has_belongs_to_creator_relation()
{
$issue = factory(Issue::class)->make();
$this->assertInstanceOf(User::class, $issue->creator);
$this->assertEquals($issue->creator_id, $issue->creator->id);
}
}