Passed
Push — master ( cd504b...48cb3c )
by Petr
07:41
created

SeparatorsTest::startProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
namespace BasicTests;
4
5
6
use CommonTestClass;
7
use kalanis\kw_storage\Extras\SeparatorSigns;
8
9
10
class SeparatorsTest extends CommonTestClass
11
{
12
    /**
13
     * @param string $what
14
     * @param string $expected
15
     * @param string $separator
16
     * @dataProvider startProvider
17
     */
18
    public function testStartRemoval(string $what, string $expected, string $separator): void
19
    {
20
        $this->assertEquals($expected, SeparatorSigns::removeFromStart($what, $separator));
21
    }
22
23
    public function startProvider(): array
24
    {
25
        return [
26
            ['/foo/', 'foo/', '/'],
27
            ['--bar--baz--', 'bar--baz--', '--'],
28
            ['tgb', 'tgb', ''],
29
        ];
30
    }
31
32
    /**
33
     * @param string $what
34
     * @param string $expected
35
     * @param string $separator
36
     * @dataProvider endProvider
37
     */
38
    public function testEndRemoval(string $what, string $expected, string $separator): void
39
    {
40
        $this->assertEquals($expected, SeparatorSigns::removeFromEnd($what, $separator));
41
    }
42
43
    public function endProvider(): array
44
    {
45
        return [
46
            ['/foo/', '/foo', '/'],
47
            ['--bar--baz--', '--bar--baz', '--'],
48
            ['tgb', 'tgb', ''],
49
        ];
50
    }
51
}
52