Bugzilla – Attachment 155920 Details for
Bug 34153
Add ability to allow items with additional materials notes to be checked out via SIP
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34153: Add tests
Bug-34153-Add-tests.patch (text/plain), 3.64 KB, created by
Victor Grousset/tuxayo
on 2023-09-20 06:57:12 UTC
(
hide
)
Description:
Bug 34153: Add tests
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2023-09-20 06:57:12 UTC
Size:
3.64 KB
patch
obsolete
>From c7b3f48e399652f8e76c7e6eb1a0782aa545568b Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 20 Sep 2023 08:47:48 +0200 >Subject: [PATCH] Bug 34153: Add tests > >--- > t/db_dependent/SIP/Message.t | 68 +++++++++++++++++++++++++++++++++++- > 1 file changed, 67 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/Message.t b/t/db_dependent/SIP/Message.t >index e4f0e38385..1148b8d154 100755 >--- a/t/db_dependent/SIP/Message.t >+++ b/t/db_dependent/SIP/Message.t >@@ -21,7 +21,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 16; >+use Test::More tests => 17; > use Test::Exception; > use Test::MockObject; > use Test::MockModule; >@@ -577,6 +577,72 @@ subtest 'SC status tests' => sub { > > }; > >+subtest 'test_allow_additional_materials_checkout' => sub { >+ my $schema = Koha::Database->new->schema; >+ $schema->storage->txn_begin; >+ >+ plan tests => 4; >+ >+ my $builder = t::lib::TestBuilder->new(); >+ my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; >+ my $branchcode2 = $builder->build({ source => 'Branch' })->{branchcode}; >+ my ( $response, $findpatron ); >+ my $mocks = create_mocks( \$response, \$findpatron, \$branchcode ); >+ >+ # create some data >+ my $patron1 = $builder->build({ >+ source => 'Borrower', >+ value => { >+ password => hash_password( PATRON_PW ), >+ }, >+ }); >+ my $card1 = $patron1->{cardnumber}; >+ my $sip_patron1 = C4::SIP::ILS::Patron->new( $card1 ); >+ $findpatron = $sip_patron1; >+ my $item_object = $builder->build_sample_item({ >+ damaged => 0, >+ withdrawn => 0, >+ itemlost => 0, >+ restricted => 0, >+ homebranch => $branchcode, >+ holdingbranch => $branchcode, >+ materials => "This is a materials note", >+ }); >+ >+ my $mockILS = $mocks->{ils}; >+ my $server = { ils => $mockILS, account => {} }; >+ $mockILS->mock( 'institution', sub { $branchcode; } ); >+ $mockILS->mock( 'supports', sub { return; } ); >+ $mockILS->mock( 'checkout', sub { >+ shift; >+ return C4::SIP::ILS->checkout(@_); >+ }); >+ my $today = dt_from_string; >+ t::lib::Mocks::mock_userenv({ branchcode => $branchcode, flags => 1 }); >+ t::lib::Mocks::mock_preference( 'CircConfirmItemParts', '1' ); >+ >+ my $siprequest = CHECKOUT . 'YN' . siprequestdate($today) . >+ siprequestdate( $today->clone->add( days => 1) ) . >+ FID_INST_ID . $branchcode . '|'. >+ FID_PATRON_ID . $sip_patron1->id . '|' . >+ FID_ITEM_ID . $item_object->barcode . '|' . >+ FID_TERMINAL_PWD . 'ignored' . '|'; >+ undef $response; >+ >+ my $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 ); >+ $server->{account}->{allow_additional_materials_checkout} = 0; >+ $msg->handle_checkout( $server ); >+ my $respcode = substr( $response, 0, 2 ); >+ check_field( $respcode, $response, FID_SCREEN_MSG, 'Item must be checked out at a circulation desk', 'Check screen msg', 'equals' ); >+ is( Koha::Checkouts->search({ itemnumber => $item_object->id })->count, 0, "Item was not checked out (allow_additional_materials_checkout disabled)"); >+ >+ $server->{account}->{allow_additional_materials_checkout} = 1; >+ $msg->handle_checkout( $server ); >+ $respcode = substr( $response, 0, 2 ); >+ check_field( $respcode, $response, FID_SCREEN_MSG, 'Item has additional materials: This is a materials note', 'Check screen msg', 'equals' ); >+ is( Koha::Checkouts->search({ itemnumber => $item_object->id })->count, 1, "Item was checked out (allow_additional_materials_checkout enabled"); >+}; >+ > # Here is room for some more subtests > > # END of main code >-- >2.42.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 34153
:
152864
|
155740
|
155920
|
155921
|
155927
|
156250
|
156251
|
156252