Add extensive controller and model tests
All checks were successful
CI/CD Pipeline / test (push) Successful in 10s
CI/CD Pipeline / deploy (push) Successful in 25s

This commit is contained in:
2026-02-07 22:14:42 +01:00
parent 9c60a8944e
commit 160430e128
39 changed files with 3941 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
<?php
use App\Models\AttachmentExtension;
use App\Models\AttachmentGroup;
it('exposes attachment group hierarchy and extensions', function (): void {
$parent = AttachmentGroup::create([
'name' => 'Parent',
'max_size_kb' => 100,
'is_active' => true,
]);
$child = AttachmentGroup::create([
'name' => 'Child',
'parent_id' => $parent->id,
'position' => 1,
'max_size_kb' => 100,
'is_active' => true,
]);
$extension = AttachmentExtension::create([
'extension' => 'png',
'attachment_group_id' => $parent->id,
'allowed_mimes' => ['image/png'],
]);
$parent->load(['children', 'extensions']);
$child->load('parent');
expect($parent->children->first()->id)->toBe($child->id);
expect($parent->extensions->first()->id)->toBe($extension->id);
expect($child->parent?->id)->toBe($parent->id);
});