Passed
Push — master ( 2b14a7...fa4f50 )
by Petr
02:38
created

ConfigTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 2
1
<?php
2
3
namespace ExtendedTests;
4
5
6
use CommonTestClass;
7
use kalanis\kw_files\Extended\Config;
8
9
10
class ConfigTest extends CommonTestClass
11
{
12
    /**
13
     * @param array<string> $params
14
     * @param string $descDir
15
     * @param string $descFile
16
     * @param string $descExt
17
     * @param string $thumbDir
18
     * @param string $thumbExt
19
     * @param string $thumbTemp
20
     * @dataProvider configProvider
21
     */
22
    public function testConfig(array $params, string $descDir, string $descFile, string $descExt, string $thumbDir, string $thumbExt, string $thumbTemp): void
23
    {
24
        $lib = new Config();
25
        $lib->setData($params);
26
        $this->assertEquals($descDir, $lib->getDescDir());
27
        $this->assertEquals($descFile, $lib->getDescFile());
28
        $this->assertEquals($descExt, $lib->getDescExt());
29
        $this->assertEquals($thumbDir, $lib->getThumbDir());
30
        $this->assertEquals($thumbExt, $lib->getThumbExt());
31
        $this->assertEquals($thumbTemp, $lib->getThumbTemp());
32
    }
33
34
    public function configProvider(): array
35
    {
36
        return [
37
            // empty settings
38
            [['desc_dir' => '', 'desc_file' => '', 'desc_ext' => '', 'thumb_dir' => '', 'tmb_ext' => '', 'tmb_temp' => '', 'outside' => '', ], '.txt', 'index', '.dsc', '.tmb', '.png', '.tmp', ],
39
            // some values
40
            [['desc_dir' => 123, 'desc_file' => 'foo', 'desc_ext' => 'bar', 'thumb_dir' => 456.789, 'tmb_ext' => 'nope', 'tmb_temp' => 'huh', ], '123', 'foo', 'bar', '456.789', 'nope', 'huh', ],
41
        ];
42
    }
43
}
44