(string) Str::uuid(), 'name' => 'A', 'email' => 'a+'.uniqid().'@x.com']); } public function test_user_can_search_payments_by_payer_name(): void { $user = $this->user(); $qr = QrCode::query()->create([ 'user_id' => $user->id, 'short_code' => 'till01', 'type' => QrCode::TYPE_PAYMENT, 'label' => 'Main till', 'destination_url' => 'https://example.com', 'is_active' => true, ]); QrSaleOrder::query()->create([ 'qr_code_id' => $qr->id, 'user_id' => $user->id, 'reference' => 'pay-'.Str::uuid(), 'amount_minor' => 5000, 'currency' => 'GHS', 'platform_fee_minor' => 250, 'merchant_amount_minor' => 4750, 'payer_name' => 'Ama Mensah', 'status' => QrSaleOrder::STATUS_PAID, 'paid_at' => now(), ]); $response = $this->actingAs($user) ->getJson(route('merchant.search', ['q' => 'Ama'])); $response->assertOk(); $response->assertJsonPath('results.0.type', 'payment'); $response->assertJsonPath('results.0.title', 'Ama Mensah'); } public function test_search_page_renders_for_authenticated_user(): void { $user = $this->user(); $this->actingAs($user) ->get(route('merchant.search')) ->assertOk() ->assertSee('Find payments', false); } }