Test Failed
Pull Request — master (#96)
by Maximilian
17:24
created

PropertyHelperTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 4
eloc 25
c 3
b 1
f 0
dl 0
loc 50
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testCheckNullValueIntSuccess() 0 11 1
A testCheckNullValueStringUnset() 0 9 1
A testCheckNullValueIntUnset() 0 9 1
A testCheckNullValueStringSuccess() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Test\Helper;
6
7
use MaxBeckers\AmazonAlexa\Helper\PropertyHelper;
8
use PHPUnit\Framework\TestCase;
9
10
class PropertyHelperTest extends TestCase
11
{
12
    public function testCheckNullValueStringSuccess(): void
13
    {
14
        $key = 'test';
15
        $value = 'me';
16
        $data = [
17
            $key => $value,
18
        ];
19
20
        $this->assertEquals(
21
            $value,
22
            PropertyHelper::checkNullValueString($data, $key)
23
        );
24
    }
25
26
    public function testCheckNullValueStringUnset(): void
27
    {
28
        $key = 'test';
29
        $value = 'me';
30
        $data = [
31
            $key => $value,
32
        ];
33
34
        $this->assertNull(PropertyHelper::checkNullValueString($data, 'unset'));
35
    }
36
37
    public function testCheckNullValueIntSuccess(): void
38
    {
39
        $key = 'test';
40
        $value = 132;
41
        $data = [
42
            $key => $value,
43
        ];
44
45
        $this->assertEquals(
46
            $value,
47
            PropertyHelper::checkNullValueInt($data, $key)
48
        );
49
    }
50
51
    public function testCheckNullValueIntUnset(): void
52
    {
53
        $key = 'test';
54
        $value = 123;
55
        $data = [
56
            $key => $value,
57
        ];
58
59
        $this->assertNull(PropertyHelper::checkNullValueInt($data, 'unset'));
60
    }
61
}
62