withoutEvents(); $this->createSampleMediaSet(); $song = Song::first(); /** @var User $user */ $user = factory(User::class)->create(); $user->setPreference('lastfm_session_key', 'foo'); $ts = time(); $this->mockIocDependency(LastfmService::class) ->shouldReceive('scrobble') ->with($song->album->artist->name, $song->title, $ts, $song->album->name, 'foo') ->once(); $this->postAsUser("/api/{$song->id}/scrobble/$ts", [], $user) ->assertResponseOk(); } }