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

SetlistTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 116
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 116
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B testFromApi() 0 113 1
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\Model;
11
12
use Core23\SetlistFm\Model\Setlist;
13
use DateTime;
14
use PHPUnit\Framework\TestCase;
15
16
class SetlistTest extends TestCase
17
{
18
    public function testFromApi(): void
19
    {
20
        $data    = <<<'EOD'
21
            {
22
               "id" : "63de4613",
23
               "versionId" : "7be1aaa0",
24
               "eventDate" : "23-08-1964",
25
               "lastUpdated" : "2013-10-20T05:18:08.000+0000",
26
               "artist" : {
27
                  "mbid" : "b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d",
28
                  "tmid" : 735610,
29
                  "name" : "The Beatles",
30
                  "sortName" : "Beatles, The",
31
                  "disambiguation" : "",
32
                  "url" : "https://www.setlist.fm/setlists/the-beatles-23d6a88b.html"
33
               },
34
               "venue" : {
35
                  "id" : "33d62cf9",
36
                  "name" : "Hollywood Bowl",
37
                  "city" : {
38
                     "id" : "5368361",
39
                     "name" : "Los Angeles",
40
                     "state" : "California",
41
                     "stateCode" : "CA",
42
                     "coords" : {
43
                        "lat" : 34.052,
44
                        "long" : -118.244
45
                     },
46
                     "country" : {
47
                        "code" : "US",
48
                        "name" : "United States"
49
                     }
50
                  },
51
                  "url" : "https://www.setlist.fm/venue/hollywood-bowl-los-angeles-ca-usa-33d62cf9.html"
52
               },
53
               "tour" : {
54
                  "name" : "North American Tour 1964"
55
               },
56
               "sets" : {
57
                  "set" : [ {
58
                     "song" : [ {
59
                        "name" : "Twist and Shout",
60
                        "cover" : {
61
                           "mbid" : "f18eac60-48d2-4d2b-b432-e43ce7e31d36",
62
                           "name" : "The Top Notes",
63
                           "sortName" : "Top Notes, The",
64
                           "url" : "https://www.setlist.fm/setlists/the-top-notes-53d433dd.html"
65
                        }
66
                     }, {
67
                        "name" : "You Can't Do That"
68
                     }, {
69
                        "name" : "All My Loving"
70
                     }, {
71
                        "name" : "She Loves You"
72
                     }, {
73
                        "name" : "Things We Said Today"
74
                     }, {
75
                        "name" : "Roll Over Beethoven",
76
                        "cover" : {
77
                           "mbid" : "592a3b6d-c42b-4567-99c9-ecf63bd66499",
78
                           "tmid" : 734540,
79
                           "name" : "Chuck Berry",
80
                           "sortName" : "Berry, Chuck",
81
                           "disambiguation" : "",
82
                           "url" : "https://www.setlist.fm/setlists/chuck-berry-63d6a2b7.html"
83
                        }
84
                     }, {
85
                        "name" : "Can't Buy Me Love"
86
                     }, {
87
                        "name" : "If I Fell"
88
                     }, {
89
                        "name" : "I Want to Hold Your Hand"
90
                     }, {
91
                        "name" : "Boys",
92
                        "cover" : {
93
                           "mbid" : "a8540ea0-1a74-4c22-8b70-1348a77a74a0",
94
                           "name" : "The Shirelles",
95
                           "sortName" : "Shirelles, The",
96
                           "disambiguation" : "",
97
                           "url" : "https://www.setlist.fm/setlists/the-shirelles-bd69d7a.html"
98
                        }
99
                     }, {
100
                        "name" : "A Hard Day's Night"
101
                     }, {
102
                        "name" : "Long Tall Sally",
103
                        "cover" : {
104
                           "mbid" : "95c2339b-8277-49a6-9aaf-08d8eeeaa0be",
105
                           "tmid" : 735520,
106
                           "name" : "Little Richard",
107
                           "sortName" : "Little Richard",
108
                           "disambiguation" : "",
109
                           "url" : "https://www.setlist.fm/setlists/little-richard-4bd6af2e.html"
110
                        }
111
                     } ]
112
                  } ]
113
               },
114
               "info" : "Recorded and published as 'The Beatles at the Hollywood Bowl'",
115
               "url" : "https://www.setlist.fm/setlist/the-beatles/1964/hollywood-bowl-los-angeles-ca-63de4613.html"
116
            }
117
EOD;
118
119
        $setlist = Setlist::fromApi(json_decode($data, true));
120
        $this->assertSame('63de4613', $setlist->getId());
121
        $this->assertSame('7be1aaa0', $setlist->getVersionId());
122
        $this->assertNotNull($setlist->getVenue());
123
        $this->assertNotNull($setlist->getArtist());
124
        $this->assertEquals(new DateTime('23-08-1964'), $setlist->getEventDate(), '', 0);
125
        $this->assertSame('Recorded and published as \'The Beatles at the Hollywood Bowl\'', $setlist->getInfo());
126
        $this->assertNotNull($setlist->getSets());
127
        $this->assertNotNull($setlist->getTour());
128
        $this->assertEquals(new DateTime('2013-10-20T05:18:08.000+0000'), $setlist->getUpdateDate(), '', 0);
129
        $this->assertSame('https://www.setlist.fm/setlist/the-beatles/1964/hollywood-bowl-los-angeles-ca-63de4613.html', $setlist->getUrl());
130
    }
131
}
132