Create a Ladill folder when uploading a local folder and place files inside it.
Deploy Ladill Transfer / deploy (push) Successful in 27s
Deploy Ladill Transfer / deploy (push) Successful in 27s
Folder upload now names and creates the destination folder from the picked directory, uploads all files into it, and redirects to the new folder view. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -188,4 +188,41 @@ class TransferFilesTest extends TestCase
|
||||
$this->assertDatabaseHas('transfer_files', ['original_name' => 'icon.svg']);
|
||||
$this->assertDatabaseMissing('transfer_files', ['original_name' => 'red-logo/icon.svg']);
|
||||
}
|
||||
|
||||
public function test_folder_upload_creates_folder_with_files(): void
|
||||
{
|
||||
Storage::fake('qr');
|
||||
$this->fakeTransferBillingApi();
|
||||
|
||||
$user = $this->createUser();
|
||||
|
||||
$this->actingAs($user)
|
||||
->postJson(route('transfer.files.upload'), [
|
||||
'upload_folder_name' => 'Brand assets',
|
||||
'files' => [
|
||||
UploadedFile::fake()->create('logo.svg', 10, 'image/svg+xml'),
|
||||
UploadedFile::fake()->create('cover.png', 10, 'image/png'),
|
||||
],
|
||||
])
|
||||
->assertOk()
|
||||
->assertJsonPath('count', 2)
|
||||
->assertJsonPath('folder_id', fn ($id) => is_int($id));
|
||||
|
||||
$folder = Transfer::query()
|
||||
->where('user_id', $user->id)
|
||||
->where('is_folder', true)
|
||||
->where('title', 'Brand assets')
|
||||
->first();
|
||||
|
||||
$this->assertNotNull($folder);
|
||||
$this->assertSame(2, $folder->files()->count());
|
||||
$this->assertDatabaseHas('transfer_files', [
|
||||
'transfer_id' => $folder->id,
|
||||
'original_name' => 'logo.svg',
|
||||
]);
|
||||
$this->assertDatabaseHas('transfer_files', [
|
||||
'transfer_id' => $folder->id,
|
||||
'original_name' => 'cover.png',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user