TwilioWrapperTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 28.57 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 5
Bugs 0 Features 3
Metric Value
wmc 5
c 5
b 0
f 3
lcom 1
cbo 4
dl 16
loc 56
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testTwilioWrapper() 0 6 1
A testCreateInstance() 8 8 1
A testCapabilityWrapper() 0 6 1
A testCapabilityCreateInstance() 8 8 1
A testLookupsWrapper() 0 6 1

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 Vresh\TwilioBundle\Tests\DependencyInjection;
3
4
use Vresh\TwilioBundle\Service\TwilioLookupsWrapper;
5
use Vresh\TwilioBundle\Service\TwilioWrapper,
6
    Vresh\TwilioBundle\Service\TwilioCapabilityWrapper;
7
8
/**
9
 * Test the TwilioWrapper
10
 *
11
 * @author Fridolin Koch <[email protected]>
12
 *
13
 */
14
class TwilioWrapperTest extends \PHPUnit_Framework_TestCase
15
{
16
    /**
17
     * @test
18
     */
19
    public function testTwilioWrapper()
20
    {
21
        $twilio = new TwilioWrapper('AAAA', 'XXXX');
22
        //check if instance
23
        $this->assertInstanceOf('Vresh\TwilioBundle\Service\TwilioWrapper', $twilio);
24
    }
25
26
    /**
27
     * @test
28
     */
29 View Code Duplication
    public function testCreateInstance()
0 ignored issues
show
Duplication introduced by
This method 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...
30
    {
31
        $twilio = new TwilioWrapper('AAAA', 'XXXX');
32
        //create other instance
33
        $otherInstance = $twilio->createInstance('BBBB', 'CCCCC');
34
        //check class
35
        $this->assertInstanceOf('\Services_Twilio', $otherInstance);
36
    }
37
38
    /**
39
     * @test
40
     */
41
    public function testCapabilityWrapper()
42
    {
43
        $twilio = new TwilioCapabilityWrapper('AAAA', 'XXXX');
44
        //check class
45
        $this->assertInstanceOf('\Services_Twilio_Capability', $twilio);
46
    }
47
48
    /**
49
     * @test
50
     */
51 View Code Duplication
    public function testCapabilityCreateInstance()
0 ignored issues
show
Duplication introduced by
This method 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...
52
    {
53
        $twilio = new TwilioCapabilityWrapper('AAAA', 'XXXX');
54
        //create other instance
55
        $otherInstance = $twilio->createInstance('BBBB', 'CCCCC');
56
        //check class
57
        $this->assertInstanceOf('\Services_Twilio_Capability', $otherInstance);
58
    }
59
60
    /**
61
     * @test
62
     */
63
    public function testLookupsWrapper()
64
    {
65
        $twilio = new TwilioLookupsWrapper('AAAA', 'XXXX');
66
        //check class
67
        $this->assertInstanceOf('\Lookups_Services_Twilio', $twilio);
68
    }
69
}
70