Bugzilla – Attachment 67659 Details for
Bug 19260
Reservations / holds marked as problems being seen as expired ones and deleted wrongly.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19260: Add test for CancelExpiredReserves
Bug-19260-Add-test-for-CancelExpiredReserves.patch (text/plain), 2.85 KB, created by
Alex Buckley
on 2017-10-05 21:43:06 UTC
(
hide
)
Description:
Bug 19260: Add test for CancelExpiredReserves
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2017-10-05 21:43:06 UTC
Size:
2.85 KB
patch
obsolete
>From 012bcba25746490d3959223128eee3ecb9f29b5a Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Thu, 5 Oct 2017 20:36:31 +0000 >Subject: [PATCH] Bug 19260: Add test for CancelExpiredReserves > >Passes QA test tool >Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> >--- > t/db_dependent/Reserves.t | 63 ++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 62 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index fd79427..1e3f1c0 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 58; >+use Test::More tests => 59; > use Test::MockModule; > use Test::Warn; > >@@ -692,6 +692,67 @@ subtest '_koha_notify_reserve() tests' => sub { > > }; > >+subtest 'CancelExpiredReserves tests' => sub { >+ plan tests => 2; >+ >+ $dbh->do('DELETE FROM reserves'); >+ >+ my $category = $builder->build({ source => 'Category' }); >+ my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; >+ >+ my $borrowernumber = AddMember( >+ firstname => 'my firstname', >+ surname => 'my surname', >+ categorycode => $category->{categorycode}, >+ branchcode => $branchcode, >+ ); >+ >+ my $resdate = dt_from_string->add( days => -20 ); >+ my $expdate = dt_from_string->add( days => -2 ); >+ my $notexpdate = dt_from_string->add( days => 2 ); >+ >+ my $hold1 = Koha::Hold->new({ >+ branchcode => $branchcode, >+ borrowernumber => $borrowernumber, >+ biblionumber => $bibnum, >+ priority => 1, >+ reservedate => $resdate, >+ expirationdate => $notexpdate, >+ found => undef >+ })->store; >+ >+ my $hold2 = Koha::Hold->new({ >+ branchcode => $branchcode, >+ borrowernumber => $borrowernumber, >+ biblionumber => $bibnum, >+ priority => 2, >+ reservedate => $resdate, >+ expirationdate => $expdate, >+ found => undef >+ })->store; >+ >+ my $hold3 = Koha::Hold->new({ >+ branchcode => $branchcode, >+ borrowernumber => $borrowernumber, >+ biblionumber => $bibnum, >+ itemnumber => $itemnumber, >+ priority => 0, >+ reservedate => $resdate, >+ expirationdate => $expdate, >+ found => 'W' >+ })->store; >+ >+ t::lib::Mocks::mock_preference( 'ExpireReservesMaxPickUpDelay', 0 ); >+ CancelExpiredReserves(); >+ my $count1 = Koha::Holds->search->count; >+ is( $count1, 2, 'Only the non-waiting expired holds should be cancelled'); >+ >+ t::lib::Mocks::mock_preference( 'ExpireReservesMaxPickUpDelay', 1 ); >+ CancelExpiredReserves(); >+ my $count2 = Koha::Holds->search->count; >+ is( $count2, 1, 'Also the waiting expired hold should be cancelled now'); >+}; >+ > sub count_hold_print_messages { > my $message_count = $dbh->selectall_arrayref(q{ > SELECT COUNT(*) >-- >2.1.4
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 19260
:
67428
|
67489
|
67653
|
67654
|
67659
|
67660
|
67677
|
67678
|
67679
|
67680
|
67733
|
67992
|
67993
|
67994
|
67995