39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
use App\Models\Audition;
|
|
use App\Models\BonusScore;
|
|
use App\Models\BonusScoreDefinition;
|
|
use App\Models\Entry;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function () {
|
|
$this->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);
|
|
});
|