Completed
Push — feature/policy_unit_tests ( 8a95e1...e0fa79 )
by Tristan
07:24
created

BasePolicyTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 9
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A makeApplicant() 0 13 1
1
<?php
2
3
namespace Tests\Unit;
4
5
use Tests\TestCase;
6
use Illuminate\Foundation\Testing\WithFaker;
7
use Illuminate\Foundation\Testing\RefreshDatabase;
8
9
/**
10
 * A base class for Policy tests
11
 */
12
class BasePolicyTest extends TestCase
13
{
14
15
    protected function makeApplicant($id) {
16
        //New applicants get a new user
17
        $user =  User::make();
18
        $user->id = $id;
19
        // Make user an Applicant
20
        $user->user_role()->associate(
21
            UserRole::where('name', 'applicant')->firstOrFail());
22
23
        $userApplicant = new Applicant();
24
        $userApplicant->id = $id;
25
        $userApplicant->user()->associate($user);
26
27
        return $userApplicant;
28
    }
29
}
30