Bugzilla – Attachment 118659 Details for
Bug 26705
System preference NoticeBcc not working
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26705: Regression tests
Bug-26705-Regression-tests.patch (text/plain), 2.34 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-03-23 14:06:46 UTC
(
hide
)
Description:
Bug 26705: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-03-23 14:06:46 UTC
Size:
2.34 KB
patch
obsolete
>From 0af3a00116416b1a61a703813479894bbc0c57cc Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 23 Mar 2021 10:56:59 -0300 >Subject: [PATCH] Bug 26705: Regression tests > >--- > t/Koha/Email.t | 63 +++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 62 insertions(+), 1 deletion(-) > >diff --git a/t/Koha/Email.t b/t/Koha/Email.t >index 1c46fcc2843..752269341f8 100755 >--- a/t/Koha/Email.t >+++ b/t/Koha/Email.t >@@ -17,7 +17,9 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; >+ >+use Test::MockModule; > use Test::Exception; > > use t::lib::Mocks; >@@ -175,3 +177,62 @@ subtest 'create() tests' => sub { > is( "$@", q{Invalid 'bcc' parameter: not_an_email}, 'Exception message correct' ); > }; > }; >+ >+subtest 'send_or_die() tests' => sub { >+ >+ plan tests => 4; >+ >+ my $email; >+ my $args; >+ >+ my $transport = "Hi there!"; >+ >+ my $mocked_email_simple = Test::MockModule->new('Email::Sender::Simple'); >+ $mocked_email_simple->mock( >+ 'send', >+ sub { >+ my @params = @_; >+ $email = $params[1]; >+ $args = $params[2]; >+ return; >+ } >+ ); >+ >+ my $html_body = '<h1>Title</h1><p>Message</p>'; >+ my $THE_email = Koha::Email->create( >+ { >+ from => 'from@example.com', >+ to => 'to@example.com', >+ cc => 'cc@example.com', >+ reply_to => 'reply_to@example.com', >+ sender => 'sender@example.com', >+ html_body => $html_body >+ } >+ ); >+ >+ my @bcc = ( 'bcc_1@example.com', 'bcc_2@example.com' ); >+ >+ $THE_email->bcc(@bcc); >+ >+ is( >+ $THE_email->email->header_str('Bcc'), >+ join( ', ', @bcc ), >+ 'Bcc header set correctly' >+ ); >+ >+ $THE_email->send_or_die( >+ { transport => $transport, to => ['tomasito@mail.com'] } ); >+ is_deeply( $args->{to}, ['tomasito@mail.com'], >+ 'If explicitly passed, "to" is preserved' ); >+ >+ $THE_email->send_or_die( { transport => $transport } ); >+ is_deeply( >+ $args->{to}, >+ [ >+ 'to@example.com', 'cc@example.com', >+ 'bcc_1@example.com', 'bcc_2@example.com' >+ ], >+ 'If explicitly passed, "to" is preserved' >+ ); >+ is( $email->header_str('Bcc'), undef, 'The Bcc header is unset' ); >+}; >-- >2.31.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 26705
:
118659
|
118660
|
118663
|
118664
|
118665
|
118704
|
118705
|
118713
|
118714
|
118715
|
118716