feat(attachment): implement deletion of cropped attachments alongside original and update README
This commit is contained in:
@@ -140,6 +140,25 @@ class AttachmentTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function test_it_deletes_the_crop_together_with_its_original(): void
|
||||
{
|
||||
Storage::fake('s3');
|
||||
|
||||
$original = app(AttachmentService::class)->storeCroppedImage(
|
||||
UploadedFile::fake()->image('product.png'),
|
||||
'attachments/acme',
|
||||
10,
|
||||
10,
|
||||
);
|
||||
$cropped = $original->croppedAttachment;
|
||||
|
||||
app(AttachmentService::class)->delete($original);
|
||||
|
||||
$this->assertDatabaseCount('attachments', 0);
|
||||
Storage::disk('s3')->assertMissing($original->path);
|
||||
Storage::disk('s3')->assertMissing($cropped->path);
|
||||
}
|
||||
|
||||
public function test_it_deletes_from_s3_before_removing_the_database_record(): void
|
||||
{
|
||||
Storage::fake('s3');
|
||||
|
||||
Reference in New Issue
Block a user