Bugzilla – Attachment 98678 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.92 KB, created by
Nick Clemens (kidclamp)
on 2020-02-10 18:24:03 UTC
(
hide
)
Description:
Bug 24620: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-02-10 18:24:03 UTC
Size:
2.92 KB
patch
obsolete
>From ac0405e5884958fd1e3eca6fc95d8b6216a5a3e4 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 > >--- > 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 4b17bf5d61..04ea13dff3 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 => 46; >+use Test::More tests => 47; > 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; >@@ -3647,6 +3649,44 @@ subtest "Test Backdating of Returns" => sub { > is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); > }; > >+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.11.0
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