Completed
Push — master ( bc4c4e...140af9 )
by Gabriel
02:13
created

StrTest::dataInitials()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Nip\Utility\Tests;
4
5
use Nip\Utility\Str;
6
7
/**
8
 * Class StrTest
9
 * @package Nip\Utility\Tests
10
 */
11
class StrTest extends AbstractTest
12
{
13
    /**
14
     * @param $data
15
     * @param $start
16
     * @param $end
17
     * @param $masked
18
     * @dataProvider dataMask()
19
     */
20
    public function testMask($data, $start, $end, $masked)
21
    {
22
        self::assertSame($masked, Str::mask($data, $start, $end));
23
    }
24
25
    /**
26
     * @return array
27
     */
28
    public function dataMask()
29
    {
30
        return [
31
            ['test', 0, null, '****'],
32
            ['test', 1, null, 't***'],
33
            ['foe', 2, 1, '***'],
34
            ['lorem', 5, false, '*****'],
35
        ];
36
    }
37
38
    /**
39
     * @param $name
40
     * @param $initials
41
     * @dataProvider dataInitials()
42
     */
43
    public function testInitials($name, $initials)
44
    {
45
        self::assertSame($initials, Str::initials($name));
46
    }
47
48
    /**
49
     * @return array
50
     */
51
    public function dataInitials()
52
    {
53
        return [
54
            ['test', 'T.'],
55
            ['test test', 'T.T.'],
56
            ['test-test', 'T.T.'],
57
        ];
58
    }
59
}
60