FactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 18
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testPass() 0 16 1
1
<?php
2
3
namespace LoadersTests;
4
5
6
use CommonTestClass;
7
use kalanis\kw_input\Interfaces\IEntry;
8
use kalanis\kw_input\Loaders;
9
10
11
class FactoryTest extends CommonTestClass
12
{
13
    public function testPass(): void
14
    {
15
        $factory = new Loaders\Factory();
16
        $loader1 = $factory->getLoader(IEntry::SOURCE_GET);
17
        $loader2 = $factory->getLoader(IEntry::SOURCE_GET); // intentionally same
18
        $loader3 = $factory->getLoader(IEntry::SOURCE_FILES);
19
        $loader4 = $factory->getLoader(IEntry::SOURCE_JSON);
20
        $factory->getLoader(IEntry::SOURCE_CLI);
21
22
        $this->assertInstanceOf(Loaders\Entry::class, $loader1);
23
        $this->assertInstanceOf(Loaders\Entry::class, $loader2);
24
        $this->assertInstanceOf(Loaders\File::class, $loader3);
25
        $this->assertInstanceOf(Loaders\Json::class, $loader4);
26
        $this->assertEquals($loader1, $loader2);
27
        $this->assertNotEquals($loader3, $loader2);
28
        $this->assertNotEquals($loader3, $loader4);
29
    }
30
}
31