Write tests - Write tests for what was done to this point that will be kept #11
|
|
@ -41,7 +41,7 @@ class AuditionFactory extends Factory
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'event_id' => $event->id,
|
'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),
|
'score_order' => $this->faker->numberBetween(2, 50),
|
||||||
'entry_deadline' => Carbon::tomorrow(),
|
'entry_deadline' => Carbon::tomorrow(),
|
||||||
'entry_fee' => 1000,
|
'entry_fee' => 1000,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\Audition;
|
||||||
|
use App\Models\Ensemble;
|
||||||
|
use App\Models\Entry;
|
||||||
|
use App\Models\Event;
|
||||||
|
use App\Models\Seat;
|
||||||
|
use App\Models\Student;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
|
||||||
|
uses(RefreshDatabase::class);
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
$this->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);
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue