Files
ladill-pos/tests/Feature/SearchTest.php
T
isaaccladandCursor e5d2b84388
Deploy Ladill Mini / deploy (push) Successful in 23s
Add Ladill POS v1 — register, Pay checkout, and commerce links.
Staff-facing counter register at pos.ladill.com with catalog cart, cash and
MoMo/card checkout via Ladill Pay, CRM timeline/import, invoice prefill, and
Merchant catalog import.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 22:52:24 +00:00

65 lines
1.8 KiB
PHP

<?php
namespace Tests\Feature;
use App\Models\MiniPayment;
use App\Models\QrCode;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Str;
use Tests\TestCase;
class SearchTest extends TestCase
{
use RefreshDatabase;
private function user(): User
{
return User::create(['public_id' => (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,
]);
MiniPayment::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' => MiniPayment::STATUS_PAID,
'paid_at' => now(),
]);
$response = $this->actingAs($user)
->getJson(route('mini.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('mini.search'))
->assertOk()
->assertSee('Find payments', false);
}
}