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

CandidateTest::testFields()   B

Complexity

Conditions 3
Paths 3

Size

Total Lines 45
Code Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 45
c 0
b 0
f 0
rs 8.8571
cc 3
eloc 32
nc 3
nop 0
1
<?php
2
namespace Tests\Unit;
3
4
use Lyal\Checkr\Entities\Resources\Candidate;
5
use Tests\UnitTestCase;
6
7
class CandidateTest extends UnitTestCase
8
{
9
    public function testInstantiation()
10
    {
11
        $this->assertInstanceOf('Lyal\Checkr\Entities\Resources\Candidate', $this->getCandidate());
12
    }
13
14
    public function testSetId()
15
    {
16
        $candidate = $this->getCandidate();
17
        $candidate->id = 'e44aa283528e6fde7d542194';
18
        $this->assertSame('e44aa283528e6fde7d542194', $candidate->id);
19
    }
20
21
    public function testFields()
22
    {
23
        $values = [
24
            'id' => 'e44aa283528e6fde7d542194',
25
            'object' => 'candidate',
26
            'uri' => '/v1/candidates/e44aa283528e6fde7d542194',
27
            'created_at' => '2014-01-18T12:34:00Z',
28
            'first_name' => 'John',
29
            'middle_name' => 'Alfred',
30
            'no_middle_name' => false,
31
            'last_name' => 'Smith',
32
            'mother_maiden_name' => NULL,
33
            'email' => '[email protected]',
34
            'phone' => '5555555555',
35
            'zipcode' => '90401',
36
            'dob' => '1970-01-22',
37
            'ssn' => 'XXX-XX-4645',
38
            'driver_license_number' => 'F211165',
39
            'driver_license_state' => 'CA',
40
            'previous_driver_license_number' => 'F1501739',
41
            'previous_driver_license_state' => 'CA',
42
            'copy_requested' => false,
43
            'custom_id' => NULL,
44
            'report_ids' =>
45
                [
46
                    '532e71cfe88a1d4e8d00000d',
47
                ],
48
            'geo_ids' =>
49
                [
50
                    '79f943e212cce7de21c054a8',
51
                    '7299c2c22ebb19abb0688a6c',
52
                ],
53
            'document_ids' =>
54
                [
55
                ]
56
        ];
57
58
        $candidate = $this->getCandidate($values);
59
60
        foreach ($values as $key => $value) {
61
            if (is_array($value)) {
62
                $value = collect($value);
63
            }
64
65
            $this->assertEquals($value, $candidate->{$key});
66
        }
67
68
    }
69
70
    protected function getCandidate($values = NULL)
71
    {
72
        return new Candidate($values,$this->getClient());
73
    }
74
}
75