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 ( dd5413...6f2a20 )
by
unknown
24s
created

ArtistServiceTest::testGetArtist()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 9.568
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\Builder\ArtistSearchBuilder;
13
use Core23\SetlistFm\Connection\ConnectionInterface;
14
use Core23\SetlistFm\Service\ArtistService;
15
use PHPUnit\Framework\TestCase;
16
17
final class ArtistServiceTest extends TestCase
18
{
19
    private $connection;
20
21
    protected function setUp(): void
22
    {
23
        $this->connection =  $this->prophesize(ConnectionInterface::class);
24
    }
25
26
    public function testGetArtist(): void
27
    {
28
        $rawResponse = <<<'EOD'
29
                        {
30
                          "mbid" : "b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d",
31
                          "tmid" : 735610,
32
                          "name" : "The Beatles",
33
                          "sortName" : "Beatles, The",
34
                          "disambiguation" : "John, Paul, George and Ringo",
35
                          "url" : "https://www.setlist.fm/setlists/the-beatles-23d6a88b.html"
36
                        }
37
EOD;
38
39
        $this->connection->call('artist/b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d')
40
            ->willReturn(json_decode($rawResponse, true))
41
        ;
42
43
        $service = new ArtistService($this->connection->reveal());
44
        $result  = $service->getArtist('b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d');
45
46
        static::assertSame('b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d', $result->getMbid());
47
    }
48
49
    public function testSearch(): void
50
    {
51
        $rawResponse = <<<'EOD'
52
                    {
53
                      "artist" : [ {
54
                        "mbid" : "b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d",
55
                        "tmid" : 735610,
56
                        "name" : "The Beatles",
57
                        "sortName" : "Beatles, The",
58
                        "disambiguation" : "John, Paul, George and Ringo",
59
                        "url" : "https://www.setlist.fm/setlists/the-beatles-23d6a88b.html"
60
                      }],
61
                      "total" : 1,
62
                      "page" : 1,
63
                      "itemsPerPage" : 20
64
                    }
65
EOD;
66
67
        $this->connection->call('search/artists', ['p' => 1, 'artistName' => 'The Beatles'])
68
            ->willReturn(json_decode($rawResponse, true))
69
        ;
70
71
        $service = new ArtistService($this->connection->reveal());
72
        $result  = $service->search(ArtistSearchBuilder::create()
73
            ->withName('The Beatles'));
74
75
        static::assertCount(1, $result->getResult());
76
    }
77
}
78