From 50cefdc05d07b3aad8de120db728c9d1307f2a1c Mon Sep 17 00:00:00 2001 From: Matt Young Date: Thu, 3 Jul 2025 14:33:29 -0500 Subject: [PATCH] Create tests for app/Models/HistoricalSeat --- app/Models/HistoricalSeat.php | 3 --- .../Actions/Tabulation/HistoricalSeatTest.php | 21 +++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 tests/Feature/app/Actions/Tabulation/HistoricalSeatTest.php diff --git a/app/Models/HistoricalSeat.php b/app/Models/HistoricalSeat.php index 7403cff..916ea6d 100644 --- a/app/Models/HistoricalSeat.php +++ b/app/Models/HistoricalSeat.php @@ -2,14 +2,11 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; class HistoricalSeat extends Model { - use HasFactory; - protected $guarded = []; public function student(): BelongsTo diff --git a/tests/Feature/app/Actions/Tabulation/HistoricalSeatTest.php b/tests/Feature/app/Actions/Tabulation/HistoricalSeatTest.php new file mode 100644 index 0000000..5cf6ae6 --- /dev/null +++ b/tests/Feature/app/Actions/Tabulation/HistoricalSeatTest.php @@ -0,0 +1,21 @@ +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); +});