Test Failed
Branch main (1f2fe7)
by Stefan
01:54
created

XMLConfigTest::test_constructInvalid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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