mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
Simplify Playlist test
This commit is contained in:
parent
aff2c9f9d2
commit
e359c96a7a
1 changed files with 4 additions and 5 deletions
|
@ -23,12 +23,11 @@ class PlaylistTest extends TestCase
|
|||
|
||||
// Let's create a playlist with 3 songs
|
||||
$songs = Song::orderBy('id')->take(3)->get();
|
||||
$songIds = array_pluck($songs->toArray(), 'id');
|
||||
|
||||
$this->actingAs($user)
|
||||
->post('api/playlist', [
|
||||
'name' => 'Foo Bar',
|
||||
'songs' => $songIds,
|
||||
'songs' => $songs->pluck('id')->toArray(),
|
||||
]);
|
||||
|
||||
$this->seeInDatabase('playlists', [
|
||||
|
@ -89,19 +88,19 @@ class PlaylistTest extends TestCase
|
|||
]);
|
||||
|
||||
$songs = Song::orderBy('id')->take(4)->get();
|
||||
$playlist->songs()->attach(array_pluck($songs->toArray(), 'id'));
|
||||
$playlist->songs()->attach($songs->pluck('id')->toArray());
|
||||
|
||||
$removedSong = $songs->pop();
|
||||
|
||||
$this->actingAs($user2)
|
||||
->put("api/playlist/{$playlist->id}/sync", [
|
||||
'songs' => array_pluck($songs->toArray(), 'id'),
|
||||
'songs' => $songs->pluck('id')->toArray(),
|
||||
])
|
||||
->seeStatusCode(403);
|
||||
|
||||
$this->actingAs($user)
|
||||
->put("api/playlist/{$playlist->id}/sync", [
|
||||
'songs' => array_pluck($songs->toArray(), 'id'),
|
||||
'songs' => $songs->pluck('id')->toArray(),
|
||||
]);
|
||||
|
||||
// We should still see the first 3 songs, but not the removed one
|
||||
|
|
Loading…
Reference in a new issue