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.

CollectionTest   A
last analyzed

Coupling/Cohesion

Components 1
Dependencies 5

Complexity

Total Complexity 11

Size/Duplication

Total Lines 118
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 11
c 0
b 0
f 0
lcom 1
cbo 5
dl 0
loc 118
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetData() 0 8 1
A testGetTransformer() 0 9 1
A testSetCursor() 0 6 1
A testGetCursor() 0 7 1
A testGetSetPaginator() 0 7 1
A testSetResourceKey() 0 5 1
A testGetResourceKey() 0 6 1
A tearDown() 0 4 1
A testSetData() 0 6 1
A testSetTransformer() 0 6 1
A testGetSetMeta() 0 10 1
1
<?php namespace League\Fractal\Test;
2
3
use League\Fractal\Pagination\Cursor;
4
use League\Fractal\Resource\Collection;
5
use Mockery;
6
7
class CollectionTest extends \PHPUnit_Framework_TestCase
8
{
9
    protected $simpleCollection = [
10
        ['foo' => 'bar'],
11
        ['baz' => 'ban'],
12
    ];
13
14
    public function testGetData()
15
    {
16
        $resource = new Collection($this->simpleCollection, function (array $data) {
17
            return $data;
18
        });
19
20
        $this->assertSame($resource->getData(), $this->simpleCollection);
21
    }
22
23
    /**
24
     * @covers League\Fractal\Resource\Collection::setData
25
     */
26
    public function testSetData()
27
    {
28
        $collection = Mockery::mock('League\Fractal\Resource\Collection')->makePartial();
29
        $collection->setData('foo');
30
        $this->assertSame('foo', $collection->getData());
31
    }
32
33
    public function testGetTransformer()
34
    {
35
        $resource = new Collection($this->simpleCollection, function () {
36
        });
37
        $this->assertTrue(is_callable($resource->getTransformer()));
38
39
        $resource = new Collection($this->simpleCollection, 'SomeClass');
40
        $this->assertSame($resource->getTransformer(), 'SomeClass');
41
    }
42
43
    /**
44
     * @covers League\Fractal\Resource\Collection::setTransformer
45
     */
46
    public function testSetTransformer()
47
    {
48
        $collection = Mockery::mock('League\Fractal\Resource\Collection')->makePartial();
49
        $collection->setTransformer('foo');
50
        $this->assertSame('foo', $collection->getTransformer());
51
    }
52
53
    /**
54
     * @covers League\Fractal\Resource\Collection::setCursor
55
     */
56
    public function testSetCursor()
57
    {
58
        $cursor = Mockery::mock('League\Fractal\Pagination\Cursor');
59
        $collection = Mockery::mock('League\Fractal\Resource\Collection')->makePartial();
60
        $this->assertInstanceOf('League\Fractal\Resource\Collection', $collection->setCursor($cursor));
61
    }
62
63
    /**
64
     * @covers League\Fractal\Resource\Collection::getCursor
65
     */
66
    public function testGetCursor()
67
    {
68
        $cursor = new Cursor();
69
        $collection = Mockery::mock('League\Fractal\Resource\Collection')->makePartial();
70
        $collection->setCursor($cursor);
71
        $this->assertInstanceOf('League\Fractal\Pagination\Cursor', $collection->getCursor());
72
    }
73
74
    /**
75
     * @covers League\Fractal\Resource\Collection::setPaginator
76
     * @covers League\Fractal\Resource\Collection::getPaginator
77
     */
78
    public function testGetSetPaginator()
79
    {
80
        $paginator = Mockery::mock('League\Fractal\Pagination\IlluminatePaginatorAdapter');
81
        $collection = Mockery::mock('League\Fractal\Resource\Collection')->makePartial();
82
        $this->assertInstanceOf('League\Fractal\Resource\Collection', $collection->setPaginator($paginator));
83
        $this->assertInstanceOf('League\Fractal\Pagination\PaginatorInterface', $collection->getPaginator());
84
    }
85
86
    /**
87
     * @covers League\Fractal\Resource\Collection::setMetaValue
88
     * @covers League\Fractal\Resource\Collection::getMetaValue
89
     */
90
    public function testGetSetMeta()
91
    {
92
        $collection = Mockery::mock('League\Fractal\Resource\Collection')->makePartial();
93
        $this->assertInstanceOf('League\Fractal\Resource\Collection', $collection->setMetaValue('foo', 'bar'));
94
95
        $this->assertSame(['foo' => 'bar'], $collection->getMeta());
96
        $this->assertSame('bar', $collection->getMetaValue('foo'));
97
        $collection->setMeta(['baz' => 'bat']);
98
        $this->assertSame(['baz' => 'bat'], $collection->getMeta());
99
    }
100
101
    /**
102
     * @covers League\Fractal\Resource\Collection::setResourceKey
103
     */
104
    public function testSetResourceKey()
105
    {
106
        $collection = Mockery::mock('League\Fractal\Resource\Collection')->makePartial();
107
        $this->assertInstanceOf('League\Fractal\Resource\Collection', $collection->setResourceKey('foo'));
108
    }
109
110
    /**
111
     * @covers League\Fractal\Resource\Collection::getResourceKey
112
     */
113
    public function testGetResourceKey()
114
    {
115
        $collection = Mockery::mock('League\Fractal\Resource\Collection')->makePartial();
116
        $collection->setResourceKey('foo');
117
        $this->assertSame('foo', $collection->getResourceKey());
118
    }
119
120
    public function tearDown()
121
    {
122
        Mockery::close();
123
    }
124
}
125