Passed
Push — master ( def1bc...a8d7c7 )
by Christian
03:34
created

DITestCase   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 47
ccs 0
cts 14
cp 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createDI() 0 8 1
A setUp() 0 6 1
A tearDown() 0 6 1
1
<?php
2
3
namespace Faxity\Test;
4
5
use Anax\DI\DIMagic;
6
use Anax\DI\DI;
7
8
/**
9
 * Just a wrapper so we dont need to add same code in all
10
 * of the DI tests
11
 */
12
class DITestCase extends \PHPUnit\Framework\TestCase
13
{
14
    /** @var DI $di Dependency injector */
15
    protected $di;
16
17
18
    /**
19
     * Creates a DI handler for this test case, by default uses DIMagic.
20
     *
21
     * @return DI
22
     */
23
    protected function createDI(): DI
24
    {
25
        // Create dependency injector with the service
26
        $di = new DIMagic();
27
        $di->loadServices(ANAX_INSTALL_PATH . "/config/di");
28
        $di->loadServices(ANAX_INSTALL_PATH . "/test/config/di");
29
30
        return $di;
31
    }
32
33
34
    /**
35
     * Setup for every test case
36
     *
37
     * @return void
38
     */
39
    public function setUp(): void
40
    {
41
        global $di;
42
43
        $di = $this->createDI();
44
        $this->di = $di;
45
    }
46
47
48
    /**
49
     * Teardown for every test case
50
     *
51
     * @return void
52
     */
53
    public function tearDown(): void
54
    {
55
        global $di;
56
57
        $di = null;
58
        $this->di = null;
59
    }
60
}
61