Bugzilla – Attachment 165384 Details for
Bug 33237
If TranslateNotices is off, us the default language includes in slips
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33237: (QA follow-up) Clarify tests
Bug-33237-QA-follow-up-Clarify-tests.patch (text/plain), 5.02 KB, created by
Martin Renvoize
on 2024-04-23 12:45:39 UTC
(
hide
)
Description:
Bug 33237: (QA follow-up) Clarify tests
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2024-04-23 12:45:39 UTC
Size:
5.02 KB
patch
obsolete
>From 007f00ca85a15f38451a4994c7a0bfab55ac8225 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 23 Apr 2024 13:42:46 +0100 >Subject: [PATCH] Bug 33237: (QA follow-up) Clarify tests > >This patch tries to clarify the tests a little and expand their >coverage. > >I've added notes where I think we still need a little work, especially >in regards to having them pass in the jenkins runs as we don't have >translations installed there and thus at the moment the tests will fail >without manual intervention to install the translated includes. >--- > t/db_dependent/Letters.t | 35 ++++++++++++++++++++++++++--------- > 1 file changed, 26 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index b40b38cec46..4b25205c14c 100755 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -876,7 +876,7 @@ subtest 'GetPreparedLetter' => sub { > > > subtest 'TranslateNotices' => sub { >- plan tests => 7; >+ plan tests => 10; > > t::lib::Mocks::mock_preference( 'TranslateNotices', '1' ); > >@@ -938,6 +938,8 @@ subtest 'TranslateNotices' => sub { > is( $letter->{title}, 'a test', > 'GetPreparedLetter should return the default notice if pref disabled but additional language exists' ); > >+ t::lib::Mocks::mock_preference( 'TranslateNotices', '1' ); >+ > my $amount = -20; > my $accountline = $builder->build( > { >@@ -953,25 +955,31 @@ subtest 'TranslateNotices' => sub { > $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'); >+ ('test', 'payment', '', 'Paiement du compte', 'Paiement du compte', "[% PROCESS 'accounts.inc' %][% PROCESS account_type_description account=credit %][% credit.description %]", 'print', 'fr-CA'), >+ ('test', 'payment', '', 'Default payment notice', 'Default payment notice', "[% PROCESS 'accounts.inc' %][% PROCESS account_type_description account=credit %][% credit.description %]", 'print', 'default'); > | > ); > >+ # Note: How can we mock the above used includes being installed in fr-CA language so we don't have to actually install >+ # them for the tests to run :S >+ > $tables = { > borrowers => $borrowernumber, > credits => $accountline->{accountlines_id}, > }; > > $letter = C4::Letters::GetPreparedLetter( >- module => 'test_payment', >- letter_code => 'code', >+ module => 'test', >+ letter_code => 'payment', > message_transport_type => 'print', > tables => $tables, > lang => 'fr-CA', > ); >+ is( $letter->{title}, 'Paiement du compte', >+ 'GetPreparedLetter should return the notice in patron\'s preferred language' ); > like( > $letter->{content}, qr/Paiement/, >- 'GetPreparedLetter should return the notice in patron\'s preferred language' >+ 'Template includes should use the patron\'s preferred language too' > ); > > my $context = Test::MockModule->new('C4::Context'); >@@ -981,27 +989,36 @@ subtest 'TranslateNotices' => sub { > t::lib::Mocks::mock_preference( 'language', 'fr-CA,en' ); > > $letter = C4::Letters::GetPreparedLetter( >- module => 'test_payment', >- letter_code => 'code', >+ module => 'test', >+ letter_code => 'payment', > message_transport_type => 'print', > tables => $tables, > lang => 'default', > ); >+ is( $letter->{title}, 'Default payment notice', >+ 'GetPreparedLetter should return the notice in default language' ); > 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', >+ module => 'test', >+ letter_code => 'payment', > message_transport_type => 'print', > tables => $tables, > lang => 'default' > ); >+ is( $letter->{title}, 'Default payment notice', >+ 'GetPreparedLetter should return the notice in default language' ); > like( > $letter->{content}, qr/Paiement/, > 'GetPreparedLetter should return the notice in the first language in language system preference' > ); >+ >+ t::lib::Mocks::mock_preference( 'TranslateNotices', '0' ); >+ >+ # Note: What should happen when TranslateNotices is disabled? The default might be translated and thus we need to ensure we're >+ # using the right template + includes consistently again > }; > > subtest 'Test SMS handling in SendQueuedMessages' => sub { >-- >2.44.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 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