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

GeoTest::testFields()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 11

Duplication

Lines 16
Ratio 100 %

Importance

Changes 0
Metric Value
dl 16
loc 16
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 11
nc 2
nop 0
1
<?php
2
namespace Tests\Unit;
3
4
5
use Lyal\Checkr\Entities\Resources\Geo;
6
use Tests\UnitTestCase;
7
8 View Code Duplication
class GeoTest 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...
9
{
10
    public function testInstantiation()
11
    {
12
        $this->assertInstanceOf('Lyal\Checkr\Entities\Resources\Geo', $this->getGeo());
13
    }
14
15
    public function testSetId()
16
    {
17
        $geo = $this->getGeo();
18
        $geo->id = 'e44aa283528e6fde7d542194';
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on Lyal\Checkr\Entities\Resources\Geo. Since you implemented __set, consider adding a @property annotation.
Loading history...
19
        $this->assertSame('e44aa283528e6fde7d542194', $geo->id);
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on Lyal\Checkr\Entities\Resources\Geo. Since you implemented __get, consider adding a @property annotation.
Loading history...
20
    }
21
22
    public function testFields()
23
    {
24
        $values = [
25
            'id' => 'e44aa283528e6fde7d542194',
26
            'object' => 'geo',
27
            'uri' => '/v1/geos/e44aa283528e6fde7d542194',
28
            'created_at' => '2015-01-18T12:34:00Z',
29
            'name' => 'San Francisco',
30
            'state' => 'CA',
31
            'deleted_at' => NULL,
32
        ];
33
34
        $geo = $this->getGeo($values);
35
36
        foreach ($values as $key => $value) {
37
            $this->assertEquals($value, $geo->{$key});
38
        }
39
40
    }
41
42
    protected function getGeo($values = NULL)
43
    {
44
        return new Geo($values,$this->getClient());
45
    }
46
}