Bugzilla – Attachment 102914 Details for
Bug 24620
Existing transfers not closed when hold is set to waiting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24620: Unit tests
Bug-24620-Unit-tests.patch (text/plain), 2.93 KB, created by
Jonathan Druart
on 2020-04-14 09:49:15 UTC
(
hide
)
Description:
Bug 24620: Unit tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-04-14 09:49:15 UTC
Size:
2.93 KB
patch
obsolete
>From ee68bd5d17a68016383a01f72475ed1882a8fb5f Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 10 Feb 2020 18:18:45 +0000 >Subject: [PATCH] Bug 24620: Unit tests > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Circulation.t | 42 +++++++++++++++++++++++++++++++++++- > 1 file changed, 41 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index d0c97ec0b0..1ca01ea6f8 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 => 47; >+use Test::More tests => 48; > use Test::MockModule; > use Test::Deep qw( cmp_deeply ); > >@@ -40,8 +40,10 @@ use C4::Overdues qw(UpdateFine CalcFine); > use Koha::DateUtils; > use Koha::Database; > use Koha::Items; >+use Koha::Item::Transfers; > use Koha::Checkouts; > use Koha::Patrons; >+use Koha::Holds; > use Koha::CirculationRules; > use Koha::Subscriptions; > use Koha::Account::Lines; >@@ -3813,6 +3815,44 @@ subtest 'Do not return on renewal (LOST charge)' => sub { > ); > }; > >+subtest 'Filling a hold should cancel existing transfer' => sub { >+ plan tests => 4; >+ >+ t::lib::Mocks::mock_preference('AutomaticItemReturn', 1); >+ >+ my $libraryA = $builder->build_object( { class => 'Koha::Libraries' } )->store; >+ my $libraryB = $builder->build_object( { class => 'Koha::Libraries' } )->store; >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ categorycode => $patron_category->{categorycode}, >+ branchcode => $libraryA->branchcode, >+ } >+ } >+ )->store; >+ >+ my $item = $builder->build_sample_item({ >+ homebranch => $libraryB->branchcode, >+ }); >+ >+ my ( undef, $message ) = AddReturn( $item->barcode, $libraryA->branchcode, undef, undef ); >+ is( Koha::Item::Transfers->search({ itemnumber => $item->itemnumber, datearrived => undef })->count, 1, "We generate a transfer on checkin"); >+ AddReserve( >+ $libraryA->branchcode, $patron->borrowernumber, $item->biblionumber, '', >+ 1, undef, undef, '', >+ undef, $item->itemnumber, undef, undef >+ ); >+ my $reserves = Koha::Holds->search({ itemnumber => $item->itemnumber }); >+ is( $reserves->count, 1, "Reserve is placed"); >+ ( undef, $message ) = AddReturn( $item->barcode, $libraryA->branchcode, undef, undef ); >+ my $reserve = $reserves->next; >+ ModReserveAffect( $item->itemnumber, $patron->borrowernumber, 0, $reserve->reserve_id ); >+ $reserve->discard_changes; >+ ok( $reserve->found eq 'W', "Reserve is marked waiting" ); >+ is( Koha::Item::Transfers->search({ itemnumber => $item->itemnumber, datearrived => undef })->count, 0, "No outstanding transfers when hold is waiting"); >+}; >+ > $schema->storage->txn_rollback; > C4::Context->clear_syspref_cache(); > $cache->clear_from_cache('single_holidays'); >-- >2.20.1
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 24620
:
98678
|
98679
|
98711
|
98805
|
100448
|
100451
| 102914 |
102915
|
102916
|
104437