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

ProgramTest::testFields()   B

Complexity

Conditions 3
Paths 3

Size

Total Lines 26
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
c 0
b 0
f 0
rs 8.8571
cc 3
eloc 15
nc 3
nop 0
1
<?php
2
namespace Tests\Unit;
3
4
use Lyal\Checkr\Entities\Resources\Program;
5
use Tests\UnitTestCase;
6
7
class ProgramTest extends UnitTestCase
8
{
9
    public function testInstantiation()
10
    {
11
        $this->assertInstanceOf('Lyal\Checkr\Entities\Resources\Program', $this->getProgram());
12
    }
13
14
    public function testSetId()
15
    {
16
        $program = $this->getProgram();
17
        $program->id = 'e44aa283528e6fde7d542194';
18
        $this->assertSame('e44aa283528e6fde7d542194',$program->id);
19
    }
20
21
    public function testFields()
22
    {
23
        $values = [
24
            'id' => '00166f9ff39ec7b453adfaec',
25
            'object' => 'program',
26
            'name' => 'Program A',
27
            'created_at' => '2017-08-07T16:51:09Z',
28
            'deleted_at' => NULL,
29
            'geo_ids' =>
30
                [
31
                    'cbc37748bc6a45b41af5c3f5',
32
                ],
33
            'package_ids' =>
34
                [
35
                    'a57a0cd15965a585ff7d5d35',
36
                ]
37
        ];
38
39
        $program = $this->getProgram($values);
40
41
        foreach ($values as $key => $value) {
42
            if (is_array($value)) {
43
                $value = collect($value);
44
            }
45
46
            $this->assertEquals($value, $program->{$key});
47
        }
48
49
    }
50
51
    protected function getProgram($values = NULL)
52
    {
53
        return new Program($values,$this->getClient());
54
    }
55
}