Lines 365-371
count(h.reservedate) AS 'holds'
Link Here
|
365 |
|
365 |
|
366 |
subtest 'Email report test' => sub { |
366 |
subtest 'Email report test' => sub { |
367 |
|
367 |
|
368 |
plan tests => 12; |
368 |
plan tests => 14; |
369 |
my $dbh = C4::Context->dbh; |
369 |
my $dbh = C4::Context->dbh; |
370 |
|
370 |
|
371 |
my $id1 = $builder->build({ source => 'Borrower',value => { surname => 'mailer', email => 'a@b.com', emailpro => 'b@c.com' } })->{ borrowernumber }; |
371 |
my $id1 = $builder->build({ source => 'Borrower',value => { surname => 'mailer', email => 'a@b.com', emailpro => 'b@c.com' } })->{ borrowernumber }; |
Lines 379-385
subtest 'Email report test' => sub {
Link Here
|
379 |
value => { |
379 |
value => { |
380 |
content => "[% surname %]", |
380 |
content => "[% surname %]", |
381 |
branchcode => "", |
381 |
branchcode => "", |
382 |
message_transport_type => 'email' |
382 |
message_transport_type => 'email', |
|
|
383 |
is_html => undef |
383 |
} |
384 |
} |
384 |
}); |
385 |
}); |
385 |
my $letter2 = $builder->build({ |
386 |
my $letter2 = $builder->build({ |
Lines 387-393
subtest 'Email report test' => sub {
Link Here
|
387 |
value => { |
388 |
value => { |
388 |
content => "[% firstname %]", |
389 |
content => "[% firstname %]", |
389 |
branchcode => "", |
390 |
branchcode => "", |
390 |
message_transport_type => 'email' |
391 |
message_transport_type => 'email', |
|
|
392 |
is_html => 0 |
393 |
} |
394 |
}); |
395 |
|
396 |
my $letter3 = $builder->build({ |
397 |
source => 'Letter', |
398 |
value => { |
399 |
content => "[% surname %]", |
400 |
branchcode => "", |
401 |
message_transport_type => 'email', |
402 |
is_html => 1 |
391 |
} |
403 |
} |
392 |
}); |
404 |
}); |
393 |
|
405 |
|
Lines 416-427
subtest 'Email report test' => sub {
Link Here
|
416 |
($emails, $errors ) = C4::Reports::Guided::EmailReport({report_id => $report1, module => $letter1->{module} , code => $letter1->{code}, from => 'the@future.ooh' }); |
428 |
($emails, $errors ) = C4::Reports::Guided::EmailReport({report_id => $report1, module => $letter1->{module} , code => $letter1->{code}, from => 'the@future.ooh' }); |
417 |
is( $emails->[0]{letter}->{content}, "mailer", "Message has expected content"); |
429 |
is( $emails->[0]{letter}->{content}, "mailer", "Message has expected content"); |
418 |
is( $emails->[1]{letter}->{content}, "norman", "Message has expected content"); |
430 |
is( $emails->[1]{letter}->{content}, "norman", "Message has expected content"); |
|
|
431 |
is( $emails->[0]{letter}->{'content-type'}, undef, "Message content type is not set for plain text mail"); |
419 |
|
432 |
|
420 |
($emails, $errors ) = C4::Reports::Guided::EmailReport({report_id => $report1, module => $letter1->{module} , code => $letter1->{code}, from => 'the@future.ooh', email => 'emailpro' }); |
433 |
($emails, $errors ) = C4::Reports::Guided::EmailReport({report_id => $report1, module => $letter1->{module} , code => $letter1->{code}, from => 'the@future.ooh', email => 'emailpro' }); |
421 |
is_deeply( $errors, [{'NO_EMAIL_COL'=>3}],"We report missing email in emailpro column"); |
434 |
is_deeply( $errors, [{'NO_EMAIL_COL'=>3}],"We report missing email in emailpro column"); |
422 |
is( $emails->[0]->{to_address}, 'b@c.com', "Message uses correct email"); |
435 |
is( $emails->[0]->{to_address}, 'b@c.com', "Message uses correct email"); |
423 |
is( $emails->[1]->{to_address}, 'd@e.com', "Message uses correct email"); |
436 |
is( $emails->[1]->{to_address}, 'd@e.com', "Message uses correct email"); |
424 |
|
437 |
|
|
|
438 |
($emails) = C4::Reports::Guided::EmailReport({report_id => $report1, module => $letter3->{module} , code => $letter3->{code}, from => 'the@future.ooh' }); |
439 |
is( $emails->[0]{letter}->{'content-type'}, 'text/html; charset="UTF-8"', "Message has expected content type"); |
440 |
|
425 |
}; |
441 |
}; |
426 |
|
442 |
|
427 |
$schema->storage->txn_rollback; |
443 |
$schema->storage->txn_rollback; |
428 |
- |
|
|