Passed
Push — master ( 1a6375...8f4058 )
by Petr
08:21 queued 05:12
created

FactoryTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A fullProvider() 0 9 1
A testFull() 0 4 1
A testNoInternalLib() 0 4 1
1
<?php
2
3
namespace tests\ChecksTests;
4
5
6
use tests\CommonTestClass;
7
use kalanis\kw_files\Processing\Storage\Files\Basic;
8
use kalanis\kw_mime\Check;
9
use kalanis\kw_storage\Storage;
10
11
12
class FactoryTest extends CommonTestClass
13
{
14
    public function testNoInternalLib(): void
15
    {
16
        $lib = new XFFactory();
17
        $this->assertInstanceOf(Check\CustomList::class, $lib->getLibrary('anything'));
18
    }
19
20
    /**
21
     * @param mixed $params
22
     * @param string $class
23
     * @dataProvider fullProvider
24
     */
25
    public function testFull($params, string $class): void
26
    {
27
        $lib = new Check\Factory();
28
        $this->assertInstanceOf($class, $lib->getLibrary($params));
29
    }
30
31
    public function fullProvider(): array
32
    {
33
        return [
34
            [new Basic(new Storage\Storage(new Storage\Key\StaticPrefixKey(), new Storage\Target\Volume())), Check\DataFiles::class],
35
            [new Storage(new Storage\Factory(new Storage\Key\Factory(), new Storage\Target\Factory())), Check\DataStorage::class],
36
            ['test.pas', Check\LocalVolume1::class],
37
            [123456, Check\CustomList::class],
38
            [null, Check\CustomList::class],
39
            [false, Check\CustomList::class],
40
        ];
41
    }
42
}
43