Test Failed
Push — master ( 6bff04...e0da10 )
by Lyal
02:14
created

InvitationTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
wmc 5
dl 41
loc 41
c 0
b 0
f 0
rs 10

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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
class InvitationTest extends UnitTestCase
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';
24
        $this->assertSame('e44aa283528e6fde7d542194',$invitation->id);
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
}