Passed
Pull Request — master (#5)
by Rafal
02:30
created
test/Integration/Application/SpotifyWebApiPhp/SpotifyWebApiTest.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
         $spotifyApiConnectFactory = new SpotifyApiConnectFactory();
38 38
         $spotifyApiAuth = $spotifyApiConnectFactory->createSpotifyApiAuth();
39 39
         $accessToken = $spotifyApiAuth->getAccessByRefreshToken(getenv('REFRESH_TOKEN'));
40
-        $this->spotifyWebApi =  $spotifyApiConnectFactory->createSpotifyWebApi($accessToken);
40
+        $this->spotifyWebApi = $spotifyApiConnectFactory->createSpotifyWebApi($accessToken);
41 41
     }
42 42
 
43 43
 
44 44
     public function testGetUserPlaylists(): void
45 45
     {
46 46
         $spotifyPlaylist = $this->spotifyWebApi->getUserPlaylistByName(
47
-            static::spotifyInfo['playlistName']
47
+            static::spotifyInfo[ 'playlistName' ]
48 48
         );
49
-        $this->assertSame(static::spotifyInfo['playlistId'], $spotifyPlaylist->getId());
49
+        $this->assertSame(static::spotifyInfo[ 'playlistId' ], $spotifyPlaylist->getId());
50 50
     }
51 51
 
52 52
     public function testGetUserPlaylistsNotFoundPlayList(): void
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
     public function testGetPlaylist(): void
59 59
     {
60 60
         $spotifyPlayList = $this->spotifyWebApi->getPlaylist(
61
-            static::spotifyInfo['playlistId']
61
+            static::spotifyInfo[ 'playlistId' ]
62 62
         );
63
-        $this->assertSame(static::spotifyInfo['playlistId'], $spotifyPlayList->getId());
64
-        $this->assertSame(static::spotifyInfo['playlistName'], $spotifyPlayList->getName());
63
+        $this->assertSame(static::spotifyInfo[ 'playlistId' ], $spotifyPlayList->getId());
64
+        $this->assertSame(static::spotifyInfo[ 'playlistName' ], $spotifyPlayList->getName());
65 65
         $this->assertTrue($spotifyPlayList->getPublic());
66
-        $this->assertSame('U2', $spotifyPlayList->getTracks()->getItems()[0]->getTrack()->getArtists()[0]->getName());
66
+        $this->assertSame('U2', $spotifyPlayList->getTracks()->getItems()[ 0 ]->getTrack()->getArtists()[ 0 ]->getName());
67 67
     }
68 68
 
69 69
     public function testGetNoExistUserPlaylist(): void
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
     {
87 87
         $trackSearchRequestDataProvider = new TrackSearchRequestDataProvider();
88 88
         $trackSearchRequestDataProvider->setArtist(
89
-            static::spotifySong['artist']
89
+            static::spotifySong[ 'artist' ]
90 90
         );
91 91
         $trackSearchRequestDataProvider->setTrack(
92
-            static::spotifySong['track']
92
+            static::spotifySong[ 'track' ]
93 93
         );
94 94
         $searchResult = $this->spotifyWebApi->searchTrack($trackSearchRequestDataProvider);
95 95
 
96 96
         $this->assertGreaterThan(0, $searchResult->getItems());
97 97
         $this->assertSame(
98
-            strtolower(static::spotifySong['track']),
98
+            strtolower(static::spotifySong[ 'track' ]),
99 99
             strtolower(
100
-                $searchResult->getItems()[0]->getName()
100
+                $searchResult->getItems()[ 0 ]->getName()
101 101
             )
102 102
         );
103 103
     }
@@ -119,27 +119,27 @@  discard block
 block discarded – undo
119 119
     public function testAddPlaylistTracks()
120 120
     {
121 121
         $addResult = $this->spotifyWebApi->addPlaylistTracks(
122
-            static::spotifyInfo['playlistId'],
122
+            static::spotifyInfo[ 'playlistId' ],
123 123
             [
124
-                static::spotifySong['trackId']
124
+                static::spotifySong[ 'trackId' ]
125 125
             ]
126 126
         );
127 127
         $this->assertTrue($addResult);
128 128
 
129 129
         $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks(
130
-            static::spotifyInfo['playlistId']
130
+            static::spotifyInfo[ 'playlistId' ]
131 131
         );
132 132
 
133 133
         $this->assertNotEmpty($spotifyPlayList->getItems());
134 134
         $this->assertNotEmpty($spotifyPlayList->getTotal());
135
-        $this->assertSame(static::spotifySong['trackId'], $spotifyPlayList->getItems()[1]->getTrack()->getId());
135
+        $this->assertSame(static::spotifySong[ 'trackId' ], $spotifyPlayList->getItems()[ 1 ]->getTrack()->getId());
136 136
     }
137 137
 
138 138
     public function testAddPlaylistTracksNotExistTrackId()
139 139
     {
140 140
         try {
141 141
             $this->spotifyWebApi->addPlaylistTracks(
142
-                static::spotifyInfo['playlistId'],
142
+                static::spotifyInfo[ 'playlistId' ],
143 143
                 [
144 144
                     'uniTest-Not_FOUND--ID'
145 145
                 ]
@@ -158,24 +158,24 @@  discard block
 block discarded – undo
158 158
     public function testDeleteUserPlaylistTracks()
159 159
     {
160 160
         $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks(
161
-            static::spotifyInfo['playlistId']
161
+            static::spotifyInfo[ 'playlistId' ]
162 162
         );
163 163
 
164 164
         $this->assertCount(2, $spotifyPlayList->getItems());
165 165
         $this->assertSame(2, $spotifyPlayList->getTotal());
166 166
 
167 167
         $deleteTrack = new DeleteTrackInfoDataProvider();
168
-        $deleteTrack->setId(static::spotifySong['trackId']);
168
+        $deleteTrack->setId(static::spotifySong[ 'trackId' ]);
169 169
 
170 170
         $result = $this->spotifyWebApi->deletePlaylistTracks(
171
-            static::spotifyInfo['playlistId'],
172
-            [$deleteTrack]
171
+            static::spotifyInfo[ 'playlistId' ],
172
+            [ $deleteTrack ]
173 173
         );
174 174
 
175 175
         $this->assertTrue($result);
176 176
 
177 177
         $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks(
178
-            static::spotifyInfo['playlistId']
178
+            static::spotifyInfo[ 'playlistId' ]
179 179
         );
180 180
 
181 181
         $this->assertCount(1, $spotifyPlayList->getItems());
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
             $deleteTrack = new DeleteTrackInfoDataProvider();
189 189
             $deleteTrack->setId('uniTest-Not_FOUND--ID');
190 190
             $this->spotifyWebApi->deletePlaylistTracks(
191
-                static::spotifyInfo['playlistId'],
192
-                [$deleteTrack]
191
+                static::spotifyInfo[ 'playlistId' ],
192
+                [ $deleteTrack ]
193 193
             );
194 194
         } catch (\SpotifyWebAPI\SpotifyWebAPIException $e) {
195 195
             $this->assertSame(
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
     {
207 207
         $this->expectException(\RuntimeException::class);
208 208
         $this->spotifyWebApi->deletePlaylistTracks(
209
-            static::spotifyInfo['playlistId'],
210
-            ['id' => 'hahaha']
209
+            static::spotifyInfo[ 'playlistId' ],
210
+            [ 'id' => 'hahaha' ]
211 211
         );
212 212
     }
213 213
 }
Please login to merge, or discard this patch.