Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 7; |
22 |
use Test::More tests => 8; |
23 |
use Test::Exception; |
23 |
use Test::Exception; |
24 |
use Test::Warn; |
24 |
use Test::Warn; |
25 |
|
25 |
|
Lines 284-289
subtest 'add_enrolment_fee_if_needed() tests' => sub {
Link Here
|
284 |
}; |
284 |
}; |
285 |
}; |
285 |
}; |
286 |
|
286 |
|
|
|
287 |
subtest 'messaging_preferences() tests' => sub { |
288 |
plan tests => 5; |
289 |
|
290 |
$schema->storage->txn_begin; |
291 |
|
292 |
my $mtt = $builder->build_object({ |
293 |
class => 'Koha::Patron::MessagePreference::Transport::Types' |
294 |
}); |
295 |
my $attribute = $builder->build_object({ |
296 |
class => 'Koha::Patron::MessagePreference::Attributes' |
297 |
}); |
298 |
my $branchcode = $builder->build({ |
299 |
source => 'Branch' })->{branchcode}; |
300 |
my $letter = $builder->build_object({ |
301 |
class => 'Koha::Notice::Templates', |
302 |
value => { |
303 |
branchcode => '', |
304 |
is_html => 0, |
305 |
message_transport_type => $mtt->message_transport_type |
306 |
} |
307 |
}); |
308 |
|
309 |
Koha::Patron::MessagePreference::Transport->new({ |
310 |
message_attribute_id => $attribute->message_attribute_id, |
311 |
message_transport_type => $mtt->message_transport_type, |
312 |
is_digest => 0, |
313 |
letter_module => $letter->module, |
314 |
letter_code => $letter->code, |
315 |
})->store; |
316 |
|
317 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
318 |
|
319 |
my $preference = Koha::Patron::MessagePreference->new({ |
320 |
borrowernumber => $patron->borrowernumber, |
321 |
message_attribute_id => $attribute->message_attribute_id, |
322 |
wants_digest => 0, |
323 |
days_in_advance => undef, |
324 |
})->store; |
325 |
|
326 |
my $messaging_preferences = $patron->messaging_preferences(); |
327 |
is($messaging_preferences->count, 1, 'Found one preference'); |
328 |
|
329 |
my $messaging_preference = $messaging_preferences->next; |
330 |
is($messaging_preference->borrowernumber, $patron->borrowernumber); |
331 |
is($messaging_preference->message_attribute_id, $attribute->message_attribute_id); |
332 |
is($messaging_preference->wants_digest, 0); |
333 |
is($messaging_preference->days_in_advance, undef); |
334 |
|
335 |
$schema->storage->txn_rollback; |
336 |
}; |
337 |
|
287 |
subtest 'to_api() tests' => sub { |
338 |
subtest 'to_api() tests' => sub { |
288 |
|
339 |
|
289 |
plan tests => 6; |
340 |
plan tests => 6; |
290 |
- |
|
|