DebugTest::testExport()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
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
    public function testExport(mixed $data, string $expected): void
16
    {
17
        $actual = Debug::export($data, true);
18
        self::assertEquals($expected, $actual);
19
    }
20
21
    public static function providerExport(): iterable
22
    {
23
        return [
24
            [123, '123'],
25
            ['123', "'123'"],
26
            [[1, 2, 3], '[
27
    1,
28
    2,
29
    3,
30
]'],
31
            [[1, 2, ['key1' => 'value', 'key2' => ['a', 'b']], 4], "[
32
    1,
33
    2,
34
    [
35
        'key1' => 'value',
36
        'key2' => [
37
            'a',
38
            'b',
39
        ],
40
    ],
41
    4,
42
]"],
43
            [[1 => 1, 2 => 2, 3 => 3], '[
44
    1 => 1,
45
    2 => 2,
46
    3 => 3,
47
]'],
48
            [[0 => 1, 3 => 2, 2 => 3], '[
49
    0 => 1,
50
    3 => 2,
51
    2 => 3,
52
]'],
53
        ];
54
    }
55
}
56