Skip to content

Commit

Permalink
Merge pull request #14 from ker0x/hotfix/tests
Browse files Browse the repository at this point in the history
[n/a] fix somme issues in tests
  • Loading branch information
ker0x committed Jan 3, 2019
2 parents ef25412 + dafea29 commit ea84d98
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/Api/Me.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 7 additions & 4 deletions tests/TestCase/Api/ArtistsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions tests/TestCase/Api/AudioTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions tests/TestCase/Api/BrowseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ea84d98

Please sign in to comment.