user = User::factory()->create(['preferences' => ['lastfm_session_key' => 'foo']]); $this->interaction = Interaction::factory()->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); } }