Test Failed
Push — main ( bc775a...919c7e )
by Stefan
07:40
created

JSONConfigTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A test_constructMissing() 0 6 1
A test_constructNull() 0 6 1
A test_constructInvalid() 0 5 1
A test_construct() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SKien\Test\Config;
5
6
use SKien\Config\AbstractConfig;
7
use SKien\Config\JSONConfig;
8
9
/**
10
 * @author Stefanius <[email protected]>
11
 * @copyright MIT License - see the LICENSE file for details
12
 */
13
class JSONConfigTest extends AbstractConfigTest
14
{
15
    public function test_constructMissing() : void
16
    {
17
        // test for not existing config file
18
        $this->expectError();
19
        $cfg = new JSONConfig('missing.json');
20
        $cfg->getString('test');
21
    }
22
    
23
    public function test_constructInvalid() : void
24
    {
25
        $this->expectError();
26
        $cfg = new JSONConfig(dirname(__FILE__) . '/testdata/InvalidConfig.json');
27
        $cfg->getString('test');
28
    }
29
    
30
    public function test_constructNull() : AbstractConfig
31
    {
32
        $cfg = new JSONConfig(dirname(__FILE__) . '/testdata/TestConfig.json');
33
        $this->assertIsObject($cfg);
34
        
35
        return $cfg;
36
    }
37
    
38
    public function test_construct() : AbstractConfig
39
    {
40
        $cfg = new JSONConfig(dirname(__FILE__) . '/testdata/TestConfig.json');
41
        $this->assertIsObject($cfg);
42
        
43
        return $cfg;
44
    }
45
}
46
47