Bugzilla – Attachment 101095 Details for
Bug 24553
Cancelling 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 24553: Unit tests
Bug-24553-Unit-tests.patch (text/plain), 3.14 KB, created by
Kyle M Hall (khall)
on 2020-03-20 12:45:17 UTC
(
hide
)
Description:
Bug 24553: Unit tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-03-20 12:45:17 UTC
Size:
3.14 KB
patch
obsolete
>From 9d557947a7d7c94855d4b2a511a3ef242529c221 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 25 Feb 2020 14:42:17 +0000 >Subject: [PATCH] Bug 24553: Unit tests > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/db_dependent/SIP/ILS.t | 69 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 68 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/ILS.t b/t/db_dependent/SIP/ILS.t >index 77eafa20b1..f08a259621 100755 >--- a/t/db_dependent/SIP/ILS.t >+++ b/t/db_dependent/SIP/ILS.t >@@ -20,12 +20,24 @@ > > use Modern::Perl; > >-use Test::More tests => 9; >+use Test::More tests => 10; >+ >+use t::lib::TestBuilder; >+use t::lib::Mocks; >+ >+use C4::Reserves; >+use Koha::CirculationRules; >+use Koha::Database; > > BEGIN { > use_ok('C4::SIP::ILS'); > } > >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+my $builder = t::lib::TestBuilder->new(); >+ > my $class = 'C4::SIP::ILS'; > my $institution = { id => 'CPL', }; > >@@ -56,3 +68,58 @@ is( $ils->test_cardnumber_compare( 'A1234', 'a1234' ), > > is( $ils->test_cardnumber_compare( 'A1234', 'b1234' ), > q{}, 'borrower bc test identifies difference' ); >+ >+subtest cancel_hold => sub { >+ plan tests => 5; >+ >+ 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 $reserve1 = 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 $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"); >+}; >+$schema->storage->txn_rollback; >-- >2.21.1 (Apple Git-122.3)
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 24553
:
99592
|
99593
|
100891
|
100892
|
101095
|
101096
|
101111
|
101112
|
102518