Passed
Push — master ( d76f9c...e93f22 )
by Adrien
02:31
created

DebugTest::providerExport()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 11
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 28
rs 9.9
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EcodevTests\Felix;
6
7
use Ecodev\Felix\Debug;
8
use PHPUnit\Framework\TestCase;
9
10
class DebugTest extends TestCase
11
{
12
    /**
13
     * @dataProvider providerExport
14
     *
15
     * @param mixed $data
16
     */
17
    public function testExport($data, string $expected): void
18
    {
19
        $actual = Debug::export($data, true);
20
        self::assertEquals($expected, $actual);
21
    }
22
23
    public function providerExport(): array
24
    {
25
        return [
26
            [123, '123'],
27
            ['123', "'123'"],
28
            [[1, 2, 3], '[
29
    1,
30
    2,
31
    3,
32
]'],
33
            [[1, 2, ['key1' => 'value', 'key2' => ['a', 'b']], 4], "[
34
    1,
35
    2,
36
    [
37
        'key1' => 'value',
38
        'key2' => [
39
            'a',
40
            'b',
41
        ],
42
    ],
43
    4,
44
]"],
45
            [[1 => 1, 2 => 2, 3 => 3], '[
46
    1 => 1,
47
    2 => 2,
48
    3 => 3,
49
]'],
50
            [[0 => 1, 3 => 2, 2 => 3], '[
51
    0 => 1,
52
    3 => 2,
53
    2 => 3,
54
]'],
55
        ];
56
    }
57
}
58