Passed
Push — master ( 79545d...728467 )
by Petr
02:28
created

XSubPart::is()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
namespace TraitsTests;
4
5
6
use CommonTestClass;
7
use kalanis\kw_files\Traits\TSubPart;
8
9
10
class SubPartTest extends CommonTestClass
11
{
12
    /**
13
     * @param string[] $what
14
     * @param string[] $in
15
     * @param bool $result
16
     * @dataProvider subPartProvider
17
     */
18
    public function testProcess(array $what, array $in, bool $result): void
19
    {
20
        $lib = new XSubPart();
21
        $this->assertEquals($result, $lib->is($what, $in));
22
    }
23
24
    public function subPartProvider(): array
25
    {
26
        return [
27
            [[], [], true],
28
            [['foo'], [], true],
29
            [['foo'], ['foo'], true],
30
            [['foo', 'bar'], ['foo'], true],
31
            [['foo'], ['foo', 'bar'], true],
32
            [['baz'], ['bar'], false],
33
            [['baz', 'foo'], ['bar', 'foo'], false],
34
            [['foo', 'bar'], ['foo', 'baz'], false],
35
            [['foo', 'bar', 'baz'], ['foo', 'baz'], false],
36
        ];
37
    }
38
}
39
40
41
class XSubPart
42
{
43
    use TSubPart;
44
45
    public function is(array $what, array $in): bool
46
    {
47
        return $this->isSubPart($what, $in);
48
    }
49
}
50