auditionadmin/tests-old/Feature/Models/SeatTest.php

51 lines
1.5 KiB
PHP

<?php
use App\Models\Audition;
use App\Models\Ensemble;
use App\Models\Entry;
use App\Models\Event;
use App\Models\Seat;
use App\Models\Student;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
beforeEach(function () {
$this->event = Event::factory()->create();
$this->audition = Audition::factory()->create([
'event_id' => $this->event->id,
]);
$this->ensemble = Ensemble::factory()->create([
'event_id' => $this->event->id,
]);
$this->entry = Entry::factory()->create([
'audition_id' => $this->audition->id,
]);
$this->seat = Seat::create([
'ensemble_id' => $this->ensemble->id,
'audition_id' => $this->audition->id,
'seat' => '1',
'entry_id' => $this->entry->id,
]);
});
it('has an ensemble', function () {
expect($this->seat->ensemble->name)->toBe($this->ensemble->name)
->and($this->seat->ensemble)->toBeInstanceOf(Ensemble::class);
});
it('has an audition', function () {
expect($this->seat->audition->name)->toBe($this->audition->name)
->and($this->seat->audition)->toBeInstanceOf(Audition::class);
});
it('has an entry', function () {
expect($this->seat->entry->student->first_name)->toBe($this->entry->student->first_name)
->and($this->seat->entry)->toBeInstanceOf(Entry::class);
});
it('has a student', function () {
expect($this->seat->student->first_name)->toBe($this->entry->student->first_name)
->and($this->seat->student)->toBeInstanceOf(Student::class);
});