Lines 16-26
Link Here
|
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
use Test::More tests => 3; |
19 |
use Test::More tests => 5; |
20 |
|
20 |
|
21 |
use utf8; |
21 |
use utf8; |
22 |
|
22 |
|
23 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
|
|
24 |
use t::lib::Mocks; |
24 |
|
25 |
|
25 |
use C4::Letters qw( GetPreparedLetter ); |
26 |
use C4::Letters qw( GetPreparedLetter ); |
26 |
use Koha::Database; |
27 |
use Koha::Database; |
Lines 37-43
$dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('test
Link Here
|
37 |
")}); |
38 |
")}); |
38 |
my $biblio_1 = $builder->build_sample_biblio({ title => "heÄllo" }); |
39 |
my $biblio_1 = $builder->build_sample_biblio({ title => "heÄllo" }); |
39 |
my $biblio_2 = $builder->build_sample_biblio({ title => "hell❤️" }); |
40 |
my $biblio_2 = $builder->build_sample_biblio({ title => "hell❤️" }); |
40 |
my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { email => 'test@example.org'} }); |
41 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
41 |
my $letter = C4::Letters::GetPreparedLetter( |
42 |
my $letter = C4::Letters::GetPreparedLetter( |
42 |
( |
43 |
( |
43 |
module => 'test', |
44 |
module => 'test', |
Lines 48-56
my $letter = C4::Letters::GetPreparedLetter(
Link Here
|
48 |
) |
49 |
) |
49 |
); |
50 |
); |
50 |
|
51 |
|
51 |
C4::Message->enqueue($letter, $patron->unblessed, 'email'); |
52 |
|
|
|
53 |
t::lib::Mocks::mock_preference( 'AutoEmailPrimaryAddress', 'OFF' ); |
54 |
C4::Message->enqueue($letter, $patron, 'email'); |
52 |
my $message = C4::Message->find_last_message($patron->unblessed, 'TEST_MESSAGE', 'email'); |
55 |
my $message = C4::Message->find_last_message($patron->unblessed, 'TEST_MESSAGE', 'email'); |
53 |
like( $message->{metadata}, qr{heÄllo} ); |
56 |
like( $message->{metadata}, qr{heÄllo} ); |
|
|
57 |
is ($message->{to_address}, $patron->email, "To address set correctly for AutoEmailPrimaryAddress 'off'"); |
54 |
|
58 |
|
55 |
$letter = C4::Letters::GetPreparedLetter( |
59 |
$letter = C4::Letters::GetPreparedLetter( |
56 |
( |
60 |
( |
Lines 64-66
$letter = C4::Letters::GetPreparedLetter(
Link Here
|
64 |
$message->append($letter); |
68 |
$message->append($letter); |
65 |
like( $message->{metadata}, qr{heÄllo} ); |
69 |
like( $message->{metadata}, qr{heÄllo} ); |
66 |
like( $message->{metadata}, qr{hell❤️} ); |
70 |
like( $message->{metadata}, qr{hell❤️} ); |
67 |
- |
71 |
|
|
|
72 |
t::lib::Mocks::mock_preference( 'AutoEmailPrimaryAddress', 'emailpro' ); |
73 |
C4::Message->enqueue($letter, $patron, 'email'); |
74 |
$message = C4::Message->find_last_message($patron->unblessed, 'TEST_MESSAGE', 'email'); |
75 |
is ($patron->notice_email_address, $patron->emailpro, "To address set correctly for AutoEmailPrimaryAddress 'emailpro'"); |