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