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.
Completed
Push — master ( 3b6389...625674 )
by Christian
01:43
created

AuthServiceTest::testCreateSession()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 9.552
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * (c) Christian Gripp <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Core23\LastFm\Tests\Service;
11
12
use Core23\LastFm\Connection\ConnectionInterface;
13
use Core23\LastFm\Service\AuthService;
14
use PHPUnit\Framework\TestCase;
15
16
class AuthServiceTest extends TestCase
17
{
18
    private $connection;
19
20
    protected function setUp()
21
    {
22
        $this->connection =  $this->prophesize(ConnectionInterface::class);
23
    }
24
25
    public function testItIsInstantiable(): void
26
    {
27
        $service = new AuthService($this->connection->reveal());
28
29
        $this->assertNotNull($service);
30
    }
31
32
    public function testCreateSession(): void
33
    {
34
        $this->connection->signedCall('auth.getSession', [
35
            'token' => 'user-token',
36
        ], null, 'GET')
37
            ->willReturn([
38
                'session' => [
39
                    'name'       => 'FooBar',
40
                    'key'        => 'the-key',
41
                    'subscriber' => 15,
42
                ],
43
            ])
44
        ;
45
46
        $service = new AuthService($this->connection->reveal());
47
48
        $result = $service->createSession('user-token');
49
50
        $this->assertNotNull($result);
51
        $this->assertSame('FooBar', $result->getName());
52
        $this->assertSame('the-key', $result->getKey());
53
        $this->assertSame(15, $result->getSubscriber());
54
    }
55
56
    public function testCreateToken(): void
57
    {
58
        $this->connection->signedCall('auth.getToken', [], null, 'GET')
59
            ->willReturn([
60
                'token' => 'The Token',
61
            ])
62
        ;
63
64
        $service = new AuthService($this->connection->reveal());
65
        $this->assertSame('The Token', $service->createToken());
66
    }
67
68
    public function testGetAuthUrl(): void
69
    {
70
        $this->connection->getApiKey()
71
            ->willReturn('api-key')
72
        ;
73
74
        $service = new AuthService($this->connection->reveal());
75
76
        $this->assertSame('http://www.last.fm/api/auth/?api_key=api-key&cb=https://example.org', $service->getAuthUrl('https://example.org'));
77
    }
78
}
79