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.
Failed Conditions
Branch master (37a03c)
by Casper
02:30
created

TestCase::getClientWithMockedGet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 9
rs 10
1
<?php
2
3
namespace NStack\Tests;
4
5
use GuzzleHttp\Client;
6
use GuzzleHttp\Psr7\Response;
7
use NStack\Config;
8
9
class TestCase extends \PHPUnit\Framework\TestCase
10
{
11
    /**
12
     * getMockAsArray
13
     *
14
     * @param string $fileName
15
     * @return array
16
     * @author Casper Rasmussen <[email protected]>
17
     */
18
    protected function getMockAsArray(string $fileName): array
19
    {
20
        $content = file_get_contents(getcwd() . '/tests/mocks/' . $fileName);
21
22
        return json_decode($content, true);
23
    }
24
25
    /**
26
     * getClientWithMockedGet
27
     *
28
     * @param string $filename
29
     * @return \GuzzleHttp\Client
30
     * @author Casper Rasmussen <[email protected]>
31
     */
32
    protected function getClientWithMockedGet(string $filename): Client
33
    {
34
        $response = new Response(200, ['Content-Type' => 'application/json'],
35
            $this->getMockAsString($filename));
36
37
        $guzzle = \Mockery::mock(\GuzzleHttp\Client::class);
38
        $guzzle->shouldReceive('get')->once()->andReturn($response);
39
40
        return $guzzle;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $guzzle returns the type Mockery\LegacyMockInterface|Mockery\MockInterface which is incompatible with the type-hinted return GuzzleHttp\Client.
Loading history...
41
    }
42
43
    /**
44
     * getMockAsString
45
     *
46
     * @param string $fileName
47
     * @return string
48
     * @author Casper Rasmussen <[email protected]>
49
     */
50
    protected function getMockAsString(string $fileName): string
51
    {
52
        return file_get_contents(getcwd() . '/tests/mocks/' . $fileName);
53
    }
54
55
    /**
56
     * getConfig
57
     *
58
     * @return \NStack\Config
59
     * @author Casper Rasmussen <[email protected]>
60
     */
61
    public function getConfig(): Config
62
    {
63
        return new Config('', '');
64
    }
65
}
66