From f12dd416d74767a0c0742681ac0cc3e9b7d179fc Mon Sep 17 00:00:00 2001 From: Matt Young Date: Thu, 3 Jul 2025 14:29:01 -0500 Subject: [PATCH] Create tests for app/Models/Event --- tests/Feature/app/Models/EventTest.php | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/Feature/app/Models/EventTest.php diff --git a/tests/Feature/app/Models/EventTest.php b/tests/Feature/app/Models/EventTest.php new file mode 100644 index 0000000..dde601b --- /dev/null +++ b/tests/Feature/app/Models/EventTest.php @@ -0,0 +1,37 @@ +event = Event::factory()->create(); + $this->audition1 = Audition::factory()->create(['event_id' => $this->event->id, 'minimum_grade' => 1, + 'maximum_grade' => 15, + ]); + $this->audition2 = Audition::factory()->create(['event_id' => $this->event->id, 'minimum_grade' => 1, + 'maximum_grade' => 15, + ]); + $this->ensemble = Ensemble::factory()->create(['event_id' => $this->event->id]); + Entry::factory()->count(3)->create(['audition_id' => $this->audition1->id]); + Entry::factory()->count(5)->create(['audition_id' => $this->audition2->id]); +}); + +it('can return its auditions', function () { + expect($this->event->auditions()->count())->toEqual(2) + ->and($this->event->auditions()->first())->toBeInstanceOf(Audition::class); +}); + +it('can return its ensembles', function () { + expect($this->event->ensembles()->count())->toEqual(1) + ->and($this->event->ensembles()->first())->toBeInstanceOf(Ensemble::class); +}); + +it('can return its entries', function () { + expect($this->event->entries()->count())->toEqual(8) + ->and($this->event->entries()->first())->toBeInstanceOf(Entry::class); +});