@SilenceBringer
/** @test */
public function can_store_faculty(): void{
$data = $this->validFormData();
$this->post(uri: route('administration.faculties.store'), data: $data);
$this->assertDatabaseHas('faculties', [...$data,
'letter_grades' => $this->castAsJson($data['letter_grades']),
'description_grades' => $this->castAsJson($data['description_grades']),
'final_subject_ids' => $this->castAsJson($data['final_subject_ids'])
]);
}
My test looks like this, it is pretty basic but these JSON fields seem to be an issue, and I do need them so I can't rid of them.
The model that I'm testing looks like this
protected $fillable = [
'name', 'short_name', 'summary', 'registration_number', 'dean', 'phone', 'fax', 'email', 'website', 'logo', 'status', 'institution_id', 'days_before_locking',
'first_cycle_type', 'min_class_percentage', 'min_test_percentage', 'min_homework_percentage', 'show_test_registration', 'description_grades', 'letter_grades',
'name_en', 'final_subject_ids', 'practice_subject_id', 'referent_name_first_cycle', 'referent_name_second_cycle', 'referent_name_third_cycle'
];
protected $dates = ['deleted_at'];
protected $casts = [
'letter_grades' => 'array',
'description_grades' => 'array',
'final_subject_ids' => 'array'
];
So everything is pretty simple at the moment, but this model gives me trouble.