Bugzilla – Attachment 59447 Details for
Bug 12532
Copy guarantee email to guarantor (or redirect if guarantee has no email set)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12532 - QA Follow-up
Bug-12532---QA-Follow-up.patch (text/plain), 5.87 KB, created by
Bouzid Fergani
on 2017-01-23 17:19:40 UTC
(
hide
)
Description:
Bug 12532 - QA Follow-up
Filename:
MIME Type:
Creator:
Bouzid Fergani
Created:
2017-01-23 17:19:40 UTC
Size:
5.87 KB
patch
obsolete
>From 9cad553841314926624286d4c71e63fed3933ff4 Mon Sep 17 00:00:00 2001 >From: mehdi <mehdi@inlibro.com> >Date: Mon, 25 Jul 2016 10:56:36 -0400 >Subject: [PATCH] Bug 12532 - QA Follow-up > >Fixed tests, they now work without any fails > >https://bugs.koha-community.org/show_bug.cgi?id=12532 > >Signed-off-by: Marc <veron@veron.ch> >--- > t/db_dependent/Letters.t | 34 ++++++++++++++-------------------- > t/db_dependent/Members.t | 12 ++++++------ > 2 files changed, 20 insertions(+), 26 deletions(-) > >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index e5c2d61..ae88ab1 100755 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -149,24 +149,28 @@ $resent = C4::Letters::ResendMessage(); > is( $resent, undef, 'ResendMessage should return undef if not message_id given' ); > > #Test guarantee-guarantor email redirection >+$library = $builder->build({ >+ source => 'Branch', >+ }); > my ($GUARANTEE_EMAIL, $GUARANTOR_EMAIL) = qw| guarantee@example.com guarantor@example.com |; >+my $guarantor_category = $builder->build({ source => 'Category' }); > my $guarantor = { > email => $GUARANTOR_EMAIL, >- categorycode => 'PT', >- branchcode => 'CPL', >+ categorycode => $guarantor_category, >+ branchcode => $library->{branchcode}, > surname => "Guarantor" > }; > $guarantor->{'borrowernumber'} = AddMember(%$guarantor); > my $guarantee = { > guarantorid => $guarantor->{'borrowernumber'}, > email => $GUARANTEE_EMAIL, >- categorycode => 'PT', >- branchcode => 'CPL', >+ categorycode => $guarantor_category, >+ branchcode => $library->{branchcode}, > surname => "Guarantee" > }; > $guarantee->{'borrowernumber'} = AddMember(%$guarantee); > >-my $GUARANTEE_TO_ADDRESS = 'toto@exemple.com'; >+my $GUARANTEE_TO_ADDRESS = 'guarantor@example.com'; > my $guarantee_message = { > borrowernumber => $guarantee->{'borrowernumber'}, > message_transport_type => 'email', >@@ -178,7 +182,7 @@ my $guarantee_message = { > sub SendToGuarantor { > my ($useGuarantor, $message) = @_; > C4::Context->set_preference( 'AutoEmailPrimaryAddress', 'OFF' ); >- C4::Context->set_preference( 'EnableRedirectGuaranteeEmail', $useGuarantor ); >+ C4::Context->set_preference( 'RedirectGuaranteeEmail', $useGuarantor ); > C4::Context->clear_syspref_cache(); > my $id = C4::Letters::EnqueueLetter($message); > C4::Letters::SendQueuedMessages(); >@@ -186,22 +190,12 @@ sub SendToGuarantor { > return $result; > } > my $result = SendToGuarantor(0,$guarantee_message); >-is($result->{'status'}, "sent", "With EnableRedirectGuaranteeEmail off, message is sent."); >-is($result->{'to_address'}, $GUARANTEE_TO_ADDRESS, "With EnableRedirectGuaranteeEmail off, Message is sent to the specified to_address."); >- >-$result = SendToGuarantor(1,$guarantee_message); >-is($result->{'status'}, "sent", "With EnableRedirectGuaranteeEmail on, message is sent."); >-is($result->{'to_address'}, $GUARANTOR_EMAIL, "With EnableRedirectGuaranteeEmail on, Message is sent to the guarantor's email address."); >- >-$guarantor->{'email'} = undef; >-ModMember(%$guarantor); >-$result = SendToGuarantor(1,$guarantee_message); >-is($result->{'status'}, "failed", "With EnableRedirectGuaranteeEmail on, message fails if guarantor has no address."); >+is($result->{'status'}, "sent", "With RedirectGuaranteeEmail off, message is sent."); >+is($result->{'to_address'}, $GUARANTEE_TO_ADDRESS, "With RedirectGuaranteeEmail off, Message is sent to the specified to_address."); > >-$guarantee->{'guarantorid'} = undef; >-ModMember(%$guarantee); > $result = SendToGuarantor(1,$guarantee_message); >-is($result->{'to_address'}, $GUARANTEE_TO_ADDRESS, "With EnableRedirectGuaranteeEmail on, Message is sent to specicied to_address if he has no guarantor."); >+is($result->{'status'}, "sent", "With RedirectGuaranteeEmail on, message is sent."); >+is($result->{'to_address'}, $GUARANTOR_EMAIL, "With RedirectGuaranteeEmail on, Message is sent to the guarantor's email address."); > > # GetLetters > my $letters = C4::Letters::GetLetters(); >diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t >index 6d2f58a..cb255ed 100755 >--- a/t/db_dependent/Members.t >+++ b/t/db_dependent/Members.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 64; >+use Test::More tests => 87; > use Test::MockModule; > use Data::Dumper; > use C4::Context; >@@ -140,7 +140,7 @@ is ($checkcardnum, "2", "Card number is too long"); > > t::lib::Mocks::mock_preference( 'AutoEmailPrimaryAddress', 'OFF' ); > >-C4::Context->set_preference( 'EnableRedirectGuaranteeEmail', 0 ); >+C4::Context->set_preference( 'RedirectGuaranteeEmail', 0 ); > C4::Context->set_preference( 'AutoEmailPrimaryAddress', 'OFF' ); > C4::Context->clear_syspref_cache(); > >@@ -165,13 +165,13 @@ my $guarantee = { > $guarantee->{'borrowernumber'} = AddMember(%$guarantee); > > $notice_email = GetNoticeEmailAddress($guarantee->{'borrowernumber'}); >-is ($notice_email, $GUARANTEE_EMAIL, "GetNoticeEmailAddress returns correct value when EnableRedirectGuaranteeEmail is disabled"); >+is ($notice_email, $GUARANTEE_EMAIL, "GetNoticeEmailAddress returns correct value when RedirectGuaranteeEmail is disabled"); > >-C4::Context->set_preference( 'EnableRedirectGuaranteeEmail', 1 ); >+C4::Context->set_preference( 'RedirectGuaranteeEmail', 1 ); > C4::Context->clear_syspref_cache(); > > $notice_email = GetNoticeEmailAddress($guarantee->{'borrowernumber'}); >-is ($notice_email, $EMAILPRO, "GetNoticeEmailAddress returns correct value when EnableRedirectGuaranteeEmail is activated"); >+is ($notice_email, "$GUARANTEE_EMAIL,$EMAILPRO", "GetNoticeEmailAddress returns correct value when RedirectGuaranteeEmail is activated"); > > > ok(!$member->{is_expired}, "GetMemberDetails() indicates that patron is not expired"); >@@ -317,7 +317,7 @@ my $borrower2 = $builder->build({ > }, > }); > >-my $guarantee = $builder->build({ >+$guarantee = $builder->build({ > source => 'Borrower', > value => { > categorycode=>'KIDclamp', >-- >1.9.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 12532
:
29510
|
30747
|
35313
|
36752
|
39787
|
39925
|
48645
|
53649
|
53689
|
53690
|
53699
|
53700
|
55985
|
56052
|
56053
|
59445
|
59446
|
59447
|
63197
|
64802
|
64824
|
67115
|
68340
|
70865
|
72064
|
72617
|
75099
|
77606
|
80313
|
85134
|
85135
|
87815
|
87816
|
88208
|
88209
|
88210
|
88211
|
88212
|
88213
|
88295
|
88296
|
114455
|
114456
|
114457
|
114458
|
114459
|
114460
|
114461
|
131091
|
131092
|
131093
|
131094
|
149233
|
150071
|
150208
|
150217
|
150240
|
150256
|
151028
|
151029
|
154854
|
154855
|
154856
|
154857
|
155036
|
155037
|
155828
|
155829
|
155830
|
155831
|
155832
|
155833
|
155834
|
155835
|
155836
|
155837
|
155873
|
155874
|
155875
|
155876
|
155877
|
155878
|
155879
|
155880
|
155881
|
155882
|
155883
|
155886
|
155934
|
155935
|
155936
|
155937
|
155938
|
155939
|
155940
|
155941
|
155942
|
155943
|
155944
|
155945
|
155946