Bugzilla – Attachment 188177 Details for
Bug 40255
Allow custom debit descriptions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40255: Unit test
Bug-40255-Unit-test.patch (text/plain), 3.99 KB, created by
Lucas Gass (lukeg)
on 2025-10-20 20:53:52 UTC
(
hide
)
Description:
Bug 40255: Unit test
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-10-20 20:53:52 UTC
Size:
3.99 KB
patch
obsolete
>From 666c9a1d5ca39322fa977cbc1d7fe836a0ad6f2f Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Mon, 20 Oct 2025 20:31:37 +0000 >Subject: [PATCH] Bug 40255: Unit test > >--- > t/db_dependent/Koha/Account/Line.t | 96 +++++++++++++++++++++++++++++- > 1 file changed, 95 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Account/Line.t b/t/db_dependent/Koha/Account/Line.t >index 30b623d0901..5e6da391fd1 100755 >--- a/t/db_dependent/Koha/Account/Line.t >+++ b/t/db_dependent/Koha/Account/Line.t >@@ -20,7 +20,7 @@ > use Modern::Perl; > > use Test::NoWarnings; >-use Test::More tests => 16; >+use Test::More tests => 17; > use Test::Exception; > use Test::MockModule; > >@@ -1470,4 +1470,98 @@ subtest "cancel() tests" => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'debit description from notice' => sub { >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ >+ # Create a debit type >+ my $debit_type = $builder->build_object( >+ { >+ class => 'Koha::Account::DebitTypes', >+ value => { >+ code => 'LUKEG_WAS_HERE', >+ description => 'Default description', >+ is_system => 0, >+ } >+ } >+ ); >+ >+ # Create a notice for this debit type >+ my $notice = $builder->build_object( >+ { >+ class => 'Koha::Notice::Templates', >+ value => { >+ module => 'debit_description', >+ code => 'LUKEG_WAS_HERE', >+ name => 'Test fee', >+ content => 'You owe big time buddy, pay up: $[% accountline.amount | format("%.2f") %]', >+ branchcode => '', >+ message_transport_type => 'email', >+ lang => 'default', >+ } >+ } >+ ); >+ >+ # Create an account line - description should be set from notice >+ my $account_line = Koha::Account::Line->new( >+ { >+ borrowernumber => $patron->borrowernumber, >+ debit_type_code => 'LUKEG_WAS_HERE', >+ amount => 10.50, >+ amountoutstanding => 10.50, >+ interface => 'commandline', >+ } >+ )->store; >+ >+ is( $account_line->description, 'You owe big time buddy, pay up: $10.50', 'Description set from notice template' ); >+ >+ # Create another line without a notice >+ $notice->delete; >+ >+ my $account_line2 = Koha::Account::Line->new( >+ { >+ borrowernumber => $patron->borrowernumber, >+ debit_type_code => 'LUKEG_WAS_HERE', >+ amount => 5.00, >+ amountoutstanding => 5.00, >+ interface => 'commandline', >+ } >+ )->store; >+ >+ is( $account_line2->description, undef, 'No notice, no description' ); >+ >+ # Create a line with explicit description - should not be overridden >+ my $notice2 = $builder->build_object( >+ { >+ class => 'Koha::Notice::Templates', >+ value => { >+ module => 'debit_description', >+ code => 'LUKEG_WAS_HERE', >+ content => 'From notice', >+ branchcode => '', >+ message_transport_type => 'email', >+ lang => 'default', >+ } >+ } >+ ); >+ >+ my $account_line3 = Koha::Account::Line->new( >+ { >+ borrowernumber => $patron->borrowernumber, >+ debit_type_code => 'LUKEG_WAS_HERE', >+ description => 'Manual description', >+ amount => 3.00, >+ amountoutstanding => 3.00, >+ interface => 'commandline', >+ } >+ )->store; >+ >+ is( $account_line3->description, 'Manual description', 'System defined description is used' ); >+ >+ $schema->storage->txn_rollback; >+}; >+ > 1; >-- >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 40255
:
188174
|
188176
|
188177
|
188178
|
188179
|
188180
|
188181
|
189641