Bugzilla – Attachment 157297 Details for
Bug 32602
SIP Server doesn't respect IssuingInProcess system preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32602: Unit tests
Bug-32602-Unit-tests.patch (text/plain), 4.32 KB, created by
Aleisha Amohia
on 2023-10-18 01:00:24 UTC
(
hide
)
Description:
Bug 32602: Unit tests
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2023-10-18 01:00:24 UTC
Size:
4.32 KB
patch
obsolete
>From 13f269d9f8c79c7037c6297745e6dde7bdcdebd5 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleisha@catalyst.net.nz> >Date: Wed, 18 Oct 2023 00:59:55 +0000 >Subject: [PATCH] Bug 32602: Unit tests > >Test plan: >1. sudo koha-shell <instance> >2. prove -v t/db_dependent/SIP/Transaction.t >3. Confirm all tests pass > >Sponsored-by: Horowhenua District Council, New Zealand >--- > 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 30ddfc182c8..d0ad749e690 100755 >--- a/t/db_dependent/SIP/Transaction.t >+++ b/t/db_dependent/SIP/Transaction.t >@@ -4,7 +4,7 @@ > # Current state is very rudimentary. Please help to extend it! > > use Modern::Perl; >-use Test::More tests => 18; >+use Test::More tests => 19; > use Test::Warn; > > use Koha::Database; >@@ -1243,4 +1243,80 @@ subtest do_checkout_with_recalls => sub { > is( $recall2->status, 'fulfilled', 'Recall is fulfilled by checked out item' ); > }; > >+subtest do_checkout_with_IssuingInProcess => sub { >+ plan tests => 8; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ branchcode => $library->branchcode, >+ } >+ } >+ ); >+ my $fine = $builder->build_object( >+ { >+ class => 'Koha::Account::Lines', >+ value => { >+ borrowernumber => $patron->id, amount => '4.000000', description => 'Manual', >+ debit_type_code => 'MANUAL', amountoutstanding => '4.000000' >+ } >+ } >+ ); >+ >+ t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode, flags => 1 } ); >+ t::lib::Mocks::mock_preference( 'IssuingInProcess', 0 ); >+ t::lib::Mocks::mock_preference( 'noissuescharge', 2 ); >+ >+ my $item = $builder->build_sample_item( >+ { >+ library => $library->branchcode, >+ } >+ ); >+ >+ my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype ); >+ $itemtype->set( { rentalcharge => 2 } )->store; >+ >+ Koha::CirculationRules->set_rule( >+ { >+ branchcode => undef, >+ categorycode => undef, >+ itemtype => undef, >+ rule_name => 'maxissueqty', >+ rule_value => '10', >+ } >+ ); >+ >+ my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); >+ my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); >+ my $co_transaction = C4::SIP::ILS::Transaction::Checkout->new(); >+ $co_transaction->fee_ack('Y'); >+ >+ is( ref $co_transaction, "C4::SIP::ILS::Transaction::Checkout", "New transaction created" ); >+ is( $co_transaction->patron($sip_patron), $sip_patron, "Patron assigned to transaction" ); >+ is( $co_transaction->item($sip_item), $sip_item, "Item assigned to transaction" ); >+ >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 0, 'Checkout was not done due to fines exceeding noissuescharge at start of transaction, and IssuingInProcess disabled' ); >+ >+ t::lib::Mocks::mock_preference( 'noissuescharge', 5 ); >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 0, 'Checkout was not done due to fines exceeding noissuescharge if checkout made, and IssuingInProcess disabled' ); >+ >+ t::lib::Mocks::mock_preference( 'IssuingInProcess', 1 ); >+ t::lib::Mocks::mock_preference( 'noissuescharge', 2 ); >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 0, 'Checkout was not done due to fines exceeding noissuescharge at start of transaction, with IssuingInProcess enabled' ); >+ >+ t::lib::Mocks::mock_preference( 'noissuescharge', 5 ); >+ t::lib::Mocks::mock_preference( 'AllFinesNeedOverride', 1 ); >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 0, 'Checkout was not done due to fines and AllFinesNeedOverride enabled' ); >+ >+ t::lib::Mocks::mock_preference( 'AllFinesNeedOverride', 0 ); >+ $co_transaction->do_checkout(); >+ is( $patron->checkouts->count, 1, 'Checkout done due to fines not exceeding noissuescharge at start of transaction and IssuingInProcess enabled' ); >+}; >+ > $schema->storage->txn_rollback; >-- >2.30.2
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 32602
:
145170
|
145249
|
149152
|
149153
|
156808
|
156809
|
157296
| 157297