|
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 |
|
|
|
|
|
|
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'; |
|
|
|
|
|
|
18
|
|
|
$this->assertSame('e44aa283528e6fde7d542194', $stateCriminalSearch->id); |
|
|
|
|
|
|
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
|
|
|
} |
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.