feat: add success messages for cart item operations in CartController
This commit is contained in:
@@ -25,18 +25,18 @@ class AttachmentTest extends TestCase
|
||||
|
||||
$attachment = app(AttachmentService::class)->store(
|
||||
$file,
|
||||
'attachments/acme/logo.png',
|
||||
'attachments/acme',
|
||||
);
|
||||
|
||||
$this->assertSame(AttachmentType::Image, $attachment->type);
|
||||
$this->assertTrue(Str::isUuid($attachment->key));
|
||||
$this->assertSame('logo.png', $attachment->filename);
|
||||
$this->assertSame('attachments/acme/'.$attachment->key, $attachment->path);
|
||||
Storage::disk('s3')->assertExists('attachments/acme/'.$attachment->key);
|
||||
$this->assertSame('attachments/acme/'.$attachment->key.'.png', $attachment->path);
|
||||
Storage::disk('s3')->assertExists('attachments/acme/'.$attachment->key.'.png');
|
||||
$this->assertDatabaseHas('attachments', [
|
||||
'id' => $attachment->id,
|
||||
'key' => $attachment->key,
|
||||
'path' => 'attachments/acme/'.$attachment->key,
|
||||
'path' => 'attachments/acme/'.$attachment->key.'.png',
|
||||
'filename' => 'logo.png',
|
||||
'type' => AttachmentType::Image->value,
|
||||
]);
|
||||
@@ -55,13 +55,13 @@ class AttachmentTest extends TestCase
|
||||
->andReturn($disk);
|
||||
$disk->shouldReceive('putFileAs')
|
||||
->once()
|
||||
->with('attachments/globex', Mockery::type(UploadedFile::class), Mockery::on(static fn (string $value): bool => Str::isUuid($value)))
|
||||
->with('attachments/globex', Mockery::type(UploadedFile::class), Mockery::on(static fn (string $value): bool => Str::isUuid(pathinfo($value, PATHINFO_FILENAME))))
|
||||
->andReturn(false);
|
||||
|
||||
try {
|
||||
app(AttachmentService::class)->store(
|
||||
UploadedFile::fake()->create('manual.pdf', 10, 'application/pdf'),
|
||||
'attachments/globex/manual.pdf',
|
||||
'attachments/globex',
|
||||
);
|
||||
|
||||
$this->fail('Expected an AttachmentStorageException to be thrown.');
|
||||
|
||||
Reference in New Issue
Block a user