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

SchoolTest::testFields()   B

Complexity

Conditions 3
Paths 3

Size

Total Lines 34
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 34
c 0
b 0
f 0
rs 8.8571
cc 3
eloc 26
nc 3
nop 0
1
<?php
2
namespace Tests\Unit;
3
4
use Lyal\Checkr\Entities\Resources\School;
5
use Tests\UnitTestCase;
6
7
class SchoolTest extends UnitTestCase
8
{
9
    public function testInstantiation()
10
    {
11
        $this->assertInstanceOf('Lyal\Checkr\Entities\Resources\School', $this->getSchool());
12
    }
13
14
    public function testSetId()
15
    {
16
        $school = $this->getSchool();
17
        $school->id = 'e44aa283528e6fde7d542194';
18
        $this->assertSame('e44aa283528e6fde7d542194',$school->id);
19
    }
20
21
    public function testFields()
22
    {
23
        $values = [
24
            'id' => '95a95172bb81143ed44e403c',
25
            'object' => 'candidate_school',
26
            'uri' => '/v1/candidates/762781cdd1c7fd620e956583/schools/95a95172bb81143ed44e403c',
27
            'candidate_id' => '762781cdd1c7fd620e956583',
28
            'name' => 'College University',
29
            'address' => [
30
                'street' => '1 Circle Avenue',
31
                'city' => 'San Francisco',
32
                'zipcode' => '94105',
33
                'state' => 'CA',
34
                'country' => 'US',
35
            ],
36
            'degree' => 'MS',
37
            'year_awarded' => 2017,
38
            'major' => 'Computer Science',
39
            'phone' => '415-111-1111',
40
            'minor' => 'Background Checks',
41
            'start_date' => '2013-08-25',
42
            'end_date' => '2017-05-10',
43
            'current' => false,
44
            'school_url' => 'www.collegeuniversity.com'
45
        ];
46
47
        $school = $this->getSchool($values);
48
49
        foreach ($values as $key => $value) {
50
            if (is_array($value)) {
51
                $value = collect($value);
52
            }
53
54
            $this->assertEquals($value, $school->{$key});
55
        }
56
57
    }
58
59
    protected function getSchool($values = NULL)
60
    {
61
        return new School($values,$this->getClient());
62
    }
63
}