Bugzilla – Attachment 152388 Details for
Bug 33887
Automatic checkin should be able to optionally fill the next hold with the returned item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33887: Unit tests
Bug-33887-Unit-tests.patch (text/plain), 2.98 KB, created by
Nick Clemens (kidclamp)
on 2023-06-15 15:37:35 UTC
(
hide
)
Description:
Bug 33887: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-06-15 15:37:35 UTC
Size:
2.98 KB
patch
obsolete
>From 5c5862e5d8be08ea662f5bbb274abf0dee73776c Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 15 Jun 2023 15:32:58 +0000 >Subject: [PATCH] Bug 33887: Unit tests > >prove -v t/db_dependent/Koha/Checkouts.t >--- > t/db_dependent/Koha/Checkouts.t | 51 ++++++++++++++++++++++++++++++++- > 1 file changed, 50 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Checkouts.t b/t/db_dependent/Koha/Checkouts.t >index 4373904142..c3801d532e 100755 >--- a/t/db_dependent/Koha/Checkouts.t >+++ b/t/db_dependent/Koha/Checkouts.t >@@ -22,9 +22,11 @@ use Modern::Perl; > use Test::More tests => 11; > > use C4::Circulation qw( MarkIssueReturned AddReturn ); >+use C4::Reserves qw( AddReserve ); > use Koha::Checkouts; > use Koha::Database; > use Koha::DateUtils qw( dt_from_string ); >+use Koha::Holds; > > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -296,7 +298,7 @@ $schema->storage->txn_rollback; > > subtest 'automatic_checkin' => sub { > >- plan tests => 9; >+ plan tests => 10; > > $schema->storage->txn_begin; > >@@ -405,5 +407,52 @@ subtest 'automatic_checkin' => sub { > $searched = Koha::Old::Checkouts->find( $checkout_odue_aci->issue_id ); > is( dt_from_string($searched->returndate), $yesterday, 'old checkout for odue_ac_item has the right return date' ); > >+ >+ subtest 'automatic_checkin AutomaticCheckinAutoFill tests' => sub { >+ >+ plan tests => 2; >+ >+ my $checkout_2_ac = Koha::Checkout->new( >+ { >+ borrowernumber => $patron->borrowernumber, >+ itemnumber => $due_ac_item->itemnumber, >+ branchcode => $patron->branchcode, >+ date_due => $today >+ } >+ )->store; >+ >+ my $patron_2 = $builder->build_object( { class => 'Koha::Patrons', value => { branchcode => $patron->branchcode} } ); >+ my $reserveid = AddReserve( >+ { >+ branchcode => $patron->branchcode, >+ borrowernumber => $patron_2->id, >+ biblionumber => $due_ac_item->biblionumber, >+ priority => 1 >+ } >+ ); >+ >+ t::lib::Mocks::mock_preference('AutomaticCheckinAutoFill', '0'); >+ >+ Koha::Checkouts->automatic_checkin; >+ my $reserve = Koha::Holds->find( $reserveid ); >+ >+ is( $reserve->found, undef, "Hold was not filled when AutomaticCheckinAutoFill disabled"); >+ >+ my $checkout_3_ac = Koha::Checkout->new( >+ { >+ borrowernumber => $patron->borrowernumber, >+ itemnumber => $due_ac_item->itemnumber, >+ branchcode => $patron->branchcode, >+ date_due => $today >+ } >+ )->store; >+ t::lib::Mocks::mock_preference('AutomaticCheckinAutoFill', '1'); >+ >+ Koha::Checkouts->automatic_checkin; >+ $reserve->discard_changes; >+ >+ is( $reserve->found, 'W', "Hold was filled when AutomaticCheckinAutoFill enabled"); >+ }; >+ > $schema->storage->txn_rollback; > } >-- >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 33887
:
152279
|
152280
|
152385
|
152388
|
152391
|
152392
|
152494
|
154862
|
154863
|
154864
|
157594
|
157595
|
157596
|
157597