Bugzilla – Attachment 152391 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), 3.90 KB, created by
Sam Lau
on 2023-06-15 18:34:21 UTC
(
hide
)
Description:
Bug 33887: Unit tests
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2023-06-15 18:34:21 UTC
Size:
3.90 KB
patch
obsolete
>From 8aa7d731579994c9233a4d46cc42fa734347443b Mon Sep 17 00:00:00 2001 >From: Sam Lau <samalau@gmail.com> >Date: Thu, 15 Jun 2023 18:19:50 +0000 >Subject: [PATCH] Bug 33887: Unit tests > >prove -v t/db_dependent/Koha/Checkouts.t >--- > t/db_dependent/Koha/Checkouts.t | 73 ++++++++++++++++++++++++++++++++- > 1 file changed, 72 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Checkouts.t b/t/db_dependent/Koha/Checkouts.t >index 4373904142..1554b4d827 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,74 @@ 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 => 3; >+ >+ my $checkout_2_due_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_due_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"); >+ >+ my $checkout_2_odue_ac = Koha::Checkout->new( >+ { >+ borrowernumber => $patron->borrowernumber, >+ itemnumber => $odue_ac_item->itemnumber, >+ branchcode => $patron->branchcode, >+ date_due => $today >+ } >+ )->store; >+ my $branch2 = $builder->build_object({ class=> "Koha::Libraries" }); >+ my $reserve2id = AddReserve( >+ { >+ branchcode => $branch2->branchcode, >+ borrowernumber => $patron_2->id, >+ biblionumber => $odue_ac_item->biblionumber, >+ priority => 1 >+ } >+ ); >+ Koha::Checkouts->automatic_checkin; >+ >+ my $reserve2 = Koha::Holds->find( $reserve2id ); >+ is( $reserve2->found, 'T', "Hold was filled when AutomaticCheckinAutoFill enabled and transfer was initiated when branches didn't match"); >+ }; >+ > $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