Completed
Push — master ( 91b50a...6fa888 )
by Patrick
02:06
created

DiagnosticTypeFieldTest::testWithValidType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Artack\Dsn\Field;
6
7
use PHPUnit\Framework\TestCase;
8
9
class DiagnosticTypeFieldTest extends TestCase
10
{
11
    public function testType(): void
12
    {
13
        $type = 'smtp';
14
15
        $diagnosticTypeField = new DiagnosticTypeField('name', 'value', $type, null);
16
17
        $this->assertSame($type, $diagnosticTypeField->getType());
18
    }
19
20
    /**
21
     * @dataProvider validTypeProvider
22
     */
23
    public function testWithValidType(string $type): void
24
    {
25
        $diagnosticTypeField = new DiagnosticTypeField('name', 'value', $type, null);
26
27
        $this->assertSame($type, $diagnosticTypeField->getType());
28
    }
29
30
    /**
31
     * @dataProvider invalidTypeProvider
32
     */
33
    public function testInvalidType(string $type): void
34
    {
35
        $this->expectException(\InvalidArgumentException::class);
36
37
        new DiagnosticTypeField('name', 'value', $type, null);
38
    }
39
40
    public function validTypeProvider(): array
41
    {
42
        return [
43
            ['smtp'],
44
        ];
45
    }
46
47
    public function invalidTypeProvider(): array
48
    {
49
        return [
50
            ['something'],
51
            ['else'],
52
        ];
53
    }
54
}
55