Bugzilla – Attachment 187921 Details for
Bug 35612
Record branch context in accountlines.branchcode for OVERDUE, LOST, and PROCESSING fees
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35612: Unit tests for Overdues.t
Bug-35612-Unit-tests-for-Overduest.patch (text/plain), 4.51 KB, created by
Laura Escamilla
on 2025-10-15 16:10:57 UTC
(
hide
)
Description:
Bug 35612: Unit tests for Overdues.t
Filename:
MIME Type:
Creator:
Laura Escamilla
Created:
2025-10-15 16:10:57 UTC
Size:
4.51 KB
patch
obsolete
>From 6a5131483e49745346d685a3f7da3ddc2a3bd2c5 Mon Sep 17 00:00:00 2001 >From: Laura_Escamilla <laura.escamilla@bywatersolutions.com> >Date: Wed, 15 Oct 2025 15:17:58 +0000 >Subject: [PATCH] Bug 35612: Unit tests for Overdues.t > >--- > t/db_dependent/Overdues.t | 101 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 100 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Overdues.t b/t/db_dependent/Overdues.t >index f17ee28d18..1ef4b30969 100755 >--- a/t/db_dependent/Overdues.t >+++ b/t/db_dependent/Overdues.t >@@ -1,7 +1,7 @@ > #!/usr/bin/perl; > > use Modern::Perl; >-use Test::More tests => 19; >+use Test::More tests => 20; > use Test::NoWarnings; > use Test::Warn; > >@@ -163,6 +163,105 @@ is_deeply( \@overdue_branches, [ 'CPL', 'MPL' ], 'If only 2 specific rules exist > > $schema->storage->txn_rollback; > >+subtest 'branch_for_fee_context' => sub { >+ plan tests => 8; >+ $schema->storage->txn_begin; >+ >+ my $br_home = $builder->build( { source => 'Branch' } )->{branchcode}; >+ my $br_hold = $builder->build( { source => 'Branch' } )->{branchcode}; >+ my $br_pat = $builder->build( { source => 'Branch' } )->{branchcode}; >+ >+ my $pat1 = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { branchcode => $br_pat } >+ } >+ ); >+ >+ my $item1 = $builder->build_object( >+ { >+ class => 'Koha::Items', >+ value => { homebranch => $br_home, holdingbranch => $br_hold } >+ } >+ ); >+ >+ my $issue1 = $builder->build_object( >+ { >+ class => 'Koha::Checkouts', >+ value => { >+ itemnumber => $item1->itemnumber, >+ borrowernumber => $pat1->borrowernumber, >+ branchcode => $br_hold, >+ } >+ } >+ ); >+ >+ t::lib::Mocks::mock_preference( 'HomeOrHoldingBranch', 'homebranch' ); >+ t::lib::Mocks::mock_preference( 'CircControl', 'PatronLibrary' ); >+ is( >+ C4::Overdues::branch_for_fee_context( >+ fee_type => 'OVERDUE', patron => $pat1, item => $item1, issue => $issue1 >+ ), >+ $br_pat, >+ 'OVERDUE: PatronLibrary => patron home' >+ ); >+ >+ t::lib::Mocks::mock_preference( 'CircControl', 'PickupLibrary' ); >+ is( >+ C4::Overdues::branch_for_fee_context( >+ fee_type => 'OVERDUE', patron => $pat1, item => $item1, issue => $issue1 >+ ), >+ $br_hold, >+ 'OVERDUE: PickupLibrary => issuing branch' >+ ); >+ >+ t::lib::Mocks::mock_preference( 'CircControl', 'ItemHomeLibrary' ); >+ t::lib::Mocks::mock_preference( 'HomeOrHoldingBranch', 'homebranch' ); >+ is( >+ C4::Overdues::branch_for_fee_context( >+ fee_type => 'OVERDUE', patron => $pat1, item => $item1, issue => $issue1 >+ ), >+ $br_home, >+ 'OVERDUE: ItemHomeLibrary/homebranch => item home' >+ ); >+ >+ t::lib::Mocks::mock_preference( 'HomeOrHoldingBranch', 'holdingbranch' ); >+ is( >+ C4::Overdues::branch_for_fee_context( >+ fee_type => 'OVERDUE', patron => $pat1, item => $item1, issue => $issue1 >+ ), >+ $br_hold, >+ 'OVERDUE: ItemHomeLibrary/holdingbranch => item holding' >+ ); >+ >+ t::lib::Mocks::mock_preference( 'LostChargesControl', 'PatronLibrary' ); >+ t::lib::Mocks::mock_preference( 'HomeOrHoldingBranch', 'homebranch' ); >+ is( >+ C4::Overdues::branch_for_fee_context( fee_type => 'LOST', patron => $pat1, item => $item1, issue => $issue1 ), >+ $br_pat, 'LOST: PatronLibrary => patron home' >+ ); >+ >+ t::lib::Mocks::mock_preference( 'LostChargesControl', 'PickupLibrary' ); >+ is( >+ C4::Overdues::branch_for_fee_context( fee_type => 'LOST', patron => $pat1, item => $item1, issue => $issue1 ), >+ $br_hold, 'LOST: PickupLibrary => issuing branch' >+ ); >+ >+ t::lib::Mocks::mock_preference( 'LostChargesControl', 'ItemHomeLibrary' ); >+ t::lib::Mocks::mock_preference( 'HomeOrHoldingBranch', 'homebranch' ); >+ is( >+ C4::Overdues::branch_for_fee_context( fee_type => 'LOST', patron => $pat1, item => $item1, issue => $issue1 ), >+ $br_home, 'LOST: ItemHomeLibrary/homebranch => item home' >+ ); >+ >+ t::lib::Mocks::mock_preference( 'HomeOrHoldingBranch', 'holdingbranch' ); >+ is( >+ C4::Overdues::branch_for_fee_context( fee_type => 'LOST', patron => $pat1, item => $item1, issue => $issue1 ), >+ $br_hold, 'LOST: ItemHomeLibrary/holdingbranch => item holding' >+ ); >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'UpdateFine tests' => sub { > > plan tests => 75; >-- >2.39.5
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 35612
:
186567
|
186568
|
186569
|
186570
|
186571
|
187919
|
187920
|
187921
|
187922
|
189137