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

SeparatorsTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 39
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A startProvider() 0 6 1
A testEndRemoval() 0 3 1
A endProvider() 0 6 1
A testStartRemoval() 0 3 1
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