Bugzilla – Attachment 163208 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.30 KB, created by
Nick Clemens (kidclamp)
on 2024-03-15 11:47:45 UTC
(
hide
)
Description:
Bug 35944: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-03-15 11:47:45 UTC
Size:
2.30 KB
patch
obsolete
>From 05bcbf39fc951562ed31c59bf6e3ccbce728adf7 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 > >Signed-off-by: David Nind <david@davidnind.com> >--- > 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 8dd246578f2..d1581350957 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 ); >@@ -1733,6 +1733,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.30.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