Files
ladill-mini/tests/Unit/Services/Qr/PaymentQrUpdateTest.php
T
isaaccladandCursor 99dae20743
Deploy Ladill Mini / deploy (push) Successful in 40s
Fix payment QR edits and mobile payment sheet keyboard gap.
Persist payment QR business fields on update, handle is_active correctly, and keep the amount bottom sheet flush to the screen while moving with the keyboard on iOS.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-07 23:16:55 +00:00

58 lines
1.7 KiB
PHP

<?php
namespace Tests\Unit\Services\Qr;
use App\Models\QrCode;
use App\Models\User;
use App\Services\Qr\QrCodeManagerService;
use App\Services\Qr\QrImageGeneratorService;
use App\Services\Qr\QrPayloadValidator;
use App\Services\Qr\QrWalletBillingService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Str;
use Tests\TestCase;
class PaymentQrUpdateTest extends TestCase
{
use RefreshDatabase;
public function test_payment_qr_update_persists_business_fields(): void
{
$user = User::create([
'public_id' => (string) Str::uuid(),
'name' => 'Trader',
'email' => 'trader@example.com',
]);
$qrCode = QrCode::create([
'user_id' => $user->id,
'short_code' => 'paytest01',
'type' => QrCode::TYPE_PAYMENT,
'label' => 'Till 1',
'payload' => [
'content' => [
'business_name' => 'Old Shop',
'branch_label' => 'Main',
'currency' => 'GHS',
],
'style' => [],
],
'is_active' => true,
]);
$manager = new QrCodeManagerService(
$this->createMock(QrWalletBillingService::class),
$this->createMock(QrImageGeneratorService::class),
new QrPayloadValidator(),
);
$updated = $manager->update($qrCode, [
'business_name' => 'New Shop',
'branch_label' => 'Accra Mall',
]);
$this->assertSame('New Shop', $updated->content()['business_name']);
$this->assertSame('Accra Mall', $updated->content()['branch_label']);
}
}