Failed Conditions
Push — master ( 01c22b...e42c1f )
by Marco
79:13 queued 10s
created

GetVariableTypeTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testFormatVariable() 0 3 1
A provideDataForFormatVariable() 0 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\DBAL\Exception;
6
7
use Doctrine\DBAL\Exception\GetVariableType;
8
use PHPUnit\Framework\TestCase;
9
use stdClass;
10
use function tmpfile;
11
12
class GetVariableTypeTest extends TestCase
13
{
14
    /**
15
     * @param mixed $value
16
     *
17
     * @dataProvider provideDataForFormatVariable
18
     */
19
    public function testFormatVariable(string $expected, $value) : void
20
    {
21
        self::assertSame($expected, (new GetVariableType())->__invoke($value));
22
    }
23
24
    /**
25
     * @return array<int, array<int, mixed>>
26
     */
27
    public function provideDataForFormatVariable() : array
28
    {
29
        return [
30
            ['string', ''],
31
            ['string', 'test'],
32
            ['double', 1.0],
33
            ['integer', 1],
34
            ['NULL', null],
35
            ['stdClass', new stdClass()],
36
            ['stream', tmpfile()],
37
            ['true', true],
38
            ['false', false],
39
            ['array', [true, 1, 2, 3, 'test']],
40
        ];
41
    }
42
}
43