diff --git a/README.md b/README.md index 8865248..0ccde26 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ You will then need to: * run `composer install` to get these dependencies added to your vendor directory * add the autoloader to your application with this line: `require('vendor/autoload.php');` -## Advance usage +## Usage Please, refer to the [wiki](https://github.com/ker0x/spotify/wiki) to learn how to use this library diff --git a/src/Api/Me.php b/src/Api/Me.php index e0a6e15..e8559ec 100644 --- a/src/Api/Me.php +++ b/src/Api/Me.php @@ -40,7 +40,7 @@ public function playlists(array $queryParameters = []): PagingResponse { $uri = $this->createUri('me/playlists', $queryParameters); - $request = new Request($this->oauthToken, $uri, RequestMethodInterface::METHOD_PUT); + $request = new Request($this->oauthToken, $uri, RequestMethodInterface::METHOD_GET); $response = $this->client->sendRequest($request); return new PagingResponse($response); diff --git a/src/Api/Users.php b/src/Api/Users.php index 34326ed..75e82c5 100644 --- a/src/Api/Users.php +++ b/src/Api/Users.php @@ -40,7 +40,7 @@ public function playlists(string $id, array $queryParameters = []): PagingRespon { $uri = $this->createUri(sprintf('users/%s/playlists', $id), $queryParameters); - $request = new Request($this->oauthToken, $uri, RequestMethodInterface::METHOD_PUT); + $request = new Request($this->oauthToken, $uri, RequestMethodInterface::METHOD_GET); $response = $this->client->sendRequest($request); return new PagingResponse($response); diff --git a/tests/TestCase/Api/ArtistsTest.php b/tests/TestCase/Api/ArtistsTest.php index 3d5071d..7565d24 100644 --- a/tests/TestCase/Api/ArtistsTest.php +++ b/tests/TestCase/Api/ArtistsTest.php @@ -10,6 +10,9 @@ use Kerox\Spotify\Model\Image; use Kerox\Spotify\Model\Track; use Kerox\Spotify\Response\ArtistResponse; +use Kerox\Spotify\Response\ArtistsResponse; +use Kerox\Spotify\Response\PagingResponse; +use Kerox\Spotify\Response\TracksResponse; use Kerox\Spotify\Spotify; use PHPUnit\Framework\TestCase; use Psr\Http\Client\ClientInterface; @@ -71,7 +74,7 @@ public function testGetAlbums(): void $stream = $this->createMock(StreamInterface::class); $stream->method('__toString')->willReturn($body); - $response = $this->createMock(ArtistResponse::class); + $response = $this->createMock(PagingResponse::class); $response->method('getBody')->willReturn($stream); $response->method('getHeader')->willReturn(['content-type' => 'json']); $response->method('getStatusCode')->willReturn(200); @@ -112,7 +115,7 @@ public function testGetTopTracks(): void $stream = $this->createMock(StreamInterface::class); $stream->method('__toString')->willReturn($body); - $response = $this->createMock(ArtistResponse::class); + $response = $this->createMock(TracksResponse::class); $response->method('getBody')->willReturn($stream); $response->method('getHeader')->willReturn(['content-type' => 'json']); $response->method('getStatusCode')->willReturn(200); @@ -137,7 +140,7 @@ public function testGetRelatedArtists(): void $stream = $this->createMock(StreamInterface::class); $stream->method('__toString')->willReturn($body); - $response = $this->createMock(ArtistResponse::class); + $response = $this->createMock(ArtistsResponse::class); $response->method('getBody')->willReturn($stream); $response->method('getHeader')->willReturn(['content-type' => 'json']); $response->method('getStatusCode')->willReturn(200); @@ -160,7 +163,7 @@ public function testGetSeveral(): void $stream = $this->createMock(StreamInterface::class); $stream->method('__toString')->willReturn($body); - $response = $this->createMock(ArtistResponse::class); + $response = $this->createMock(ArtistsResponse::class); $response->method('getBody')->willReturn($stream); $response->method('getHeader')->willReturn(['content-type' => 'json']); $response->method('getStatusCode')->willReturn(200); diff --git a/tests/TestCase/Api/AudioTest.php b/tests/TestCase/Api/AudioTest.php index 438e0d5..b4ba66a 100644 --- a/tests/TestCase/Api/AudioTest.php +++ b/tests/TestCase/Api/AudioTest.php @@ -9,6 +9,7 @@ use Kerox\Spotify\Model\AudioAnalysis\Tatum; use Kerox\Spotify\Model\AudioFeatures; use Kerox\Spotify\Response\AudioAnalysisResponse; +use Kerox\Spotify\Response\AudioFeaturesResponse; use Kerox\Spotify\Spotify; use PHPUnit\Framework\TestCase; use Psr\Http\Client\ClientInterface; @@ -137,7 +138,7 @@ public function testGetAudioFeaturesForATrack(): void $stream = $this->createMock(StreamInterface::class); $stream->method('__toString')->willReturn($body); - $response = $this->createMock(AudioAnalysisResponse::class); + $response = $this->createMock(AudioFeaturesResponse::class); $response->method('getBody')->willReturn($stream); $response->method('getHeader')->willReturn(['content-type' => 'json']); $response->method('getStatusCode')->willReturn(200); @@ -178,7 +179,7 @@ public function testGetAudioFeaturesForTracks(): void $stream = $this->createMock(StreamInterface::class); $stream->method('__toString')->willReturn($body); - $response = $this->createMock(AudioAnalysisResponse::class); + $response = $this->createMock(AudioFeaturesResponse::class); $response->method('getBody')->willReturn($stream); $response->method('getHeader')->willReturn(['content-type' => 'json']); $response->method('getStatusCode')->willReturn(200); diff --git a/tests/TestCase/Api/BrowseTest.php b/tests/TestCase/Api/BrowseTest.php index e68af2f..df10fd6 100644 --- a/tests/TestCase/Api/BrowseTest.php +++ b/tests/TestCase/Api/BrowseTest.php @@ -9,7 +9,9 @@ use Kerox\Spotify\Model\Seed; use Kerox\Spotify\Model\Track; use Kerox\Spotify\Response\CategoriesResponse; +use Kerox\Spotify\Response\CategoryResponse; use Kerox\Spotify\Response\FeaturedResponse; +use Kerox\Spotify\Response\PlaylistsResponse; use Kerox\Spotify\Response\RecommendationsResponse; use Kerox\Spotify\Response\ReleasesResponse; use Kerox\Spotify\Spotify; @@ -38,7 +40,7 @@ public function testGetCategory(): void $stream = $this->createMock(StreamInterface::class); $stream->method('__toString')->willReturn($body); - $response = $this->createMock(CategoriesResponse::class); + $response = $this->createMock(CategoryResponse::class); $response->method('getBody')->willReturn($stream); $response->method('getHeader')->willReturn(['content-type' => 'json']); $response->method('getStatusCode')->willReturn(200); @@ -164,7 +166,7 @@ public function testGetPlaylists(): void $stream = $this->createMock(StreamInterface::class); $stream->method('__toString')->willReturn($body); - $response = $this->createMock(CategoriesResponse::class); + $response = $this->createMock(PlaylistsResponse::class); $response->method('getBody')->willReturn($stream); $response->method('getHeader')->willReturn(['content-type' => 'json']); $response->method('getStatusCode')->willReturn(200);