Lines 327-333
subtest 'regression tests' => sub {
Link Here
|
327 |
}; |
327 |
}; |
328 |
|
328 |
|
329 |
subtest 'loops' => sub { |
329 |
subtest 'loops' => sub { |
330 |
plan tests => 1; |
330 |
plan tests => 2; |
331 |
my $code = "TEST"; |
331 |
my $code = "TEST"; |
332 |
my $module = "TEST"; |
332 |
my $module = "TEST"; |
333 |
|
333 |
|
Lines 342-347
subtest 'loops' => sub {
Link Here
|
342 |
my $expected_letter = join '', ( $patron_1->{surname}, $patron_2->{surname} ); |
342 |
my $expected_letter = join '', ( $patron_1->{surname}, $patron_2->{surname} ); |
343 |
is( $letter->{content}, $expected_letter, ); |
343 |
is( $letter->{content}, $expected_letter, ); |
344 |
}; |
344 |
}; |
|
|
345 |
|
346 |
subtest 'foreign key is used' => sub { |
347 |
plan tests => 1; |
348 |
my $patron_1 = $builder->build({ source => 'Borrower' }); |
349 |
my $patron_2 = $builder->build({ source => 'Borrower' }); |
350 |
my $checkout_1 = $builder->build({ source => 'Issue', value => { borrowernumber => $patron_1->{borrowernumber} } } ); |
351 |
my $checkout_2 = $builder->build({ source => 'Issue', value => { borrowernumber => $patron_1->{borrowernumber} } } ); |
352 |
|
353 |
my $template = q|[% FOREACH checkout IN checkouts %][% checkout.issue_id %][% END %]|; |
354 |
reset_template( { template => $template, code => $code, module => $module } ); |
355 |
my $letter = GetPreparedLetter( module => $module, letter_code => $code, loops => { issues => [ $checkout_1->{itemnumber}, $checkout_2->{itemnumber} ] } ); |
356 |
my $expected_letter = join '', ( $checkout_1->{issue_id}, $checkout_2->{issue_id} ); |
357 |
is( $letter->{content}, $expected_letter, ); |
358 |
}; |
345 |
}; |
359 |
}; |
346 |
|
360 |
|
347 |
sub reset_template { |
361 |
sub reset_template { |
348 |
- |
|
|