Create Model Event test
This commit is contained in:
parent
f95b89c7ac
commit
0c1a157a94
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Entry;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
it('only returns entries for seating with forSeating scope', function () {
|
||||
// Arrange
|
||||
Entry::factory()->advanceOnly()->create();
|
||||
$seatingEntry = Entry::factory()->create();
|
||||
|
||||
// Act & Assert
|
||||
expect(Entry::forSeating()->get())
|
||||
->toHaveCount(1)
|
||||
->first()->id->toEqual($seatingEntry->id);
|
||||
});
|
||||
|
||||
it('only returns entries for advancement with for forAdvancement scope', function () {
|
||||
// Arrange
|
||||
Entry::factory()->seatingOnly()->create();
|
||||
$advancementEntry = Entry::factory()->create();
|
||||
|
||||
// Act & Assert
|
||||
expect(Entry::forAdvancement()->get())
|
||||
->toHaveCount(1)
|
||||
->first()->id->toEqual($advancementEntry->id);
|
||||
});
|
||||
|
||||
it('only returns entries that do not have a declined, no-show, or failed-prelim flag with available scope',
|
||||
function () {
|
||||
// Arrange
|
||||
$availableEntry = Entry::factory()->create();
|
||||
$declinedEntry = Entry::factory()->create();
|
||||
$noShowEntry = Entry::factory()->create();
|
||||
$failedPrelimEntry = Entry::factory()->create();
|
||||
$declinedEntry->addFlag('declined');
|
||||
$noShowEntry->addFlag('no-show');
|
||||
$failedPrelimEntry->addFlag('failed-prelim');
|
||||
|
||||
// Act & Assert
|
||||
expect(Entry::available()->get())
|
||||
->toHaveCount(1)
|
||||
->first()->id->toEqual($availableEntry->id);
|
||||
|
||||
});
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Audition;
|
||||
use App\Models\Ensemble;
|
||||
use App\Models\Event;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
it('has auditions', function () {
|
||||
$event = Event::factory()->create();
|
||||
$ddAudition = Audition::factory()->create(['event_id' => $event->id, 'name' => 'Digereedoo']);
|
||||
Audition::factory()->count(7)->create(['event_id' => $event->id]);
|
||||
|
||||
expect($event->auditions->count())->toBe(8)
|
||||
->and($event->auditions->first()->name)->toBe('Digereedoo');
|
||||
});
|
||||
|
||||
it('has ensembles', function () {
|
||||
// Arrange
|
||||
$event = Event::factory()->create();
|
||||
$ensemble = Ensemble::factory()->create(['event_id' => $event->id, 'name' => 'Symphonic Concert Wind Band']);
|
||||
Ensemble::factory()->count(7)->create();
|
||||
// Act & Assert
|
||||
expect($event->ensembles->count())->toBe(1)
|
||||
->and($event->ensembles->first()->name)->toBe('Symphonic Concert Wind Band');
|
||||
|
||||
});
|
||||
Loading…
Reference in New Issue