Test Failed
Push — master ( 7c4720...fd955c )
by Lyal
04:00 queued 14s
created

NationalCriminalSearchTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
dl 0
loc 52
c 0
b 0
f 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testInstantiation() 0 3 1
B testFields() 0 31 3
A testSetId() 0 5 1
A getNationalCriminalSearch() 0 3 1
1
<?php
2
namespace Tests\Unit;
3
4
use Lyal\Checkr\Entities\Screenings\NationalCriminalSearch;
5
use Tests\UnitTestCase;
6
7
class NationalCriminalSearchTest extends UnitTestCase
8
{
9
    public function testInstantiation()
10
    {
11
        $this->assertInstanceOf('Lyal\Checkr\Entities\Screenings\NationalCriminalSearch', $this->getNationalCriminalSearch());
12
    }
13
14
    public function testSetId()
15
    {
16
        $nationalCriminalSearch = $this->getNationalCriminalSearch();
17
        $nationalCriminalSearch->id = 'e44aa283528e6fde7d542194';
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on Lyal\Checkr\Entities\Scr...\NationalCriminalSearch. Since you implemented __set, consider adding a @property annotation.
Loading history...
18
        $this->assertSame('e44aa283528e6fde7d542194', $nationalCriminalSearch->id);
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on Lyal\Checkr\Entities\Scr...\NationalCriminalSearch. Since you implemented __get, consider adding a @property annotation.
Loading history...
19
    }
20
21
    public function testFields()
22
    {
23
        $values = [
24
            'id' => '539fd88c101897f7cd000006',
25
            'object' => 'national_criminal_search',
26
            'uri' => '/v1/national_criminal_searches/539fd88c101897f7cd000006',
27
            'status' => 'clear',
28
            'created_at' => '2014-01-18T12:34:00Z',
29
            'completed_at' => '2014-01-18T12:35:30Z',
30
            'turnaround_time' => 90,
31
            'records' => [
32
                ['case_number' => '24323-DA',
33
                    'file_date' => NULL,
34
                    'arresting_agency' => NULL,
35
                    'court_jurisdiction' => NULL,
36
                    'court_of_record' => NULL,
37
                    'dob' => '1970-01-22',
38
                    'full_name' => 'John Alfred Smith',
39
                    'charges' => []
40
                ]
41
            ]
42
        ];
43
44
        $nationalCriminalSearch = $this->getNationalCriminalSearch($values);
45
46
        foreach ($values as $key => $value) {
47
            if (is_array($value)) {
48
                $value = collect($value);
49
            }
50
51
            $this->assertEquals($value, $nationalCriminalSearch->{$key});
52
        }
53
54
    }
55
56
    protected function getNationalCriminalSearch($values = NULL)
57
    {
58
        return new NationalCriminalSearch($values,$this->getClient());
59
    }
60
}