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

EmployerTest::testFields()   B

Complexity

Conditions 3
Paths 3

Size

Total Lines 40
Code Lines 29

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 40
c 0
b 0
f 0
rs 8.8571
cc 3
eloc 29
nc 3
nop 0
1
<?php
2
namespace Tests\Unit;
3
4
use Lyal\Checkr\Entities\Resources\Employer;
5
use Tests\UnitTestCase;
6
7
class EmployerTest extends UnitTestCase
8
{
9
    public function testInstantiation()
10
    {
11
        $this->assertInstanceOf('Lyal\Checkr\Entities\Resources\Employer', $this->getEmployer());
12
    }
13
14
    public function testSetId()
15
    {
16
        $employer = $this->getEmployer();
17
        $employer->id = 'e44aa283528e6fde7d542194';
18
        $this->assertSame('e44aa283528e6fde7d542194', $employer->id);
19
    }
20
21
    public function testFields()
22
    {
23
        $values = [
24
            'id' => 'ca27df84be5b50dfa7ee1cda',
25
            'object' => 'test_candidate_employer',
26
            'uri' => '/v1/candidates/e44aa283528e6fde7d542194/employers/ca27df84be5b50dfa7ee1cda',
27
            'candidate_id' => 'e44aa283528e6fde7d542194',
28
            'name' => 'Checkr',
29
            'position' => 'Software Engineer',
30
            'salary' => 10000,
31
            'contract_type' => 'full_time',
32
            'do_not_contact' => false,
33
            'start_date' => '2016-06-01',
34
            'employer_url' => 'www.employer.com',
35
            'end_date' => '2017-05-01',
36
            'address' =>
37
                [
38
                    'street' => '123 Main St.',
39
                    'city' => 'San Francisco',
40
                    'state' => 'CA',
41
                    'zipcode' => '94108',
42
                    'country' => 'US',
43
                ],
44
            'manager' =>
45
                [
46
                    'email' => '[email protected]',
47
                    'name' => 'Joe Smith',
48
                    'phone' => '212-555-1234',
49
                    'title' => 'Engineering Manager',
50
                ]
51
        ];
52
53
        $employer = $this->getEmployer($values);
54
55
        foreach ($values as $key => $value) {
56
            if (is_array($value)) {
57
                $value = collect($value);
58
            }
59
60
            $this->assertEquals($value, $employer->{$key});
61
        }
62
63
    }
64
65
    protected function getEmployer($values = NULL)
66
    {
67
        return new Employer($values,$this->getClient());
68
    }
69
}