mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
Add song scrobble test
This commit is contained in:
parent
efe8b937d2
commit
e5f77399fd
1 changed files with 17 additions and 0 deletions
|
@ -203,4 +203,21 @@ class LastfmTest extends TestCase
|
|||
|
||||
(new UpdateLastfmNowPlaying($lastfm))->handle(new SongStartedPlaying($song, $user));
|
||||
}
|
||||
|
||||
public function testScrobble()
|
||||
{
|
||||
$this->withoutEvents();
|
||||
$this->createSampleMediaSet();
|
||||
|
||||
$user = factory(User::class)->create(['preferences' => ['lastfm_session_key' => 'bar']]);
|
||||
$song = Song::first();
|
||||
|
||||
$ts = time();
|
||||
|
||||
$lastfm = m::mock(Lastfm::class, ['enabled' => true]);
|
||||
$lastfm->shouldReceive('scrobble')
|
||||
->with($song->album->artist->name, $song->title, $ts, $song->album->name, 'bar');
|
||||
|
||||
$this->post("/api/{$song->id}/scrobble/$ts");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue