38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?php
|
|
|
|
use App\Models\Audition;
|
|
use App\Models\Ensemble;
|
|
use App\Models\Entry;
|
|
use App\Models\Event;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function () {
|
|
$this->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);
|
|
});
|