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.

ResponseTest::testWithPaginatorWorkProperly()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 34

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 9.376
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace EllipseSynergie\ApiResponse\Tests\Laravel;
4
5
use League\Fractal\Manager;
6
use Mockery as m;
7
8
/**
9
 * Class ResponseTest
10
 *
11
 * @package EllipseSynergie\ApiResponse\Tests\Laravel
12
 * @author Maxime Beaudoin <[email protected]>
13
 */
14
class ResponseTest extends \PHPUnit_Framework_TestCase
15
{
16
    public function testErrorWrongArgsValidator()
17
    {
18
        $messageBag = m::mock('Illuminate\Support\MessageBag');
19
        $messageBag->shouldReceive('toArray')->andReturn(['foo' => 'bar']);
20
21
        $validator = m::mock('Illuminate\Contracts\Validation\Validator');
22
        $validator->shouldReceive('getMessageBag')->once()->andReturn($messageBag);
23
        $response = new ResponseFake(new Manager());
24
25
        $response->errorWrongArgsValidator($validator);
26
    }
27
28
    public function testWithPaginatorWorkProperly()
29
    {
30
        $paginator = m::mock('Illuminate\Contracts\Pagination\LengthAwarePaginator');
31
        $paginator->shouldReceive('items')->andReturn([['foo' => 'bar']]);
32
        $paginator->shouldReceive('currentPage')->andReturn(1);
33
        $paginator->shouldReceive('lastPage')->andReturn(2);
34
        $paginator->shouldReceive('total')->andReturn(3);
35
        $paginator->shouldReceive('perPage')->andReturn(1);
36
        $paginator->shouldReceive('url')->andReturn('localhost');
37
        $paginator->shouldReceive('count')->andReturn(3);
38
        $paginator->shouldReceive('appends')->andReturn([['foo' => 'bar']]);
39
40
        $response = new ResponseFake(new Manager());
41
42
        $result = $response->withPaginator($paginator, function ($data) {
43
            return $data;
44
        }, 'data', ['foo' => 'bar']);
45
46
        $this->assertSame(['foo' => 'bar'], $result['data'][0]);
47
        $this->assertSame('bar', $result['meta']['foo']);
48
        $this->assertSame(
49
            [
50
                'total' => 3,
51
                'count' => 3,
52
                'per_page' => 1,
53
                'current_page' => 1,
54
                'total_pages' => 2,
55
                'links' => [
56
                    'next' => 'localhost'
57
                ],
58
            ],
59
            $result['meta']['pagination']
60
        );
61
    }
62
63
    public function tearDown()
64
    {
65
        m::close();
66
    }
67
}
68