@@ -28,22 +28,22 @@ |
||
28 | 28 | |
29 | 29 | $this->assertNotEmpty($redirectUrl, 'authorize url from spotify is empty'); |
30 | 30 | $parseRedirectUrl = parse_url($redirectUrl); |
31 | - $this->assertSame('accounts.spotify.com', $parseRedirectUrl['host']); |
|
32 | - $this->assertSame('/authorize', $parseRedirectUrl['path']); |
|
31 | + $this->assertSame('accounts.spotify.com', $parseRedirectUrl[ 'host' ]); |
|
32 | + $this->assertSame('/authorize', $parseRedirectUrl[ 'path' ]); |
|
33 | 33 | |
34 | - $this->assertNotEmpty($parseRedirectUrl['query']); |
|
34 | + $this->assertNotEmpty($parseRedirectUrl[ 'query' ]); |
|
35 | 35 | |
36 | - $info = []; |
|
37 | - parse_str($parseRedirectUrl['query'], $info); |
|
36 | + $info = [ ]; |
|
37 | + parse_str($parseRedirectUrl[ 'query' ], $info); |
|
38 | 38 | |
39 | - $this->assertSame('code', $info['response_type']); |
|
40 | - $this->assertSame('http://localhost/', $info['redirect_uri']); |
|
41 | - $this->assertTrue(isset($info['client_id'])); |
|
39 | + $this->assertSame('code', $info[ 'response_type' ]); |
|
40 | + $this->assertSame('http://localhost/', $info[ 'redirect_uri' ]); |
|
41 | + $this->assertTrue(isset($info[ 'client_id' ])); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public function testRefreshAccessToken() |
45 | 45 | { |
46 | - $this->assertTrue($this->session->refreshAccessToken($_ENV['REFRESH_TOKEN'])); |
|
46 | + $this->assertTrue($this->session->refreshAccessToken($_ENV[ 'REFRESH_TOKEN' ])); |
|
47 | 47 | $this->assertNotEmpty($this->session->getAccessToken()); |
48 | 48 | } |
49 | 49 |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | parent::setUp(); |
37 | 37 | $spotifyApiConnectFactory = new SpotifyApiConnectFactory(); |
38 | 38 | $spotifyApiAuth = $spotifyApiConnectFactory->createSpotifyApiAuth(); |
39 | - $accessToken = $spotifyApiAuth->getAccessByRefreshToken($_ENV['REFRESH_TOKEN']); |
|
40 | - $this->spotifyWebApi = $spotifyApiConnectFactory->createSpotifyWebApi($accessToken); |
|
39 | + $accessToken = $spotifyApiAuth->getAccessByRefreshToken($_ENV[ 'REFRESH_TOKEN' ]); |
|
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | { |
27 | 27 | $this->config = new Config(); |
28 | 28 | foreach ($this->env as $envName => $envValue) { |
29 | - $this->env[$envName] = $_ENV[$envName]; |
|
30 | - $_ENV[$envName] = null; |
|
29 | + $this->env[ $envName ] = $_ENV[ $envName ]; |
|
30 | + $_ENV[ $envName ] = null; |
|
31 | 31 | } |
32 | 32 | parent::setUp(); |
33 | 33 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | protected function tearDown(): void |
36 | 36 | { |
37 | 37 | foreach ($this->env as $envName => $envValue) { |
38 | - $_ENV[$envName] = $envValue; |
|
38 | + $_ENV[ $envName ] = $envValue; |
|
39 | 39 | } |
40 | 40 | parent::tearDown(); |
41 | 41 | } |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | public function testGetClientSecret() |
44 | 44 | { |
45 | 45 | $envValue = 'UnitSecret'; |
46 | - $_ENV['CLIENT_SECRET'] = $envValue; |
|
47 | - $this->assertSame($envValue,$this->config->getClientSecret()); |
|
46 | + $_ENV[ 'CLIENT_SECRET' ] = $envValue; |
|
47 | + $this->assertSame($envValue, $this->config->getClientSecret()); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function testGetClientSecretException() |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | public function testGetClientId() |
57 | 57 | { |
58 | 58 | $envValue = 'UnitId'; |
59 | - $_ENV['CLIENT_ID'] = $envValue; |
|
60 | - $this->assertSame($envValue,$this->config->getClientId()); |
|
59 | + $_ENV[ 'CLIENT_ID' ] = $envValue; |
|
60 | + $this->assertSame($envValue, $this->config->getClientId()); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | public function testGetClientIdException() |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | public function testGetRedirectUri() |
70 | 70 | { |
71 | 71 | $envValue = 'UnitRedirectUri'; |
72 | - $_ENV['REDIRECT_URI'] = $envValue; |
|
73 | - $this->assertSame($envValue,$this->config->getRedirectUri()); |
|
72 | + $_ENV[ 'REDIRECT_URI' ] = $envValue; |
|
73 | + $this->assertSame($envValue, $this->config->getRedirectUri()); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function testGetRedirectUriException() |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | public function testGetSpotifyUsername() |
83 | 83 | { |
84 | 84 | $envValue = 'UnitSpotifyUserName'; |
85 | - $_ENV['SPOTIFY_USERNAME'] = $envValue; |
|
86 | - $this->assertSame($envValue,$this->config->getSpotifyUsername()); |
|
85 | + $_ENV[ 'SPOTIFY_USERNAME' ] = $envValue; |
|
86 | + $this->assertSame($envValue, $this->config->getSpotifyUsername()); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | public function testGetSpotifyUsernameException() |