@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | public function getClientId(): string |
| 14 | 14 | { |
| 15 | - $clientId = (string)getenv('CLIENT_ID'); |
|
| 15 | + $clientId = (string) getenv('CLIENT_ID'); |
|
| 16 | 16 | if (empty($clientId)) { |
| 17 | 17 | throw new RuntimeException( |
| 18 | 18 | sprintf(Message::ERROR_GET_ENV_VARIABLE, $clientId) |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function getClientSecret(): string |
| 29 | 29 | { |
| 30 | - $clientSecret = (string)getenv('CLIENT_SECRET'); |
|
| 30 | + $clientSecret = (string) getenv('CLIENT_SECRET'); |
|
| 31 | 31 | if (empty($clientSecret)) { |
| 32 | 32 | throw new RuntimeException( |
| 33 | 33 | sprintf(Message::ERROR_GET_ENV_VARIABLE, $clientSecret) |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function getRedirectUri(): string |
| 44 | 44 | { |
| 45 | - $redirectUri = (string)getenv('REDIRECT_URI'); |
|
| 45 | + $redirectUri = (string) getenv('REDIRECT_URI'); |
|
| 46 | 46 | if (empty($redirectUri)) { |
| 47 | 47 | throw new RuntimeException( |
| 48 | 48 | sprintf(Message::ERROR_GET_ENV_VARIABLE, $redirectUri) |
@@ -37,17 +37,17 @@ discard block |
||
| 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['user'], |
|
| 48 | - static::spotifyInfo['playlistName'] |
|
| 47 | + static::spotifyInfo[ 'user' ], |
|
| 48 | + static::spotifyInfo[ 'playlistName' ] |
|
| 49 | 49 | ); |
| 50 | - $this->assertSame(static::spotifyInfo['playlistId'], $spotifyPlaylist->getId()); |
|
| 50 | + $this->assertSame(static::spotifyInfo[ 'playlistId' ], $spotifyPlaylist->getId()); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public function testGetUserPlaylistsNotFoundUser(): void |
@@ -59,18 +59,18 @@ discard block |
||
| 59 | 59 | public function testGetUserPlaylistsNotFoundPlayList(): void |
| 60 | 60 | { |
| 61 | 61 | $this->expectException(PlaylistNotFound::class); |
| 62 | - $this->spotifyWebApi->getUserPlaylistByName(static::spotifyInfo['user'], 'uniTest-Not_FOUND-Playlist'); |
|
| 62 | + $this->spotifyWebApi->getUserPlaylistByName(static::spotifyInfo[ 'user' ], 'uniTest-Not_FOUND-Playlist'); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public function testGetPlaylist(): void |
| 66 | 66 | { |
| 67 | 67 | $spotifyPlayList = $this->spotifyWebApi->getPlaylist( |
| 68 | - static::spotifyInfo['playlistId'] |
|
| 68 | + static::spotifyInfo[ 'playlistId' ] |
|
| 69 | 69 | ); |
| 70 | - $this->assertSame(static::spotifyInfo['playlistId'], $spotifyPlayList->getId()); |
|
| 71 | - $this->assertSame(static::spotifyInfo['playlistName'], $spotifyPlayList->getName()); |
|
| 70 | + $this->assertSame(static::spotifyInfo[ 'playlistId' ], $spotifyPlayList->getId()); |
|
| 71 | + $this->assertSame(static::spotifyInfo[ 'playlistName' ], $spotifyPlayList->getName()); |
|
| 72 | 72 | $this->assertTrue($spotifyPlayList->getPublic()); |
| 73 | - $this->assertSame('U2', $spotifyPlayList->getTracks()->getItems()[0]->getTrack()->getArtists()[0]->getName()); |
|
| 73 | + $this->assertSame('U2', $spotifyPlayList->getTracks()->getItems()[ 0 ]->getTrack()->getArtists()[ 0 ]->getName()); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | public function testGetNoExistUserPlaylist(): void |
@@ -93,18 +93,18 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | $trackSearchRequestDataProvider = new TrackSearchRequestDataProvider(); |
| 95 | 95 | $trackSearchRequestDataProvider->setArtist( |
| 96 | - static::spotifySong['artist'] |
|
| 96 | + static::spotifySong[ 'artist' ] |
|
| 97 | 97 | ); |
| 98 | 98 | $trackSearchRequestDataProvider->setTrack( |
| 99 | - static::spotifySong['track'] |
|
| 99 | + static::spotifySong[ 'track' ] |
|
| 100 | 100 | ); |
| 101 | 101 | $searchResult = $this->spotifyWebApi->searchTrack($trackSearchRequestDataProvider); |
| 102 | 102 | |
| 103 | 103 | $this->assertGreaterThan(0, $searchResult->getItems()); |
| 104 | 104 | $this->assertSame( |
| 105 | - strtolower(static::spotifySong['track']), |
|
| 105 | + strtolower(static::spotifySong[ 'track' ]), |
|
| 106 | 106 | strtolower( |
| 107 | - $searchResult->getItems()[0]->getName() |
|
| 107 | + $searchResult->getItems()[ 0 ]->getName() |
|
| 108 | 108 | ) |
| 109 | 109 | ); |
| 110 | 110 | } |
@@ -126,27 +126,27 @@ discard block |
||
| 126 | 126 | public function testAddPlaylistTracks() |
| 127 | 127 | { |
| 128 | 128 | $addResult = $this->spotifyWebApi->addPlaylistTracks( |
| 129 | - static::spotifyInfo['playlistId'], |
|
| 129 | + static::spotifyInfo[ 'playlistId' ], |
|
| 130 | 130 | [ |
| 131 | - static::spotifySong['trackId'] |
|
| 131 | + static::spotifySong[ 'trackId' ] |
|
| 132 | 132 | ] |
| 133 | 133 | ); |
| 134 | 134 | $this->assertTrue($addResult); |
| 135 | 135 | |
| 136 | 136 | $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks( |
| 137 | - static::spotifyInfo['playlistId'] |
|
| 137 | + static::spotifyInfo[ 'playlistId' ] |
|
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | 140 | $this->assertNotEmpty($spotifyPlayList->getItems()); |
| 141 | 141 | $this->assertNotEmpty($spotifyPlayList->getTotal()); |
| 142 | - $this->assertSame(static::spotifySong['trackId'], $spotifyPlayList->getItems()[1]->getTrack()->getId()); |
|
| 142 | + $this->assertSame(static::spotifySong[ 'trackId' ], $spotifyPlayList->getItems()[ 1 ]->getTrack()->getId()); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | public function testAddPlaylistTracksNotExistTrackId() |
| 146 | 146 | { |
| 147 | 147 | try { |
| 148 | 148 | $this->spotifyWebApi->addPlaylistTracks( |
| 149 | - static::spotifyInfo['playlistId'], |
|
| 149 | + static::spotifyInfo[ 'playlistId' ], |
|
| 150 | 150 | [ |
| 151 | 151 | 'uniTest-Not_FOUND--ID' |
| 152 | 152 | ] |
@@ -165,24 +165,24 @@ discard block |
||
| 165 | 165 | public function testDeleteUserPlaylistTracks() |
| 166 | 166 | { |
| 167 | 167 | $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks( |
| 168 | - static::spotifyInfo['playlistId'] |
|
| 168 | + static::spotifyInfo[ 'playlistId' ] |
|
| 169 | 169 | ); |
| 170 | 170 | |
| 171 | 171 | $this->assertCount(2, $spotifyPlayList->getItems()); |
| 172 | 172 | $this->assertSame(2, $spotifyPlayList->getTotal()); |
| 173 | 173 | |
| 174 | 174 | $deleteTrack = new DeleteTrackInfoDataProvider(); |
| 175 | - $deleteTrack->setId(static::spotifySong['trackId']); |
|
| 175 | + $deleteTrack->setId(static::spotifySong[ 'trackId' ]); |
|
| 176 | 176 | |
| 177 | 177 | $result = $this->spotifyWebApi->deletePlaylistTracks( |
| 178 | - static::spotifyInfo['playlistId'], |
|
| 179 | - [$deleteTrack] |
|
| 178 | + static::spotifyInfo[ 'playlistId' ], |
|
| 179 | + [ $deleteTrack ] |
|
| 180 | 180 | ); |
| 181 | 181 | |
| 182 | 182 | $this->assertTrue($result); |
| 183 | 183 | |
| 184 | 184 | $spotifyPlayList = $this->spotifyWebApi->getPlaylistTracks( |
| 185 | - static::spotifyInfo['playlistId'] |
|
| 185 | + static::spotifyInfo[ 'playlistId' ] |
|
| 186 | 186 | ); |
| 187 | 187 | |
| 188 | 188 | $this->assertCount(1, $spotifyPlayList->getItems()); |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | $deleteTrack = new DeleteTrackInfoDataProvider(); |
| 196 | 196 | $deleteTrack->setId('uniTest-Not_FOUND--ID'); |
| 197 | 197 | $this->spotifyWebApi->deletePlaylistTracks( |
| 198 | - static::spotifyInfo['playlistId'], |
|
| 199 | - [$deleteTrack] |
|
| 198 | + static::spotifyInfo[ 'playlistId' ], |
|
| 199 | + [ $deleteTrack ] |
|
| 200 | 200 | ); |
| 201 | 201 | } catch (\SpotifyWebAPI\SpotifyWebAPIException $e) { |
| 202 | 202 | $this->assertSame( |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | { |
| 214 | 214 | $this->expectException(\RuntimeException::class); |
| 215 | 215 | $this->spotifyWebApi->deletePlaylistTracks( |
| 216 | - static::spotifyInfo['playlistId'], |
|
| 217 | - ['id' => 'hahaha'] |
|
| 216 | + static::spotifyInfo[ 'playlistId' ], |
|
| 217 | + [ 'id' => 'hahaha' ] |
|
| 218 | 218 | ); |
| 219 | 219 | } |
| 220 | 220 | } |