Bugzilla – Attachment 191288 Details for
Bug 40445
Point of Sale reconciliation input during daily summaries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40445: (follow-up) Update tests for zero amount cashups
45a8e2d.patch (text/plain), 2.25 KB, created by
Martin Renvoize (ashimema)
on 2026-01-12 15:43:12 UTC
(
hide
)
Description:
Bug 40445: (follow-up) Update tests for zero amount cashups
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-01-12 15:43:12 UTC
Size:
2.25 KB
patch
obsolete
>From 45a8e2d8da8b1a82c41f3c17d93dc9facc465c3f Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Mon, 12 Jan 2026 15:15:25 +0000 >Subject: [PATCH] Bug 40445: (follow-up) Update tests for zero amount cashups > >The previous commit changed add_cashup() to allow amount=0 (for >non-cash transaction scenarios like Card-only payments), but the >tests still expected amount=0 to be rejected. > >This patch updates the test expectations: > >1. Changed the 'invalid_amount' subtest to accept zero amounts as > valid instead of expecting an exception >2. Added verification that zero amounts are stored correctly >3. Updated test plan count from 4 to 6 tests (added zero amount > verification test) >4. Updated test description and comments to reflect the new behavior > >The zero amount scenario is now valid for cashups where there are >only non-cash transactions (Card, Bank Transfer, etc.) and no >physical cash to count or remove from the register. >--- > t/db_dependent/Koha/Cash/Register.t | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/Koha/Cash/Register.t b/t/db_dependent/Koha/Cash/Register.t >index 3aab7e5d3a4..99684617a6e 100755 >--- a/t/db_dependent/Koha/Cash/Register.t >+++ b/t/db_dependent/Koha/Cash/Register.t >@@ -1377,16 +1377,17 @@ subtest 'add_cashup' => sub { > > # Test 3: Invalid amount parameter > subtest 'invalid_amount' => sub { >- plan tests => 4; >+ plan tests => 6; > > my $register3 = $builder->build_object( { class => 'Koha::Cash::Registers' } ); > >- # Zero amount >- throws_ok { >- $register3->add_cashup( { manager_id => $manager->id, amount => '0.00' } ); >+ # Zero amount is now valid (for non-cash transaction scenarios) >+ my $zero_cashup; >+ lives_ok { >+ $zero_cashup = $register3->add_cashup( { manager_id => $manager->id, amount => '0.00' } ); > } >- 'Koha::Exceptions::Account::AmountNotPositive', >- 'Zero amount throws AmountNotPositive exception'; >+ 'Zero amount is accepted for non-cash transaction scenarios'; >+ is( $zero_cashup->amount + 0, 0, 'Zero amount stored correctly' ); > > # Negative amount is now valid (for float deficits) > my $negative_cashup; >-- >2.52.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40445
:
185289
|
185290
|
185291
|
185292
|
185809
|
186636
|
186637
|
186638
|
186639
|
186640
|
186641
|
186642
|
186643
|
189333
|
189334
|
189335
|
189336
|
189337
|
189338
|
189339
|
189340
|
189341
|
189353
|
189354
|
189355
|
189356
|
189357
|
189358
|
189359
|
189360
|
189361
|
189362
|
189363
|
189364
|
189410
|
189411
|
189412
|
189413
|
189414
|
189415
|
189420
|
189421
|
189422
|
189423
|
189424
|
189425
|
189426
|
189427
|
189428
|
189429
|
189430
|
189476
|
189477
|
189478
|
189479
|
189480
|
189481
|
189482
|
190361
|
190362
|
190363
|
190364
|
190365
|
190366
|
190367
|
190368
|
190369
|
190370
|
190371
|
190372
|
190373
|
190374
|
190375
|
190376
|
190379
|
190380
|
190388
|
190389
|
190404
|
190405
|
190406
|
190407
|
190408
|
190409
|
190410
|
190411
|
190412
|
190413
|
190414
|
190415
|
191273
|
191274
|
191275
|
191276
|
191277
|
191278
|
191279
|
191280
|
191281
|
191282
|
191283
|
191284
|
191285
|
191286
|
191287
|
191288
|
193123
|
193124
|
193125
|
193126
|
193127
|
193128
|
193129
|
193130
|
193131
|
193132
|
193133
|
193134
|
193135
|
193136
|
193137
|
193138
|
193139
|
193140
|
193141
|
193180
|
193181
|
193182
|
193183