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

StateCriminalSearchTest::testFields()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 52
Code Lines 39

Duplication

Lines 52
Ratio 100 %

Importance

Changes 0
Metric Value
dl 52
loc 52
c 0
b 0
f 0
rs 9.4929
cc 3
eloc 39
nc 3
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
namespace Tests\Unit;
3
4
use Lyal\Checkr\Entities\Screenings\StateCriminalSearch;
5
use Tests\UnitTestCase;
6
7 View Code Duplication
class StateCriminalSearchTest extends UnitTestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    public function testInstantiation()
10
    {
11
        $this->assertInstanceOf('Lyal\Checkr\Entities\Screenings\StateCriminalSearch', $this->getStateCriminalSearch());
12
    }
13
14
    public function testSetId()
15
    {
16
        $stateCriminalSearch = $this->getStateCriminalSearch();
17
        $stateCriminalSearch->id = 'e44aa283528e6fde7d542194';
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on Lyal\Checkr\Entities\Scr...ngs\StateCriminalSearch. Since you implemented __set, consider adding a @property annotation.
Loading history...
18
        $this->assertSame('e44aa283528e6fde7d542194', $stateCriminalSearch->id);
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on Lyal\Checkr\Entities\Scr...ngs\StateCriminalSearch. Since you implemented __get, consider adding a @property annotation.
Loading history...
19
    }
20
21
    public function testFields()
22
    {
23
        $values = [
24
            'id' => '539fdcf335644a0ef4000001',
25
            'object' => 'state_criminal_search',
26
            'uri' => '/v1/state_criminal_searches/539fdcf335644a0ef4000001',
27
            'status' => 'consider',
28
            'created_at' => '2014-01-18T12:34:00Z',
29
            'completed_at' => '2014-01-18T12:35:30Z',
30
            'turnaround_time' => 100800,
31
            'state' => 'CA',
32
            'records' => [
33
                [
34
                    'case_number' => '24323-DA',
35
                    'file_date' => '2010-02-18',
36
                    'arresting_agency' => 'San Francisco Police Department',
37
                    'court_jurisdiction' => 'San Francisco',
38
                    'court_of_record' => NULL,
39
                    'dob' => '1970-01-22',
40
                    'full_name' => 'John Alfred Smith',
41
                    'charges' => [
42
                        ['charge' => 'Sell Cocaine',
43
                            'charge_type' => NULL,
44
                            'charge_id' => NULL,
45
                            'classification' => 'Felony',
46
                            'deposition' => NULL,
47
                            'defendant' => 'John Alfred Smith',
48
                            'plaintiff' => NULL,
49
                            'sentence' => 'Active Punishment Minimum: 10M',
50
                            'disposition' => 'Guilty',
51
                            'probation_status' => NULL,
52
                            'offense_date' => '2011-04-22',
53
                            'deposition_date' => '2014-05-27',
54
                            'arrest_date' => '2011-04-22',
55
                            'charge_date' => NULL,
56
                            'sentence_date' => '2011-06-02',
57
                            'disposition_date' => '2011-06-02',
58
                        ]
59
60
                    ]
61
                ]
62
            ]
63
        ];
64
65
        $stateCriminalSearch = $this->getStateCriminalSearch($values);
66
67
        foreach ($values as $key => $value) {
68
            if (is_array($value)) {
69
                $value = collect($value);
70
            }
71
72
            $this->assertEquals($value, $stateCriminalSearch->{$key});
73
        }
74
75
    }
76
77
    protected function getStateCriminalSearch($values = NULL)
78
    {
79
        return new StateCriminalSearch($values,$this->getClient());
80
    }
81
}