34 lines
919 B
PHP
34 lines
919 B
PHP
<?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);
|
|
});
|