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')); } }