feat(tenant): share website type favicon attachment
This commit is contained in:
@@ -69,4 +69,31 @@ class WebsiteTypeServiceTest extends TestCase
|
||||
'favicon_id' => $favicon->id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_it_keeps_a_shared_favicon_when_one_website_type_replaces_it(): void
|
||||
{
|
||||
Storage::fake('s3');
|
||||
|
||||
$service = app(WebsiteTypeService::class);
|
||||
$shopIt = $service->create([
|
||||
'codigo' => 'shopit',
|
||||
'nombre' => 'ShopIt',
|
||||
'favicon' => UploadedFile::fake()->image('shared-favicon.png', 32, 32),
|
||||
]);
|
||||
$sharedFavicon = $shopIt->favicon()->firstOrFail();
|
||||
$onTicket = $service->create([
|
||||
'codigo' => 'onticket',
|
||||
'nombre' => 'OnTicket',
|
||||
'favicon' => $sharedFavicon->key,
|
||||
]);
|
||||
|
||||
$service->updateOrCreate(
|
||||
['codigo' => 'shopit'],
|
||||
['favicon' => UploadedFile::fake()->image('shopit-favicon.png', 32, 32)],
|
||||
);
|
||||
|
||||
$this->assertSame($sharedFavicon->id, $onTicket->fresh()->favicon_id);
|
||||
$this->assertDatabaseHas('attachments', ['id' => $sharedFavicon->id]);
|
||||
Storage::disk('s3')->assertExists($sharedFavicon->path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user