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() |
|
|
|
|
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() |
|
|
|
|
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
|
|
|
|
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.