Bugzilla – Attachment 164521 Details for
Bug 33237
If TranslateNotices is off, use the default language includes in slips
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33237: (follow-up) Unit tests
Bug-33237-follow-up-Unit-tests.patch (text/plain), 3.35 KB, created by
Hammat wele
on 2024-04-08 16:44:14 UTC
(
hide
)
Description:
Bug 33237: (follow-up) Unit tests
Filename:
MIME Type:
Creator:
Hammat wele
Created:
2024-04-08 16:44:14 UTC
Size:
3.35 KB
patch
obsolete
>From ee18fc7a7e588dbd2c9f4843547fc19a7904683d Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Mon, 8 Apr 2024 16:43:06 +0000 >Subject: [PATCH] Bug 33237: (follow-up) Unit tests > >--- > t/db_dependent/Letters.t | 66 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 65 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index ade28f89ad..b5a481266c 100755 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -870,7 +870,7 @@ subtest 'GetPreparedLetter' => sub { > > > subtest 'TranslateNotices' => sub { >- plan tests => 4; >+ plan tests => 7; > > t::lib::Mocks::mock_preference( 'TranslateNotices', '1' ); > >@@ -932,6 +932,70 @@ subtest 'TranslateNotices' => sub { > is( $letter->{title}, 'a test', > 'GetPreparedLetter should return the default notice if pref disabled but additional language exists' ); > >+ my $amount = -20; >+ my $accountline = $builder->build( >+ { >+ source => 'Accountline', >+ value => { >+ borrowernumber => $borrowernumber, >+ amount => $amount, >+ amountoutstanding => $amount, >+ credit_type_code => 'PAYMENT', >+ } >+ } >+ ); >+ $dbh->do( >+ q| >+ INSERT INTO letter (module, code, branchcode, name, title, content, message_transport_type, lang) VALUES >+ ('test_payment', 'code', '', 'Account payment', 'Account payment', "[% PROCESS 'accounts.inc' %][% PROCESS account_type_description account=credit %][% credit.description %]", 'print', 'default'); >+ | >+ ); >+ >+ $tables = { >+ borrowers => $borrowernumber, >+ credits => $accountline->{accountlines_id}, >+ }; >+ >+ $letter = C4::Letters::GetPreparedLetter( >+ module => 'test_payment', >+ letter_code => 'code', >+ message_transport_type => 'print', >+ tables => $tables, >+ lang => 'fr-CA', >+ ); >+ like( >+ $letter->{content}, qr/Paiement/, >+ 'GetPreparedLetter should return the notice in patron\'s preferred language' >+ ); >+ >+ my $context = Test::MockModule->new('C4::Context'); >+ $context->mock( 'interface', 'intranet' ); >+ >+ Koha::Cache::Memory::Lite->get_instance()->clear_from_cache('getlanguage'); >+ t::lib::Mocks::mock_preference( 'language', 'fr-CA,en' ); >+ >+ $letter = C4::Letters::GetPreparedLetter( >+ module => 'test_payment', >+ letter_code => 'code', >+ message_transport_type => 'print', >+ tables => $tables, >+ lang => 'default', >+ ); >+ like( $letter->{content}, qr/Paiement/, 'GetPreparedLetter should return the notice in the interface language' ); >+ >+ $context->mock( 'interface', 'cron' ); >+ >+ $letter = C4::Letters::GetPreparedLetter( >+ module => 'test_payment', >+ letter_code => 'code', >+ message_transport_type => 'print', >+ tables => $tables, >+ lang => 'default' >+ ); >+ like( >+ $letter->{content}, qr/Paiement/, >+ 'GetPreparedLetter should return the notice in the first language in language system preference' >+ ); > }; > > subtest 'Test SMS handling in SendQueuedMessages' => sub { >-- >2.34.1
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 33237
:
148281
|
148785
|
163952
|
163953
|
164521
|
165382
|
165383
|
165384
|
165404
|
165405
|
165406
|
165455
|
165456
|
165457
|
165458
|
165459
|
165460
|
165473
|
165474
|
165475
|
165476
|
165477
|
165478
|
165479
|
165480
|
166860