auditionadmin/tests/Feature/app/Models/HistoricalSeatTest.php

22 lines
575 B
PHP

<?php
use App\Models\HistoricalSeat;
use App\Models\Student;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
beforeEach(function () {
$this->student = Student::factory()->create();
HistoricalSeat::create([
'student_id' => $this->student->id,
'year' => 8,
'seat_description' => 'First Seat',
]);
});
it('Returns its student', function () {
expect(HistoricalSeat::first()->student->id)->toEqual($this->student->id)
->and(HistoricalSeat::first()->student)->toBeInstanceOf(Student::class);
});