Skip to content

Commit

Permalink
Add additional test
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilsson committed Jul 29, 2023
1 parent 93b2d51 commit 78c9794
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions tests/SpotifyWebAPITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,19 +318,19 @@ public function testChangeVolume()

public function testCreatePlaylist()
{
$userId = 'mcgurk';
$options = [
'name' => 'Test playlist',
'public' => false,
];
$userId = 'me';

$expected = json_encode($options);

$headers = ['Content-Type' => 'application/json'];
$return = ['body' => get_fixture('user-playlist')];
$api = $this->setupApi(
'POST',
'/v1/me/playlists',
'/v1/mcgurk/playlists',
$expected,
$headers,
$return
Expand All @@ -341,6 +341,30 @@ public function testCreatePlaylist()
$this->assertObjectHasAttribute('id', $response);
}

public function testCreatePlaylistDeprecatedOptions()
{
$options = [
'name' => 'Test playlist',
'public' => false,
];

$expected = json_encode($options);

$headers = ['Content-Type' => 'application/json'];
$return = ['body' => get_fixture('user-playlist')];
$api = $this->setupApi(
'POST',
'/v1/me/playlists',
$expected,
$headers,
$return
);

$response = $api->createPlaylist($options);

$this->assertObjectHasAttribute('id', $response);
}

public function testCurrentUserFollows()
{
$options = [
Expand Down Expand Up @@ -2266,20 +2290,20 @@ public function testSetAccessToken() {
$api = new SpotifyWebAPI\SpotifyWebAPI();
$returnedValue = $api->setAccessToken($this->accessToken);

$this->assertEquals($api, $returnedValue);
$this->assertEquals($api, $returnedValue);
}

public function testSetOptions() {
$api = new SpotifyWebAPI\SpotifyWebAPI();
$returnedValue = $api->setOptions([]);

$this->assertEquals($api, $returnedValue);
$this->assertEquals($api, $returnedValue);
}

public function testSetSession() {
$api = new SpotifyWebAPI\SpotifyWebAPI();
$returnedValue = $api->setSession($this->setupSessionStub());

$this->assertEquals($api, $returnedValue);
$this->assertEquals($api, $returnedValue);
}
}

0 comments on commit 78c9794

Please sign in to comment.