withoutEvents(); /** @var User $user */ $user = User::factory()->create(); /** @var Song $song */ $song = Song::factory()->create(); $timestamp = time(); self::mock(LastfmService::class) ->shouldReceive('scrobble') ->with($song->album->artist->name, $song->title, $timestamp, $song->album->name, $user->lastfm_session_key) ->once(); $this->postAsUser("/api/$song->id/scrobble", ['timestamp' => $timestamp], $user) ->assertNoContent(); } }