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.

AccessorTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A testReadValueReturnsFalseIfWrongProp() 0 7 1
A testReadValueReturnsCorrectValue() 0 9 1
A testWriteValueWritesIfSetterExists() 0 7 1
A testWriteValueDoesNotWriteIfSetterNotExists() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Tests\Lib\Access;
6
7
use Lib\Access\Accessor;
8
use Lib\Routing\RouteDefinition;
9
use PHPUnit\Framework\TestCase;
10
11
class AccessorTest extends TestCase
12
{
13
    private $accessor;
14
15
    public function setUp()
16
    {
17
        $this->accessor = new Accessor();
18
    }
19
20
    public function testReadValueReturnsCorrectValue()
21
    {
22
        $route = new RouteDefinition('home', '/');
23
24
        $valueGet = $this->accessor->readValue($route, 'name');
25
        $valueIs = $this->accessor->readValue($route, 'auth');
26
27
        $this->assertEquals('home', $valueGet);
28
        $this->assertEquals('', $valueIs);
29
    }
30
31
    public function testReadValueReturnsFalseIfWrongProp()
32
    {
33
        $route = new RouteDefinition('home', '/');
34
35
        $value = $this->accessor->readValue($route, 'blob');
36
37
        $this->assertFalse($value);
38
    }
39
40
    public function testWriteValueWritesIfSetterExists()
41
    {
42
        $route = new RouteDefinition('home', '/');
43
44
        $this->accessor->writeValue($route, 'defaults', ['foo' => 'bar']);
45
46
        $this->assertEquals(['foo' => 'bar'], $route->getDefaults());
47
    }
48
49
    public function testWriteValueDoesNotWriteIfSetterNotExists()
50
    {
51
        $route = new RouteDefinition('home', '/');
52
53
        $this->accessor->writeValue($route, 'name', 'foo');
54
55
        $this->assertEquals('home', $route->getName());
56
    }
57
}
58