audition = Audition::factory()->create(); $this->judge = User::factory()->create(); $this->bonusScoreDefinition = BonusScoreDefinition::factory()->create(); $this->bonusScoreDefinition->auditions()->attach($this->audition); $this->bonusScoreDefinition->judges()->attach($this->judge); $this->entry = Entry::factory()->create(['audition_id' => $this->audition->id]); DB::table('bonus_scores')->insert([ 'entry_id' => $this->entry->id, 'user_id' => $this->judge->id, 'originally_scored_entry' => $this->entry->id, 'score' => 28, ]); }); it('can return its entry', function () { expect(BonusScore::first()->entry->id)->toEqual($this->entry->id); }); it('can return its judge', function () { expect(BonusScore::first()->judge->id)->toEqual($this->judge->id); }); it('can return its originally scored entry', function () { expect(BonusScore::first()->originallyScoredEntry->id)->toEqual($this->entry->id); });