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 ( dd680f...a61514 )
by Christian
01:32
created

UserServiceTest::testGetAttends()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 44

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 44
rs 9.216
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\SetlistFm\Tests\Service;
11
12
use Core23\SetlistFm\Connection\ConnectionInterface;
13
use Core23\SetlistFm\Service\UserService;
14
use PHPUnit\Framework\TestCase;
15
16
class UserServiceTest 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 UserService($this->connection->reveal());
28
29
        $this->assertNotNull($service);
30
    }
31
32
    public function testGetUser(): void
33
    {
34
        $rawResponse = <<<'EOD'
35
                        {
36
                          "userId": "Metal-42",
37
                          "fullname": "Max",
38
                          "about": "Some dummy text",
39
                          "website": "http://example.com",
40
                          "url": "https://www.setlist.fm/user/Metal-42"
41
                        }
42
EOD;
43
44
        $this->connection->call('user/42')
45
            ->willReturn(json_decode($rawResponse, true))
46
        ;
47
48
        $service = new UserService($this->connection->reveal());
49
        $result  = $service->getUser('42');
50
51
        $this->assertNotNull($result);
52
    }
53
54
    public function testGetEdits(): void
55
    {
56
        $rawResponse = <<<'EOD'
57
                        {
58
                          "setlist" : [ {
59
                            "artist" : {
60
                              "mbid" : "b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d",
61
                              "tmid" : 735610,
62
                              "name" : "The Beatles",
63
                              "sortName" : "Beatles, The",
64
                              "disambiguation" : "John, Paul, George and Ringo",
65
                              "url" : "https://www.setlist.fm/setlists/the-beatles-23d6a88b.html"
66
                            },
67
                            "venue" : {
68
                              "city" : { },
69
                              "url" : "https://www.setlist.fm/venue/compaq-center-san-jose-ca-usa-6bd6ca6e.html",
70
                              "id" : "6bd6ca6e",
71
                              "name" : "Compaq Center"
72
                            },
73
                            "tour" : {
74
                              "name" : "North American Tour 1964"
75
                            },
76
                            "info" : "Recorded and published as 'The Beatles at the Hollywood Bowl'",
77
                            "url" : "https://www.setlist.fm/setlist/the-beatles/1964/hollywood-bowl-hollywood-ca-63de4613.html",
78
                            "id" : "63de4613",
79
                            "versionId" : "7be1aaa0",
80
                            "eventDate" : "23-08-1964",
81
                            "lastUpdated" : "2013-10-20T05:18:08.000+0000"
82
                          } ],
83
                          "total" : 1,
84
                          "page" : 1,
85
                          "itemsPerPage" : 20
86
                        }
87
EOD;
88
89
        $this->connection->call('user/42/edited', ['p' => 1])
90
            ->willReturn(json_decode($rawResponse, true))
91
        ;
92
93
        $service = new UserService($this->connection->reveal());
94
        $result  = $service->getEdits('42');
95
96
        $this->assertNotNull($result);
97
    }
98
99
    public function testGetAttends(): void
100
    {
101
        $rawResponse = <<<'EOD'
102
                        {
103
                          "setlist" : [ {
104
                            "artist" : {
105
                              "mbid" : "b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d",
106
                              "tmid" : 735610,
107
                              "name" : "The Beatles",
108
                              "sortName" : "Beatles, The",
109
                              "disambiguation" : "John, Paul, George and Ringo",
110
                              "url" : "https://www.setlist.fm/setlists/the-beatles-23d6a88b.html"
111
                            },
112
                            "venue" : {
113
                              "city" : { },
114
                              "url" : "https://www.setlist.fm/venue/compaq-center-san-jose-ca-usa-6bd6ca6e.html",
115
                              "id" : "6bd6ca6e",
116
                              "name" : "Compaq Center"
117
                            },
118
                            "tour" : {
119
                              "name" : "North American Tour 1964"
120
                            },
121
                            "info" : "Recorded and published as 'The Beatles at the Hollywood Bowl'",
122
                            "url" : "https://www.setlist.fm/setlist/the-beatles/1964/hollywood-bowl-hollywood-ca-63de4613.html",
123
                            "id" : "63de4613",
124
                            "versionId" : "7be1aaa0",
125
                            "eventDate" : "23-08-1964",
126
                            "lastUpdated" : "2013-10-20T05:18:08.000+0000"
127
                          }],
128
                          "total" : 1,
129
                          "page" : 1,
130
                          "itemsPerPage" : 20
131
                        }
132
EOD;
133
134
        $this->connection->call('user/42/attended', ['p' => 1])
135
            ->willReturn(json_decode($rawResponse, true))
136
        ;
137
138
        $service = new UserService($this->connection->reveal());
139
        $result  = $service->getAttends('42');
140
141
        $this->assertNotNull($result);
142
    }
143
}
144