Bugzilla – Attachment 103764 Details for
Bug 25227
SIP server returns wrong error message if item was lost and not checked out
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25227: Add unit tests
Bug-25227-Add-unit-tests.patch (text/plain), 3.55 KB, created by
Kyle M Hall (khall)
on 2020-04-27 12:29:46 UTC
(
hide
)
Description:
Bug 25227: Add unit tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-04-27 12:29:46 UTC
Size:
3.55 KB
patch
obsolete
>From 3c0d7742ae4be7445027a1a31ad2e8f78ad0089d Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 27 Apr 2020 08:04:07 -0400 >Subject: [PATCH] Bug 25227: Add unit tests > >--- > t/db_dependent/SIP/Transaction.t | 78 +++++++++++++++++++++++++++++++- > 1 file changed, 77 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t >index a153fab638..6c38ecad49 100755 >--- a/t/db_dependent/SIP/Transaction.t >+++ b/t/db_dependent/SIP/Transaction.t >@@ -4,11 +4,12 @@ > # Current state is very rudimentary. Please help to extend it! > > use Modern::Perl; >-use Test::More tests => 8; >+use Test::More tests => 10; > > use Koha::Database; > use t::lib::TestBuilder; > use t::lib::Mocks; >+use C4::SIP::ILS; > use C4::SIP::ILS::Patron; > use C4::SIP::ILS::Transaction::RenewAll; > use C4::SIP::ILS::Transaction::Checkout; >@@ -318,4 +319,79 @@ subtest do_checkin => sub { > is( $patron->checkouts->count, 0, 'Checkin should have been done successfully'); > }; > >+subtest checkin_lost => sub { >+ plan tests => 2; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ >+ t::lib::Mocks::mock_userenv( >+ { branchcode => $library->branchcode, flags => 1 } ); >+ >+ my $item = $builder->build_sample_item( >+ { >+ library => $library->branchcode, >+ } >+ ); >+ >+ $item->itemlost(1)->itemlost_on(dt_from_string)->store(); >+ >+ my $instituation = { >+ id => $library->id, >+ implementation => "ILS", >+ policy => { >+ checkin => "true", >+ renewal => "true", >+ checkout => "true", >+ timeout => 100, >+ retries => 5, >+ } >+ }; >+ my $ils = C4::SIP::ILS->new( $instituation ); >+ >+ t::lib::Mocks::mock_preference('BlockReturnOfLostItems', '1'); >+ my $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp ); >+ is( $circ->{screen_msg}, 'Item lost, return not allowed', "Got correct screen message" ); >+ >+ t::lib::Mocks::mock_preference('BlockReturnOfLostItems', '0'); >+ $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp ); >+ is( $circ->{screen_msg}, 'Item not checked out', "Got 'Item not checked out' screen message" ); >+}; >+ >+subtest checkin_withdrawn => sub { >+ plan tests => 2; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ >+ t::lib::Mocks::mock_userenv( >+ { branchcode => $library->branchcode, flags => 1 } ); >+ >+ my $item = $builder->build_sample_item( >+ { >+ library => $library->branchcode, >+ } >+ ); >+ >+ $item->withdrawn(1)->withdrawn_on(dt_from_string)->store(); >+ >+ my $instituation = { >+ id => $library->id, >+ implementation => "ILS", >+ policy => { >+ checkin => "true", >+ renewal => "true", >+ checkout => "true", >+ timeout => 100, >+ retries => 5, >+ } >+ }; >+ my $ils = C4::SIP::ILS->new( $instituation ); >+ >+ t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', '1'); >+ my $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp ); >+ is( $circ->{screen_msg}, 'Item withdrawn, return not allowed', "Got correct screen message" ); >+ >+ t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', '0'); >+ $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp ); >+ is( $circ->{screen_msg}, 'Item not checked out', "Got 'Item not checked out' screen message" ); >+}; > $schema->storage->txn_rollback; >-- >2.24.2 (Apple Git-127)
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 25227
:
103363
|
103739
|
103757
|
103758
|
103762
|
103764
|
103765
|
103766
|
103770
|
103771
|
103772