Create tests for app/Models/NominationEnsembleEntry
This commit is contained in:
parent
1c918cd559
commit
962a5a109f
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\NominationEnsemble;
|
||||||
|
use App\Models\NominationEnsembleEntry;
|
||||||
|
use App\Models\Student;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
|
||||||
|
uses(RefreshDatabase::class);
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
$this->ensemble = NominationEnsemble::create([
|
||||||
|
'name' => 'Test Ensemble',
|
||||||
|
'entry_deadline' => '2024-01-01',
|
||||||
|
'minimum_grade' => '5',
|
||||||
|
'maximum_grade' => '15',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->student = Student::factory()->create();
|
||||||
|
|
||||||
|
$this->entry = NominationEnsembleEntry::create([
|
||||||
|
'student_id' => $this->student->id,
|
||||||
|
'nomination_ensemble_id' => $this->ensemble->id,
|
||||||
|
'data' => json_encode(['test' => 'test']),
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can return its ensemble', function () {
|
||||||
|
expect($this->entry->ensemble->id)->toEqual($this->ensemble->id)
|
||||||
|
->and($this->entry->ensemble)->toBeInstanceOf(NominationEnsemble::class);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can return its student', function () {
|
||||||
|
expect($this->entry->student->id)->toEqual($this->student->id)
|
||||||
|
->and($this->entry->student)->toBeInstanceOf(Student::class);
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue