Passed
Pull Request — master (#12)
by romain
09:45
created

CallTrackingSpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 29
loc 29
rs 10
c 0
b 0
f 0

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
3
namespace spec\Yproximite\Api\Model\CallTracking;
4
5
use PhpSpec\ObjectBehavior;
6
7
use Yproximite\Api\Model\CallTracking\CallTracking;
8
9
class CallTrackingSpec extends ObjectBehavior
10
{
11
    function it_is_initializable()
12
    {
13
        $this->shouldHaveType(CallTracking::class);
14
    }
15
16
    function let()
17
    {
18
        $data = [
19
            'id'               => '11',
20
            'name'             => 'Simple call',
21
            'phoneDid'         => '+1 343 553 22 33',
22
            'phoneDestination' => '+1 233 211 21 77',
23
            'callerId'         => 1,
24
        ];
25
26
        $this->beConstructedWith($data);
27
    }
28
29
    function it_should_be_hydrated()
30
    {
31
        $this->getId()->shouldReturn(11);
32
        $this->getName()->shouldReturn('Simple call');
33
        $this->getPhoneDid()->shouldReturn('+1 343 553 22 33');
34
        $this->getPhoneDestination()->shouldReturn('+1 233 211 21 77');
35
        $this->hasCallerId()->shouldReturn(true);
36
    }
37
}
38