Completed
Push — develop ( 5ee944...c7cb25 )
by Sergei
22s queued 13s
created

GetVariableTypeTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 12
dl 0
loc 26
rs 10
c 0
b 0
f 0

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
     * @dataProvider provideDataForFormatVariable
16
     */
17
    public function testFormatVariable($expected, $value) : void
18
    {
19
        self::assertSame($expected, (new GetVariableType())->__invoke($value));
20
    }
21
22
    /**
23
     * @return array<int, array<int, mixed>>
24
     */
25
    public function provideDataForFormatVariable() : array
26
    {
27
        return [
28
            ['string', ''],
29
            ['string', 'test'],
30
            ['double', 1.0],
31
            ['integer', 1],
32
            ['NULL', null],
33
            ['stdClass', new stdClass()],
34
            ['stream', tmpfile()],
35
            ['true', true],
36
            ['false', false],
37
            ['array', [true, 1, 2, 3, 'test']],
38
        ];
39
    }
40
}
41