Lines 283-289
$prepared_letter = GetPreparedLetter(
Link Here
|
283 |
is( $prepared_letter->{content}, $modification->id(), 'Patron modification object used correctly' ); |
283 |
is( $prepared_letter->{content}, $modification->id(), 'Patron modification object used correctly' ); |
284 |
|
284 |
|
285 |
subtest 'loops' => sub { |
285 |
subtest 'loops' => sub { |
286 |
plan tests => 1; |
286 |
plan tests => 2; |
287 |
my $code = "TEST"; |
287 |
my $code = "TEST"; |
288 |
my $module = "TEST"; |
288 |
my $module = "TEST"; |
289 |
|
289 |
|
Lines 298-303
subtest 'loops' => sub {
Link Here
|
298 |
my $expected_letter = join '', ( $patron_1->{surname}, $patron_2->{surname} ); |
298 |
my $expected_letter = join '', ( $patron_1->{surname}, $patron_2->{surname} ); |
299 |
is( $letter->{content}, $expected_letter, ); |
299 |
is( $letter->{content}, $expected_letter, ); |
300 |
}; |
300 |
}; |
|
|
301 |
|
302 |
subtest 'foreign key is used' => sub { |
303 |
plan tests => 1; |
304 |
my $patron_1 = $builder->build({ source => 'Borrower' }); |
305 |
my $patron_2 = $builder->build({ source => 'Borrower' }); |
306 |
my $checkout_1 = $builder->build({ source => 'Issue', value => { borrowernumber => $patron_1->{borrowernumber} } } ); |
307 |
my $checkout_2 = $builder->build({ source => 'Issue', value => { borrowernumber => $patron_1->{borrowernumber} } } ); |
308 |
|
309 |
my $template = q|[% FOREACH checkout IN checkouts %][% checkout.issue_id %][% END %]|; |
310 |
reset_template( { template => $template, code => $code, module => $module } ); |
311 |
my $letter = GetPreparedLetter( module => $module, letter_code => $code, loops => { issues => [ $checkout_1->{itemnumber}, $checkout_2->{itemnumber} ] } ); |
312 |
my $expected_letter = join '', ( $checkout_1->{issue_id}, $checkout_2->{issue_id} ); |
313 |
is( $letter->{content}, $expected_letter, ); |
314 |
}; |
301 |
}; |
315 |
}; |
302 |
|
316 |
|
303 |
sub reset_template { |
317 |
sub reset_template { |
304 |
- |
|
|