Passed
Pull Request — master (#1)
by Rafal
01:47
created
test/Integration/Application/SpotifyWebApiPhp/SpotifyWebApiTest.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -59,18 +59,18 @@  discard block
 block discarded – undo
59 59
 
60 60
     public function testGetUserPlaylists(): void
61 61
     {
62
-        $spotifyPlayLists = $this->spotifyWebApi->getUserPlaylists(static::spotifyInfo['user']);
62
+        $spotifyPlayLists = $this->spotifyWebApi->getUserPlaylists(static::spotifyInfo[ 'user' ]);
63 63
         $playlistId = false;
64
-        $items = (array)$spotifyPlayLists->items;
64
+        $items = (array) $spotifyPlayLists->items;
65 65
         foreach ($items as $item) {
66 66
 
67
-            if (trim($item->name) === static::spotifyInfo['playlistName']) {
67
+            if (trim($item->name) === static::spotifyInfo[ 'playlistName' ]) {
68 68
                 $playlistId = $item->id;
69 69
                 break;
70 70
             }
71 71
         }
72 72
 
73
-        $this->assertSame(static::spotifyInfo['playlistId'], $playlistId);
73
+        $this->assertSame(static::spotifyInfo[ 'playlistId' ], $playlistId);
74 74
         $this->assertTrue($items > 5);
75 75
     }
76 76
 
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
     public function testGetPlaylist(): void
86 86
     {
87 87
         $spotifyPlayList = $this->spotifyWebApi->getPlaylist(
88
-            static::spotifyInfo['playlistId']
88
+            static::spotifyInfo[ 'playlistId' ]
89 89
         );
90
-        $this->assertSame(static::spotifyInfo['playlistId'], $spotifyPlayList->getId());
91
-        $this->assertSame(static::spotifyInfo['playlistName'], $spotifyPlayList->getName());
90
+        $this->assertSame(static::spotifyInfo[ 'playlistId' ], $spotifyPlayList->getId());
91
+        $this->assertSame(static::spotifyInfo[ 'playlistName' ], $spotifyPlayList->getName());
92 92
         $this->assertTrue($spotifyPlayList->getPublic());
93
-        $this->assertSame('U2', $spotifyPlayList->getTracks()->getItems()[0]->getTrack()->getArtists()[0]->getName());
93
+        $this->assertSame('U2', $spotifyPlayList->getTracks()->getItems()[ 0 ]->getTrack()->getArtists()[ 0 ]->getName());
94 94
     }
95 95
 
96 96
     public function testGetNoExistUserPlaylist(): void
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
     public function testSearch()
113 113
     {
114 114
         $searchResult = $this->spotifyWebApi->search(
115
-            sprintf('track:%s artist:%s', static::spotifySong['track'], static::spotifySong['artist']), ['track']
115
+            sprintf('track:%s artist:%s', static::spotifySong[ 'track' ], static::spotifySong[ 'artist' ]), [ 'track' ]
116 116
         );
117 117
 
118
-        $this->assertSame(strtolower(static::spotifySong['track']), strtolower($searchResult->tracks->items[0]->name));
118
+        $this->assertSame(strtolower(static::spotifySong[ 'track' ]), strtolower($searchResult->tracks->items[ 0 ]->name));
119 119
     }
120 120
 
121 121
     public function testSearchNotFound()
122 122
     {
123 123
         $searchNoResult = $this->spotifyWebApi->search(
124
-            sprintf('track:%s artist:%s', 'NotFound-Track-For_UNITtest', 'NotFOundArtistForUnitTest'), ['track']
124
+            sprintf('track:%s artist:%s', 'NotFound-Track-For_UNITtest', 'NotFOundArtistForUnitTest'), [ 'track' ]
125 125
         );
126 126
         $this->assertSame(0, $searchNoResult->tracks->total);
127 127
         $this->assertEmpty($searchNoResult->tracks->items);
@@ -130,29 +130,29 @@  discard block
 block discarded – undo
130 130
     public function testAddUserPlaylistTracks()
131 131
     {
132 132
         $addResult = $this->spotifyWebApi->addUserPlaylistTracks(
133
-            static::spotifyInfo['user'],
134
-            static::spotifyInfo['playlistId'],
133
+            static::spotifyInfo[ 'user' ],
134
+            static::spotifyInfo[ 'playlistId' ],
135 135
             [
136
-                static::spotifySong['trackId']
136
+                static::spotifySong[ 'trackId' ]
137 137
             ]
138 138
         );
139 139
         $this->assertTrue($addResult);
140 140
 
141 141
         $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks(
142
-            static::spotifyInfo['playlistId']
142
+            static::spotifyInfo[ 'playlistId' ]
143 143
         );
144 144
 
145 145
         $this->assertNotEmpty($spotifyPlayList->getItems());
146 146
         $this->assertNotEmpty($spotifyPlayList->getTotal());
147
-        $this->assertSame(static::spotifySong['trackId'], $spotifyPlayList->getItems()[1]->getTrack()->getId());
147
+        $this->assertSame(static::spotifySong[ 'trackId' ], $spotifyPlayList->getItems()[ 1 ]->getTrack()->getId());
148 148
     }
149 149
 
150 150
     public function testAddUserPlaylistTracksNotExistTrackId()
151 151
     {
152 152
         try {
153 153
             $this->spotifyWebApi->addUserPlaylistTracks(
154
-                static::spotifyInfo['user'],
155
-                static::spotifyInfo['playlistId'],
154
+                static::spotifyInfo[ 'user' ],
155
+                static::spotifyInfo[ 'playlistId' ],
156 156
                 [
157 157
                     'uniTest-Not_FOUND--ID'
158 158
                 ]
@@ -171,24 +171,24 @@  discard block
 block discarded – undo
171 171
     public function testDeleteUserPlaylistTracks()
172 172
     {
173 173
         $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks(
174
-            static::spotifyInfo['playlistId']
174
+            static::spotifyInfo[ 'playlistId' ]
175 175
         );
176 176
 
177 177
         $this->assertCount(2, $spotifyPlayList->getItems());
178 178
         $this->assertSame(2, $spotifyPlayList->getTotal());
179 179
 
180 180
         $this->spotifyWebApi->deleteUserPlaylistTracks(
181
-            static::spotifyInfo['user'],
182
-            static::spotifyInfo['playlistId'],
181
+            static::spotifyInfo[ 'user' ],
182
+            static::spotifyInfo[ 'playlistId' ],
183 183
             [
184 184
                 [
185
-                    'id' => static::spotifySong['trackId']
185
+                    'id' => static::spotifySong[ 'trackId' ]
186 186
                 ]
187 187
             ]
188 188
         );
189 189
 
190 190
         $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks(
191
-            static::spotifyInfo['playlistId']
191
+            static::spotifyInfo[ 'playlistId' ]
192 192
         );
193 193
 
194 194
         $this->assertCount(1, $spotifyPlayList->getItems());
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
     {
200 200
         try {
201 201
             $this->spotifyWebApi->deleteUserPlaylistTracks(
202
-                static::spotifyInfo['user'],
203
-                static::spotifyInfo['playlistId'],
202
+                static::spotifyInfo[ 'user' ],
203
+                static::spotifyInfo[ 'playlistId' ],
204 204
                 [
205 205
                     [
206 206
                         'id' => 'uniTest-Not_FOUND--ID'
Please login to merge, or discard this patch.
test/Integration/Application/SpotifyWebApiPhp/SessionTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,17 +34,17 @@
 block discarded – undo
34 34
 
35 35
         $this->assertNotEmpty($redirectUrl, 'authorize url from spotify is empty');
36 36
         $parseRedirectUrl = parse_url($redirectUrl);
37
-        $this->assertSame('accounts.spotify.com', $parseRedirectUrl['host']);
38
-        $this->assertSame('/authorize', $parseRedirectUrl['path']);
37
+        $this->assertSame('accounts.spotify.com', $parseRedirectUrl[ 'host' ]);
38
+        $this->assertSame('/authorize', $parseRedirectUrl[ 'path' ]);
39 39
 
40
-        $this->assertNotEmpty($parseRedirectUrl['query']);
40
+        $this->assertNotEmpty($parseRedirectUrl[ 'query' ]);
41 41
 
42
-        $info = [];
43
-        parse_str($parseRedirectUrl['query'], $info);
42
+        $info = [ ];
43
+        parse_str($parseRedirectUrl[ 'query' ], $info);
44 44
 
45
-        $this->assertSame('code', $info['response_type']);
46
-        $this->assertSame('http://localhost/', $info['redirect_uri']);
47
-        $this->assertTrue(isset($info['client_id']));
45
+        $this->assertSame('code', $info[ 'response_type' ]);
46
+        $this->assertSame('http://localhost/', $info[ 'redirect_uri' ]);
47
+        $this->assertTrue(isset($info[ 'client_id' ]));
48 48
     }
49 49
 
50 50
     public function testRefreshAccessToken()
Please login to merge, or discard this patch.