40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
use App\Models\Audition;
|
|
use App\Models\Entry;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\Feature\Models\ScoreSheet;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function () {
|
|
$this->judge = User::factory()->create();
|
|
$this->entry = Entry::factory()->create();
|
|
$this->scoreSheet = ScoreSheet::create([
|
|
'user_id' => $this->judge->id,
|
|
'entry_id' => $this->entry->id,
|
|
'subscores' => [
|
|
1 => ['score' => 10],
|
|
2 => ['score' => 20],
|
|
3 => ['score' => 30],
|
|
],
|
|
]);
|
|
});
|
|
|
|
it('has an entry', function () {
|
|
expect($this->scoreSheet->entry->id)->toBe($this->entry->id)
|
|
->and($this->scoreSheet->entry)->toBeInstanceOf(Entry::class);
|
|
});
|
|
|
|
it('has a judge', function () {
|
|
expect($this->scoreSheet->judge->id)->toBe($this->judge->id)
|
|
->and($this->scoreSheet->judge)->toBeInstanceOf(User::class);
|
|
});
|
|
|
|
it('has an audition', function () {
|
|
expect($this->scoreSheet->audition->id)->toBe($this->entry->audition->id)
|
|
->and($this->scoreSheet->audition)->toBeInstanceOf(Audition::class);
|
|
|
|
});
|