GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 53bcfa...6873de )
by SignpostMarv
03:59
created

UndefinedPropertyExceptionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 60
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testUndefinedPropertyException() 0 22 2
B dataProviderUndefinedPropertyException() 0 29 1
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject\Tests;
8
9
use SignpostMarv\DaftObject\NudgesIncorrectly;
10
use SignpostMarv\DaftObject\ReadOnly;
11
use SignpostMarv\DaftObject\UndefinedPropertyException;
12
use SignpostMarv\DaftObject\WriteOnly;
13
14
class UndefinedPropertyExceptionTest extends TestCase
15
{
16
    public function dataProviderUndefinedPropertyException() : array
17
    {
18
        return [
19
            [
20
                ReadOnly::class,
21
                [
22
                    'nope' => 'foo',
23
                ],
24
                true,
25
                false,
26
                'nope',
27
            ],
28
            [
29
                WriteOnly::class,
30
                [
31
                    'nope' => 'foo',
32
                ],
33
                false,
34
                false,
35
                'nope',
36
            ],
37
            [
38
                NudgesIncorrectly::class,
39
                [
40
                    'Foo' => 'bar',
41
                ],
42
                true,
43
                true,
44
                'nope',
45
            ],
46
        ];
47
    }
48
49
    /**
50
    * @dataProvider dataProviderUndefinedPropertyException
51
    */
52
    public function testUndefinedPropertyException(
53
        string $implementation,
54
        array $args,
55
        bool $getNotSet,
56
        bool $writeAll,
57
        string $property
58
    ) : void {
59
        $this->expectException(UndefinedPropertyException::class);
60
        $this->expectExceptionMessage(
61
            sprintf(
62
                'Property not defined: %s::$%s',
63
                $implementation,
64
                $property
65
            )
66
        );
67
68
        $obj = new $implementation($args, $writeAll);
69
70
        if ($getNotSet) {
71
            $foo = $obj->$property;
0 ignored issues
show
Unused Code introduced by
The assignment to $foo is dead and can be removed.
Loading history...
72
        } else {
73
            $obj->$property = 1;
74
        }
75
    }
76
}
77