DebugTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testExport() 0 4 1
A providerExport() 0 28 1
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