Passed
Push — master ( 141183...2b56eb )
by Petr
08:03
created

XStatusTransform::from()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace BasicTests;
4
5
6
use CommonTestClass;
7
use kalanis\kw_auth\Sources\TStatusTransform;
8
use kalanis\kw_auth\Sources\TUserStatuses;
9
10
11
class StatusTest extends CommonTestClass
12
{
13
    /**
14
     * @param int|null $what
15
     * @dataProvider statusesProvider
16
     */
17
    public function testOriginal(?int $what): void
18
    {
19
        $lib = new XStatusTransform();
20
        $this->assertEquals($what, $lib->to($lib->from($what)));
21
    }
22
23
    public function statusesProvider(): array
24
    {
25
        return [
26
            [1, ],
27
            [22, ],
28
            [null, ],
29
        ];
30
    }
31
32
    public function testList(): void
33
    {
34
        $lib = new XStatusList();
35
        $this->assertNotEmpty($lib->readUserStatuses());
36
    }
37
}
38
39
40
class XStatusTransform
41
{
42
    use TStatusTransform;
43
44
    public function from(?int $value): string
45
    {
46
        return $this->transformFromIntToString($value);
47
    }
48
49
    public function to(string $value): ?int
50
    {
51
        return $this->transformFromStringToInt($value);
52
    }
53
}
54
55
56
class XStatusList
57
{
58
    use TUserStatuses;
59
}
60