FactoryTest::testPass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 13
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 16
rs 9.8333
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