Test Failed
Push — master ( 6bff04...e0da10 )
by Lyal
02:14
created

ApiTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 39
c 0
b 0
f 0
rs 10
1
<?php
2
namespace Tests\Api;
3
4
use Lyal\Checkr\Entities\Resources\Candidate;
5
use Lyal\Checkr\Exceptions\Client\BadRequest;
6
use Tests\ApiTestCase;
7
8
class ApiTest extends ApiTestCase
9
{
10
11
    private $candidate;
12
13
    public function setup()
14
    {
15
        parent::setUp();
16
        $this->candidate = $this->getClient()->candidate([
17
            'first_name' => 'John',
18
            'middle_name' => 'James',
19
            'last_name' => 'Allen',
20
            'ssn' => '111-11-2002',
21
            'dob' => '1980-01-01',
22
            'zipcode' => '90210',
23
            'email' => '[email protected]'])->create();
24
    }
25
26
    public function testBadRequest()
27
    {
28
        $this->expectException(BadRequest::class);
29
        $this->candidate->invitation()->create();
30
    }
31
32
    public function testFlow()
33
    {
34
        $invitation = $this->candidate->invitation(['package' => 'tasker_pro'])->create();
35
        $this->assertTrue(isset($invitation->id));
36
        $deleted = $invitation->delete();
37
        $this->assertInstanceOf(get_class($this->getClient()), $deleted);
38
        $report = $this->candidate->report(['package' => 'tasker_pro'])->create();
39
        $report = $report->embed('candidate,ssn_trace,county_criminal_searches ')->load();
40
        $this->assertEquals('John', $report->candidate->first_name);
41
    }
42
43
    public function testListAllCandidates()
44
    {
45
        $candidates = $this->getClient()->candidate()->all();
46
        $this->assertInstanceOf(Candidate::class, $candidates->first());
47
    }
48
49
}