public function testBuildUserPlaylistResponse()
 {
     $responseMock = json_decode(file_get_contents(__DIR__ . '/response_test_data/user_playlists.json'));
     $result = $this->valueObjectBuilder->buildUserPlaylistResponse($responseMock);
     $this->assertValueObjectPropertyEquals('href', $responseMock, $result);
     $this->assertValueObjectPropertyEquals('limit', $responseMock, $result);
     $this->assertValueObjectPropertyEquals('next', $responseMock, $result);
     $this->assertValueObjectPropertyEquals('offset', $responseMock, $result);
     $this->assertValueObjectPropertyEquals('previous', $responseMock, $result);
     $this->assertTrue(is_array($result->getItems()), 'Response items should be an array');
     $this->assertTrue($result->getItems()[0] instanceof Playlist, 'First response item should be a Playlist');
 }
Exemplo n.º 2
0
 /**
  * Gets the current user's playlists
  *
  * @param int $limit
  * @param int $offset
  *
  * @return Response\UserPlaylistResponse
  * @throws SpotifyWebAPIException
  */
 public function requestUserPlaylists($limit = 20, $offset = 0)
 {
     $rawResponse = $this->spotifyWebApi->getMyPlaylists(['limit' => $limit, 'offset' => $offset]);
     $response = $this->valueObjectBuilder->buildUserPlaylistResponse($rawResponse);
     return $response;
 }