From 7adb008d0ab02dad3ccb5d167e349f33cb47924c Mon Sep 17 00:00:00 2001 From: Matt Young Date: Mon, 1 Jul 2024 13:00:36 -0500 Subject: [PATCH] Seat test --- database/factories/AuditionFactory.php | 2 +- tests/Feature/Models/SeatTest.php | 50 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/Models/SeatTest.php diff --git a/database/factories/AuditionFactory.php b/database/factories/AuditionFactory.php index 9fe13e5..9084a08 100644 --- a/database/factories/AuditionFactory.php +++ b/database/factories/AuditionFactory.php @@ -41,7 +41,7 @@ class AuditionFactory extends Factory return [ 'event_id' => $event->id, - 'name' => $this->faker->randomElement($instruments).$this->faker->randomNumber(3), + 'name' => $this->faker->randomElement($instruments).$this->faker->numberBetween(1, 1000), 'score_order' => $this->faker->numberBetween(2, 50), 'entry_deadline' => Carbon::tomorrow(), 'entry_fee' => 1000, diff --git a/tests/Feature/Models/SeatTest.php b/tests/Feature/Models/SeatTest.php new file mode 100644 index 0000000..2a4144e --- /dev/null +++ b/tests/Feature/Models/SeatTest.php @@ -0,0 +1,50 @@ +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); +});