From 52f70b9b9f9d1585231824e83d5ddc5c55d1507c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 19 Oct 2021 16:57:10 +0100 Subject: [PATCH] Bug 28729: Unit tests Signed-off-by: David Nind Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit b942d1371476ebedc0bda2b2b446b08f84955594) Signed-off-by: Fridolin Somers --- t/Koha/Email.t | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/t/Koha/Email.t b/t/Koha/Email.t index a5c56df215..af8030bbe6 100755 --- a/t/Koha/Email.t +++ b/t/Koha/Email.t @@ -191,7 +191,7 @@ subtest 'create() tests' => sub { subtest 'send_or_die() tests' => sub { - plan tests => 4; + plan tests => 7; my $email; my $args; @@ -232,9 +232,10 @@ subtest 'send_or_die() tests' => sub { ); $THE_email->send_or_die( - { transport => $transport, to => ['tomasito@mail.com'] } ); + { transport => $transport, to => ['tomasito@mail.com'], from => 'returns@example.com' } ); is_deeply( $args->{to}, ['tomasito@mail.com'], 'If explicitly passed, "to" is preserved' ); + is( $args->{from}, 'returns@example.com', 'If explicitly pass, "from" is preserved'); $THE_email->send_or_die( { transport => $transport } ); my @to = sort @{ $args->{to} }; @@ -247,4 +248,7 @@ subtest 'send_or_die() tests' => sub { 'If "to" is not explicitly passed, extract recipients from headers' ); is( $email->header_str('Bcc'), undef, 'The Bcc header is unset' ); + my $from = $args->{from}; + is( $from, 'sender@example.com', 'If "from" is not explicitly passed, extract from Sender header' ); + is( $email->header_str('Sender'), undef, 'The Sender header is unset' ); }; -- 2.39.5