Passed
Push — master ( 2d5d0a...7d78c5 )
by Adrien
02:23
created

FormatTest::truncateProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EcodevTests\Felix;
6
7
use Ecodev\Felix\Format;
8
9
final class FormatTest extends \PHPUnit\Framework\TestCase
10
{
11
    public function truncateProvider(): array
12
    {
13
        return [
14
            [['abcdef', 100], 'abcdef'],
15
            [['abcdef', 6], 'abcdef'],
16
            [['abcdef', 3], 'ab…'],
17
            [['abcdef', 3, ''], 'abc'],
18
            [['abcdefghi', 5, 'foo'], 'abfoo'],
19
        ];
20
    }
21
22
    /**
23
     * @dataProvider truncateProvider
24
     *
25
     * @param string $expected
26
     */
27
    public function testTruncate(array $args, $expected): void
28
    {
29
        $actual = Format::truncate(...$args);
30
        self::assertSame($expected, $actual);
31
    }
32
}
33