Bugzilla – Attachment 162407 Details for
Bug 35944
Bookings is not taken into account in CanBookBeRenewed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35944: Unit tests
Bug-35944-Unit-tests.patch (text/plain), 2.26 KB, created by
Martin Renvoize (ashimema)
on 2024-02-25 11:15:25 UTC
(
hide
)
Description:
Bug 35944: Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-02-25 11:15:25 UTC
Size:
2.26 KB
patch
obsolete
>From 86934b14df5809c08762e162320a5ff2fb77065b Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 20 Feb 2024 18:04:49 +0000 >Subject: [PATCH] Bug 35944: Unit tests > >--- > t/db_dependent/Circulation.t | 38 +++++++++++++++++++++++++++++++++++- > 1 file changed, 37 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index c5d0b2a60b2..e9af7f21215 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 69; >+use Test::More tests => 70; > use Test::Exception; > use Test::MockModule; > use Test::Deep qw( cmp_deeply ); >@@ -1690,6 +1690,42 @@ subtest "CanBookBeRenewed tests" => sub { > $recall->set_cancelled; > }; > >+subtest "CanBookBeRenewed | bookings" => sub { >+ plan tests => 3; >+ >+ my $schema = Koha::Database->schema; >+ $schema->storage->txn_begin; >+ >+ t::lib::Mocks::mock_preference('RenewalPeriodBase', 'date_due'); >+ >+ my $renewing_patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $booked_patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $item = $builder->build_sample_item( { bookable => 1 } ); >+ >+ # issue >+ my $issue = AddIssue( $renewing_patron, $item->barcode ); >+ my $datedue = dt_from_string( $issue->date_due() ); >+ is( defined $issue->date_due(), 1, "Item checked out, due date: " . $issue->date_due() ); >+ >+ # item-level booking >+ my $booking = Koha::Booking->new( >+ { >+ patron_id => $booked_patron->borrowernumber, >+ item_id => $item->itemnumber, >+ biblio_id => $item->biblio->biblionumber, >+ start_date => $datedue->clone()->add( days => 2 ), >+ end_date => $datedue->clone()->add( days => 10 ), >+ } >+ )->store(); >+ >+ # Proposed renewal would encroach on booking >+ my ( $renewok, $error ) = CanBookBeRenewed( $renewing_patron, $issue, 0 ); >+ is( $renewok, 0, "Renewal not allowed as it would mean the item was not returned before the next booking" ); >+ is( $error, 'booked', "Error is 'booked'" ); >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest "GetUpcomingDueIssues" => sub { > plan tests => 12; > >-- >2.43.2
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 35944
:
162407
|
162408
|
162417
|
162418
|
162423
|
162424
|
163201
|
163202
|
163203
|
163204
|
163205
|
163206
|
163208
|
163209
|
163210
|
163211
|
163212
|
163213