Files
isaaccladandCursor 19170d6bc7
Deploy Ladill Transfer / deploy (push) Successful in 29s
Add transfer search and OneDrive-style Files storage UI.
Transfers now lists all shares with filters and pagination; Files becomes a selectable cloud view with download, share, delete, move, and open-in-email actions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-08 20:59:05 +00:00

73 lines
2.3 KiB
PHP

<?php
namespace Tests\Feature;
use App\Models\Transfer;
use App\Models\TransferFile;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Tests\Concerns\FakesTransferBilling;
use Tests\TestCase;
class TransferSearchTest extends TestCase
{
use FakesTransferBilling;
use RefreshDatabase;
public function test_transfers_index_can_be_searched(): void
{
Storage::fake('qr');
$this->fakeTransferBillingApi();
$user = User::create([
'public_id' => (string) Str::uuid(),
'name' => 'Test User',
'email' => 'transfer+'.uniqid().'@example.com',
]);
$this->actingAs($user)->post(route('transfer.transfers.store'), [
'title' => 'Marketing assets',
'files' => [UploadedFile::fake()->create('logo.png', 50, 'image/png')],
])->assertRedirect();
$this->actingAs($user)->post(route('transfer.transfers.store'), [
'title' => 'Finance reports',
'files' => [UploadedFile::fake()->create('report.pdf', 50, 'application/pdf')],
])->assertRedirect();
$this->actingAs($user)
->get(route('transfer.transfers.index', ['q' => 'Marketing']))
->assertOk()
->assertSee('Marketing assets')
->assertDontSee('Finance reports');
}
public function test_global_search_returns_transfers_and_files(): void
{
Storage::fake('qr');
$this->fakeTransferBillingApi();
$user = User::create([
'public_id' => (string) Str::uuid(),
'name' => 'Test User',
'email' => 'transfer+'.uniqid().'@example.com',
]);
$this->actingAs($user)->post(route('transfer.transfers.store'), [
'title' => 'Brand kit',
'files' => [UploadedFile::fake()->create('cover.psd', 50, 'application/octet-stream')],
])->assertRedirect();
$response = $this->actingAs($user)
->getJson(route('transfer.search', ['q' => 'cover']))
->assertOk();
$results = $response->json('results');
$this->assertNotEmpty($results);
$this->assertTrue(collect($results)->contains(fn ($item) => $item['type'] === 'file'));
}
}