user = factory(User::class)->create(['preferences' => ['lastfm_session_key' => 'foo']]); $this->interaction = factory(Interaction::class)->make(); $this->job = new LoveTrackOnLastfmJob($this->user, $this->interaction); } public function testHandle(): void { $lastFm = Mockery::mock(LastfmService::class); $lastFm->shouldReceive('toggleLoveTrack') ->once() ->with( $this->interaction->song->title, $this->interaction->song->artist->name, 'foo', $this->interaction->liked ); $this->job->handle($lastFm); } }