Bugzilla – Attachment 124722 Details for
Bug 28464
Cancelling a waiting hold via SIP returns a failed response even when cancellation succeeds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28464: Add unit tests
Bug-28464-Add-unit-tests.patch (text/plain), 3.06 KB, created by
Marcel de Rooy
on 2021-09-10 07:24:19 UTC
(
hide
)
Description:
Bug 28464: Add unit tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-09-10 07:24:19 UTC
Size:
3.06 KB
patch
obsolete
>From b5deff854d2fbdd83a3fb0cb20f6c92c57c21441 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 26 May 2021 11:13:44 -0400 >Subject: [PATCH] Bug 28464: Add unit tests >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/SIP/ILS.t | 62 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 62 insertions(+) > >diff --git a/t/db_dependent/SIP/ILS.t b/t/db_dependent/SIP/ILS.t >index 79eabdd558..778195b670 100755 >--- a/t/db_dependent/SIP/ILS.t >+++ b/t/db_dependent/SIP/ILS.t >@@ -30,6 +30,7 @@ use C4::Circulation qw( AddIssue ); > use Koha::CirculationRules; > use Koha::Database; > use Koha::DateUtils; >+use Koha::Holds; > > BEGIN { > use_ok('C4::SIP::ILS'); >@@ -177,6 +178,67 @@ subtest cancel_hold => sub { > is( $item->holds->count(), 0, "Item has 0 holds remaining"); > }; > >+subtest cancel_waiting_hold => sub { >+ plan tests => 7; >+ >+ my $library = $builder->build_object ({ class => 'Koha::Libraries' }); >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ branchcode => $library->branchcode, >+ } >+ } >+ ); >+ t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode, flags => 1 }); >+ >+ my $item = $builder->build_sample_item({ >+ library => $library->branchcode, >+ }); >+ >+ Koha::CirculationRules->set_rules( >+ { >+ categorycode => $patron->categorycode, >+ branchcode => $library->branchcode, >+ itemtype => $item->effective_itemtype, >+ rules => { >+ onshelfholds => 1, >+ reservesallowed => 3, >+ holds_per_record => 3, >+ issuelength => 5, >+ lengthunit => 'days', >+ } >+ } >+ ); >+ >+ my $reserve_id = AddReserve( >+ { >+ branchcode => $library->branchcode, >+ borrowernumber => $patron->borrowernumber, >+ biblionumber => $item->biblio->biblionumber, >+ itemnumber => $item->itemnumber, >+ } >+ ); >+ is( $item->biblio->holds->count(), 1, "Hold was placed on bib"); >+ is( $item->holds->count(),1,"Hold was placed on specific item"); >+ >+ my $hold = Koha::Holds->find( $reserve_id ); >+ ok( $hold, 'Get hold object' ); >+ $hold->update({ found => 'W' }); >+ $hold->get_from_storage; >+ >+ is( $hold->found, 'W', "Hold was correctly set to waiting." ); >+ >+ my $ils = C4::SIP::ILS->new({ id => $library->branchcode }); >+ my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); >+ my $transaction = $ils->cancel_hold($patron->cardnumber,undef,$item->barcode,undef); >+ >+ is( $transaction->{screen_msg},"Hold Cancelled.","We get a success message when hold cancelled"); >+ >+ is( $item->biblio->holds->count(), 0, "Bib has 0 holds remaining"); >+ is( $item->holds->count(), 0, "Item has 0 holds remaining"); >+}; >+ > subtest checkout => sub { > plan tests => 4; > >-- >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 28464
:
121437
|
121438
|
122199
|
122200
| 124722 |
124723
|
124724