47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?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);
|
|
|
|
});
|