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

DiagnosticTypeFieldTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 13
dl 0
loc 43
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testType() 0 7 1
A testWithValidType() 0 5 1
A validTypeProvider() 0 4 1
A invalidTypeProvider() 0 5 1
A testInvalidType() 0 5 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