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.

ParamBagTest   A
last analyzed

Coupling/Cohesion

Components 1
Dependencies 2

Complexity

Total Complexity 8

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 8
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 83
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A testArrayAccessSetFails() 0 6 1
A testArrayAccessUnsetFails() 0 6 1
A testObjectAccessSetFails() 0 6 1
A testObjectAccessUnsetFails() 0 6 1
A testOldFashionedGet() 0 7 1
A testGettingValuesTheOldFashionedWayArray() 0 6 1
A testArrayAccess() 0 11 1
A testObjectAccess() 0 9 1
1
<?php namespace League\Fractal\Test;
2
3
use League\Fractal\ParamBag;
4
5
class ParamBagTest extends \PHPUnit_Framework_TestCase
6
{
7
    public function testOldFashionedGet()
8
    {
9
        $params = new ParamBag(['one' => 'potato', 'two' => 'potato2']);
10
11
        $this->assertSame('potato', $params->get('one'));
12
        $this->assertSame('potato2', $params->get('two'));
13
    }
14
15
    public function testGettingValuesTheOldFashionedWayArray()
16
    {
17
        $params = new ParamBag(['one' => ['potato', 'tomato']]);
18
19
        $this->assertSame(['potato', 'tomato'], $params->get('one'));
20
    }
21
22
    public function testArrayAccess()
23
    {
24
        $params = new ParamBag(['foo' => 'bar', 'baz' => 'ban']);
25
26
        $this->assertInstanceOf('ArrayAccess', $params);
27
        $this->assertArrayHasKey('foo', $params);
28
        $this->assertTrue(isset($params['foo']));
29
        $this->assertSame('bar', $params['foo']);
30
        $this->assertSame('ban', $params['baz']);
31
        $this->assertNull($params['totallymadeup']);
32
    }
33
34
    /**
35
     * @expectedException LogicException
36
     * @expectedExceptionMessage Modifying parameters is not permitted
37
     */
38
    public function testArrayAccessSetFails()
39
    {
40
        $params = new ParamBag(['foo' => 'bar']);
41
42
        $params['foo'] = 'someothervalue';
43
    }
44
45
    /**
46
     * @expectedException LogicException
47
     * @expectedExceptionMessage Modifying parameters is not permitted
48
     */
49
    public function testArrayAccessUnsetFails()
50
    {
51
        $params = new ParamBag(['foo' => 'bar']);
52
53
        unset($params['foo']);
54
    }
55
56
    public function testObjectAccess()
57
    {
58
        $params = new ParamBag(['foo' => 'bar', 'baz' => 'ban']);
59
60
        $this->assertSame('bar', $params->foo);
61
        $this->assertSame('ban', $params->baz);
62
        $this->assertNull($params->totallymadeup);
63
        $this->assertTrue(isset($params->foo));
64
    }
65
66
    /**
67
     * @expectedException LogicException
68
     * @expectedExceptionMessage Modifying parameters is not permitted
69
     */
70
    public function testObjectAccessSetFails()
71
    {
72
        $params = new ParamBag(['foo' => 'bar']);
73
74
        $params->foo = 'someothervalue';
75
    }
76
77
    /**
78
     * @expectedException LogicException
79
     * @expectedExceptionMessage Modifying parameters is not permitted
80
     */
81
    public function testObjectAccessUnsetFails()
82
    {
83
        $params = new ParamBag(['foo' => 'bar']);
84
85
        unset($params->foo);
86
    }
87
}
88