TestCase   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 31
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 10 3
A tearDown() 0 4 1
A isConstantsTestDefined() 0 4 2
1
<?php
2
/**
3
 * @link https://github.com/yiiviet/yii2-esms
4
 * @copyright Copyright (c) 2017 Yii Viet
5
 * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
6
 */
7
8
9
namespace yiiviet\tests\unit\esms;
10
11
use Yii;
12
13
use yiiviet\esms\Gateway;
14
15
use PHPUnit\Framework\TestCase as BaseTestCase;
16
17
class TestCase extends BaseTestCase
18
{
19
20
    /**
21
     * @var Gateway
22
     */
23
    protected $eSMS;
24
25
    public function setUp()
26
    {
27
        $this->eSMS = Yii::createObject([
28
            'class' => Gateway::class,
29
            'client' => [
30
                'apiKey' => $this->isConstantsTestDefined() ? API_KEY_TEST : 'XXXXXX',
31
                'secretKey' => $this->isConstantsTestDefined() ? SECRET_KEY_TEST : 'XXXXXX'
32
            ]
33
        ]);
34
    }
35
36
    public function tearDown()
37
    {
38
        $this->eSMS = null;
39
    }
40
41
42
    protected function isConstantsTestDefined()
43
    {
44
        return defined('API_KEY_TEST') && defined('SECRET_KEY_TEST');
45
    }
46
47
}
48