Bugzilla – Attachment 183869 Details for
Bug 32934
SIP checkouts using "no block" flag have a calculated due rather than the specified due date
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32934: Unit tests
Bug-32934-Unit-tests.patch (text/plain), 5.07 KB, created by
Martin Renvoize (ashimema)
on 2025-07-08 15:28:07 UTC
(
hide
)
Description:
Bug 32934: Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-07-08 15:28:07 UTC
Size:
5.07 KB
patch
obsolete
>From 7d6f33ea465ac7b515764072f0f1878c34eb21b7 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Tue, 8 Jul 2025 12:53:16 +0100 >Subject: [PATCH] Bug 32934: Unit tests > >--- > .../Circulation/OfflineCirculation.t | 62 ++++++++++++++++--- > t/db_dependent/SIP/Transaction.t | 21 ++++++- > 2 files changed, 72 insertions(+), 11 deletions(-) > >diff --git a/t/db_dependent/Circulation/OfflineCirculation.t b/t/db_dependent/Circulation/OfflineCirculation.t >index ac74899d7b2..8d9afffd2d7 100755 >--- a/t/db_dependent/Circulation/OfflineCirculation.t >+++ b/t/db_dependent/Circulation/OfflineCirculation.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > > use Test::NoWarnings; >-use Test::More tests => 3; >+use Test::More tests => 4; > use Test::MockModule; > use Test::Warn; > >@@ -85,18 +85,21 @@ subtest "Bug 34529: Offline circulation should be able to accept userid as well > } > ); > >+ my ( $message, $checkout ) = ProcessOfflineIssue( >+ { >+ cardnumber => $borrower1->{cardnumber}, >+ barcode => $item1->barcode >+ } >+ ); >+ > is( >- ProcessOfflineIssue( >- { >- cardnumber => $borrower1->{cardnumber}, >- barcode => $item1->barcode >- } >- ), >- "Success.", >+ $message, "Success.", > "ProcessOfflineIssue succeeds with cardnumber" > ); >+ >+ ( $message, $checkout ) = ProcessOfflineIssue( { cardnumber => $borrower1->{userid}, barcode => $item2->barcode } ); > is( >- ProcessOfflineIssue( { cardnumber => $borrower1->{userid}, barcode => $item2->barcode } ), >+ $message, > "Success.", > "ProcessOfflineIssue succeeds with user id" > ); >@@ -192,9 +195,48 @@ subtest "Bug 30114 - Koha offline circulation will always cancel the next hold w > > my $op = GetOfflineOperation( $offline_rs->next->id ); > >- my $ret = ProcessOfflineOperation($op); >+ my ($ret) = ProcessOfflineOperation($op); > > is( Koha::Holds->search( { biblionumber => $biblionumber } )->count, 2, "Still found two holds for the record" ); > }; > >+subtest "Bug 32934: ProcessOfflineIssue returns checkout object for SIP no block due date" => sub { >+ plan tests => 4; >+ >+ $branch = $builder->build( { source => 'Branch' } )->{branchcode}; >+ $manager_id = $builder->build( { source => 'Borrower' } )->{borrowernumber}; >+ >+ my $borrower = $builder->build( >+ { >+ source => 'Borrower', >+ value => { branchcode => $branch } >+ } >+ ); >+ >+ my $biblio = $builder->build_sample_biblio; >+ my $item = $builder->build_sample_item( >+ { >+ biblionumber => $biblio->id, >+ library => $branch, >+ } >+ ); >+ >+ my $due_date = dt_from_string->add( days => 7 )->ymd; >+ >+ # Test ProcessOfflineIssue returns both message and checkout object >+ my ( $message, $checkout ) = ProcessOfflineIssue( >+ { >+ cardnumber => $borrower->{cardnumber}, >+ barcode => $item->barcode, >+ due_date => $due_date, >+ timestamp => dt_from_string >+ } >+ ); >+ >+ is( $message, "Success.", "ProcessOfflineIssue returns success message" ); >+ isa_ok( $checkout, 'Koha::Checkout', "ProcessOfflineIssue returns checkout object" ); >+ is( $checkout->borrowernumber, $borrower->{borrowernumber}, "Checkout has correct borrower" ); >+ is( dt_from_string( $checkout->date_due )->ymd, $due_date, "Checkout respects specified due_date" ); >+}; >+ > $schema->storage->txn_rollback; >diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t >index a07033def5b..b121b9c7c42 100755 >--- a/t/db_dependent/SIP/Transaction.t >+++ b/t/db_dependent/SIP/Transaction.t >@@ -983,7 +983,7 @@ subtest do_checkout_with_patron_blocked => sub { > }; > > subtest do_checkout_with_noblock => sub { >- plan tests => 1; >+ plan tests => 3; > > my $mockILS = Test::MockObject->new; > my $server = { ils => $mockILS }; >@@ -1033,6 +1033,25 @@ subtest do_checkout_with_noblock => sub { > $patron->checkouts->count, > 1, 'No Block checkout was performed for debarred patron' > ); >+ >+ # Test Bug 32934: SIP checkout with no_block_due_date should honor the specified due date >+ $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); >+ my $sip_item_2 = C4::SIP::ILS::Item->new( $item->barcode ); >+ my $transaction = C4::SIP::ILS::Transaction::Checkout->new(); >+ >+ $transaction->patron($sip_patron); >+ $transaction->item($sip_item_2); >+ >+ # Set no_block_due_date to test the fix (YYYYMMDDZZZZHHMMSS) >+ my $expected_due_date = '20250115 000000'; >+ my $checkout_result = $transaction->do_checkout( undef, $expected_due_date ); >+ >+ my $checkout_obj = $patron->checkouts->find( { itemnumber => $item->itemnumber } ); >+ isnt( $checkout_obj, undef, 'Checkout object exists after no block checkout' ); >+ like( >+ dt_from_string( $checkout_obj->date_due )->ymd(''), qr/^20250115/, >+ 'No block due date is honored in SIP checkout' >+ ); > }; > > subtest do_checkout_with_holds => sub { >-- >2.50.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 32934
:
146450
|
146467
|
162737
|
172389
|
172399
|
172566
|
172567
|
183857
|
183858
| 183869 |
183870