BaseTestCase   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A tearDown() 0 4 1
A mockApp() 0 4 1
1
<?php
2
/**
3
 * @link https://github.com/vuongxuongminh/migrate-phone-number
4
 * @copyright Copyright (c) 2018 Vuong Xuong Minh
5
 * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
6
 */
7
8
namespace VXM\MPN\Tester;
9
10
use PHPUnit\Framework\TestCase;
11
12
use Symfony\Component\Console\Application;
13
14
use VXM\MPN\DatabaseCommand;
15
use VXM\MPN\SpreadsheetCommand;
16
17
/**
18
 * Lớp trừu tượng BaseTestCase hổ trợ việc cấu hình cơ bản cho các lớp test case.
19
 *
20
 * @author Vuong Minh <[email protected]>
21
 * @since 1.0
22
 */
23
abstract class BaseTestCase extends TestCase
24
{
25
26
    /**
27
     * @var null|Application
28
     */
29
    protected $app;
30
31
    /**
32
     * @inheritdoc
33
     */
34
    protected function setUp()
35
    {
36
        $app = $this->mockApp();
37
38
        $app->add(new DatabaseCommand);
39
        $app->add(new SpreadsheetCommand);
40
    }
41
42
    /**
43
     * @inheritdoc
44
     */
45
    protected function tearDown()
46
    {
47
        $this->app = null;
48
    }
49
50
    /**
51
     * Khởi tạo application phục vụ cho việc gắn command test.
52
     *
53
     * @return Application Đối tượng app phục vụ cho việc test.
54
     */
55
    protected function mockApp()
56
    {
57
        return $this->app = new Application('Migrate Phone Number Test', '1.0.0');
58
    }
59
60
}
61