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

InvitationTest::testFields()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 20
Code Lines 15

Duplication

Lines 20
Ratio 100 %

Importance

Changes 0
Metric Value
dl 20
loc 20
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 15
nc 2
nop 0
1
<?php
2
namespace Tests\Unit;
3
4
use Lyal\Checkr\Entities\Resources\Invitation;
5
use Tests\UnitTestCase;
6
7
/**
8
 * Created by PhpStorm.
9
 * User: lyal
10
 * Date: 10/23/17
11
 * Time: 4:58 PM
12
 */
13 View Code Duplication
class InvitationTest 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...
14
{
15
    public function testInstantiation()
16
    {
17
        $this->assertInstanceOf('Lyal\Checkr\Entities\Resources\Invitation', $this->getInvitation());
18
    }
19
20
    public function testSetId()
21
    {
22
        $invitation = $this->getInvitation();
23
        $invitation->id = 'e44aa283528e6fde7d542194';
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on Lyal\Checkr\Entities\Resources\Invitation. Since you implemented __set, consider adding a @property annotation.
Loading history...
24
        $this->assertSame('e44aa283528e6fde7d542194',$invitation->id);
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on Lyal\Checkr\Entities\Resources\Invitation. Since you implemented __get, consider adding a @property annotation.
Loading history...
25
    }
26
27
    public function testFields()
28
    {
29
        $values = [
30
            'id' => 'e44aa283528e6fde7d542194',
31
            'status' => 'pending',
32
            'uri' => '/v1/invitations/e44aa283528e6fde7d542194',
33
            'invitation_url' => 'https://www.checkr.com/invitation',
34
            'completed_at' => NULL,
35
            'deleted_at' => NULL,
36
            'expires_at' => '2015-05-21T17:45:34Z',
37
            'package' => 'package',
38
            'object' => 'invitation',
39
            'created_at' => '2015-05-14T17:45:34Z',
40
            'candidate_id' => 'e44aa283528e6fde7d542194',
41
        ];
42
43
        $invitation = $this->getInvitation($values);
44
45
        foreach ($values as $key => $value) {
46
            $this->assertEquals($value, $invitation->{$key});
47
        }
48
49
    }
50
51
    protected function getInvitation($values = NULL)
52
    {
53
        return new Invitation($values,$this->getClient());
54
    }
55
}