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

SetTest::testFromApi()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 68

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 68
rs 8.6981
c 0
b 0
f 0
cc 1
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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\Set;
13
use PHPUnit\Framework\TestCase;
14
15
class SetTest extends TestCase
16
{
17
    public function testFromApi(): void
18
    {
19
        $data    = <<<'EOD'
20
                  	{
21
                  	 "name": "First set",
22
                  	 "encore": 3,
23
                     "song" : [ {
24
                        "name" : "Twist and Shout",
25
                        "cover" : {
26
                           "mbid" : "f18eac60-48d2-4d2b-b432-e43ce7e31d36",
27
                           "name" : "The Top Notes",
28
                           "sortName" : "Top Notes, The",
29
                           "url" : "https://www.setlist.fm/setlists/the-top-notes-53d433dd.html"
30
                        }
31
                     }, {
32
                        "name" : "You Can't Do That"
33
                     }, {
34
                        "name" : "All My Loving"
35
                     }, {
36
                        "name" : "She Loves You"
37
                     }, {
38
                        "name" : "Things We Said Today"
39
                     }, {
40
                        "name" : "Roll Over Beethoven",
41
                        "cover" : {
42
                           "mbid" : "592a3b6d-c42b-4567-99c9-ecf63bd66499",
43
                           "tmid" : 734540,
44
                           "name" : "Chuck Berry",
45
                           "sortName" : "Berry, Chuck",
46
                           "disambiguation" : "",
47
                           "url" : "https://www.setlist.fm/setlists/chuck-berry-63d6a2b7.html"
48
                        }
49
                     }, {
50
                        "name" : "Can't Buy Me Love"
51
                     }, {
52
                        "name" : "If I Fell"
53
                     }, {
54
                        "name" : "I Want to Hold Your Hand"
55
                     }, {
56
                        "name" : "Boys",
57
                        "cover" : {
58
                           "mbid" : "a8540ea0-1a74-4c22-8b70-1348a77a74a0",
59
                           "name" : "The Shirelles",
60
                           "sortName" : "Shirelles, The",
61
                           "disambiguation" : "",
62
                           "url" : "https://www.setlist.fm/setlists/the-shirelles-bd69d7a.html"
63
                        }
64
                     }, {
65
                        "name" : "A Hard Day's Night"
66
                     }, {
67
                        "name" : "Long Tall Sally",
68
                        "cover" : {
69
                           "mbid" : "95c2339b-8277-49a6-9aaf-08d8eeeaa0be",
70
                           "tmid" : 735520,
71
                           "name" : "Little Richard",
72
                           "sortName" : "Little Richard",
73
                           "disambiguation" : "",
74
                           "url" : "https://www.setlist.fm/setlists/little-richard-4bd6af2e.html"
75
                        }
76
                     } ]
77
                  }
78
EOD;
79
80
        $set = Set::fromApi(json_decode($data, true));
81
        $this->assertSame('First set', $set->getName());
82
        $this->assertCount(12, $set->getSongs());
83
        $this->assertSame(3, $set->getEncore());
84
    }
85
}
86